Rockbox

  • Status Closed
  • Percent Complete
    100%
  • Task Type Patches
  • Category Drivers
  • Assigned To
    nls
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version Version 3.3
  • Due in Version Future release
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by nls - 2009-08-29
Last edited by nls - 2009-09-26

FS#10569 - RTC driver cleanup

This patch moves the handling of the tm struct into the rtc drivers’ rtc_(read|write)_datetime functions to avoid the rtc drivers having to encode the data into the same format used natively in some old archos rtc chip. Also a macro is now used for conversion to and from bcd in the drivers that use it, and a few random cleanups and a bit of useless whitespace changes that can be ignored ;)
This removes a lot of target specific code and all sim specific code from timerfuncs.c – less #ifdef hell, yay :)

I’ve test built most of the drivers but have only tested on the gigabeast. The best test i could come up with was to install a patched build and see if time is read correctly then change it and go back to an unpatched build and see if that can read the new time.

there is one comment in the ds1339…. driver that mentions something about century and OR’s the month value with 0×80 that i have no idea if it’s correct but i tried to keep it as it was.

   rtc.diff (33.1 KiB)
Closed by  nls
2009-09-26 15:33
Reason for closing:  Accepted
Additional comments about closing:  

commited

My sansa e200 and sansa clip still show the correct time, the day-of-week in the calendar plugin is also correct. Both of these targets use the rtc_as3514.c driver.

H100 w/ RTC-Mod: doesn't work. Date shows up correctly when trying to set it, the time / date dialog shows "–:–:–, unknown". Trying to start the calendar plugin results in a hard hang (possibly an endless loop in the plugin?)

mrobe 100: setting time and date works, calendar plugin is correct.

Ipod Mini2G: works as mrobe 100.

Note that I haven't tried alarms.

nls commented on 2009-08-29 21:06

this version is closer to svn, migth it fix the h100 problems?

nls commented on 2009-08-29 21:27

ok, it's broken for several of the targets using bcd so i'll try to fix tomorrow

nls commented on 2009-08-30 08:33

This patch should fix time reading on targets using the ds1339_ds3231, e8564 and m41st84w drivers.
Hopefully time setting on ds1339_ds3231 should also be fixed.
This version also replaced the literal address constant in the e8564 driver with a #defined constant and uses the BCD macros in more places.

To summarise the status:
Confirmed working: as3514, mrobe100, mc13783, pcf50605, pcf50606

Broken but hopefully fixed in this version: ds1339_ds3231 and e8564

Not tested: m41st84w, jz4740, rx5x348ab, s3c2440, s35390a
all of these except jz4740 use internal bcd representation so it's very possible they need the same fix as ds1339_ds3231 and e8564.

The updated patch works as expected on h100 RTC. Compilation however gives a warning (haven't tried to fix that for testing):

CC firmware/drivers/rtc/rtc_ds1339_ds3231.c
/home/dom/projects/rockbox/firmware/drivers/rtc/rtc_ds1339_ds3231.c: In function `rtc_read_datetime':
/home/dom/projects/rockbox/firmware/drivers/rtc/rtc_ds1339_ds3231.c:129: warning: statement with no effect

nls commented on 2009-08-31 14:31

This patch fixes the warning and also that the previous version would fill in the wday value with 1-7 for ds1339_ds3231.
Also fix a stupid typo preventing the e8564 driver from building…

teru commented on 2009-09-07 12:23

I tested rtc_4.diff on gigabeat X, r22639. both time and date menu and calendar plugin work correctly.

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing