TOD/RTC questions

Joel Sherrill joel.sherrill at oarcorp.com
Thu Aug 28 17:26:41 UTC 2014


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

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill at OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985




More information about the devel mailing list