Le 07/08/2015 15:05, Peter Maydell a écrit :
On 16 July 2015 at 22:21, Jean-Christophe Dubois <j...@tribudubois.net> wrote:
This is using a ds1338 RTC chip on the I2C bus. This RTC chip is
not present on the real 3DS PDK board.
Signed-off-by: Jean-Christophe Dubois <j...@tribudubois.net>
'make check' doesn't pass with this patch, because it tries to start
an "imx25_3ds" machine, which doesn't exist.
Thanks, I will fix it.
+#define bcd2bin(x) (((x) & 0x0f) + ((x) >> 4) * 10)
Why not just make this an inline function?
+static void send_and_receive(void)
+{
+ uint8_t cmd[1];
+ uint8_t resp[7];
+ time_t now = time(NULL);
+ struct tm *tm_ptr = gmtime(&now);
+
+ /* reset the index in the RTC memory */
+ cmd[0] = 0;
+ i2c_send(i2c, addr, cmd, 1);
+
+ /* retrieve the date */
+ i2c_recv(i2c, addr, resp, 7);
+
+ /* check retreived time againt local time */
"retrieved"
-- PMM