TOD/RTC questions

Alan Cudmore alan.cudmore at gmail.com
Fri Aug 29 15:38:19 UTC 2014


I was able to get the ds1307 i2c part working on the Pi. The tod.c 
driver shell was calling setRealTimeToRTEMS() but it was failing in 
rtems_clock_set because my driver was not returning the correct 
rtems_tod format.
Now when I boot the Pi, the rtems time is synced to the battery backed RTC.

Thanks,
Alan

On 8/28/2014 1:26 PM, Joel Sherrill wrote:
> On 8/28/2014 12:16 PM, Alan Cudmore wrote:
>> I am testing out the Raspberry Pi I2C interface by implementing a
>> DS1307 RTC driver.
>>
>> I started with the libchip/rtc/ds1375.c driver, since it is very close
>> to the 1307.
>>
>> In the Raspberry Pi BSP, I added code to i2c_init.c to create a raw
>> device node for the RTC device, then I added the tod/todcfg.h similar
>> to the powerpc/mvme3100 BSP.
>>
>> Using the test functions I can read and write the device, but is there
>> anything else I need to do in order to tie it to the RTEMS time functions?
>>
>> For example:
>> In the shell ( main_date.c ) , the time() function just returns the
>> 1998 epoch. Also, the shell rtc command ( main_rtc.c ) calls
>> rtems_clock_get_tod, but returns a error. If I use the RTC command and
>> set the time, it does try to write to my device and subsequent calls
>> to rtems_clock_tod do not return an error.
>>
>> Am I missing any setup here?
>>
>> Finally, is RTC the same as TOD for RTEMS?
>>
> It is a source to set the TOD from. There are some ugly APIs provided
> by the RTC driver shell code. They really need new names but I haven't
> had any good ideas. :(
>
> See libbsp/shared/tod.c.
>
> setRealTimeFromRTEMS() is probably the missing call you are looking
> for.
>> Thanks,
>> Alan




More information about the devel mailing list