Re: TOD/RTC questions

2014-08-29 Thread Alan Cudmore


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


___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: TOD/RTC questions

2014-08-29 Thread Joel Sherrill

On 8/29/2014 10:38 AM, Alan Cudmore wrote:
 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.
That's great news!

--joel
 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

-- 
Joel Sherrill, Ph.D. Director of Research  Development
joel.sherr...@oarcorp.comOn-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available(256) 722-9985

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


TOD/RTC questions

2014-08-28 Thread Alan Cudmore
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?

Thanks,
Alan
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel