libdragon
|
Real-Time Clock Subsystem. More...
Macros | |
#define | JOYBUS_RTC_IDENTIFIER 0x1000 |
Joybus real-time clock identifier. | |
#define | JOYBUS_RTC_WRITE_BLOCK_DELAY 20 |
Duration (in milliseconds) to wait after writing a Joybus RTC block. | |
#define | JOYBUS_RTC_WRITE_FINISHED_DELAY 500 |
Duration (in milliseconds) to wait after setting Joybus RTC time. | |
#define | JOYBUS_RTC_STATUS_RUNNING 0x00 |
The Joybus RTC is running. | |
#define | JOYBUS_RTC_STATUS_STOPPED 0x80 |
The Joybus RTC is stopped. | |
#define | JOYBUS_RTC_CONTROL_MODE_SET 0x0004 |
Control mode for setting the Joybus RTC date/time. | |
#define | JOYBUS_RTC_CONTROL_MODE_RUN 0x0300 |
Control mode for normal operation of the Joybus RTC. | |
#define | RTC_GET_CACHE_INVALIDATE_TICKS (TICKS_PER_SECOND) |
Invalidate the most-recent RTC time cache after 1 second. | |
Enumerations | |
enum | rtc_type_t { RTC_NONE = 0 , RTC_JOYBUS = 1 , RTC_DD = 2 , RTC_UNKNOWN = -1 } |
Real-time clock detection values. More... | |
Functions | |
bool | rtc_init (void) |
High-level convenience helper to initialize the RTC subsystem. | |
void | rtc_close (void) |
Close the RTC Subsystem, disabling system hooks. | |
void | rtc_normalize_time (rtc_time_t *rtc_time) |
Calculate sane values for arbitrary time inputs. | |
bool | rtc_get (rtc_time_t *rtc_time) |
Read the current date/time from the real-time clock. | |
bool | rtc_set (rtc_time_t *write_time) |
High-level convenience helper to set the RTC date/time. | |
bool | rtc_is_writable (void) |
Determine whether the RTC supports writing the time. | |
Real-Time Clock Subsystem.
#define JOYBUS_RTC_IDENTIFIER 0x1000 |
Joybus real-time clock identifier.
A magic value in the SI RTC status response that indicates the Joybus RTC is present.
#define JOYBUS_RTC_WRITE_BLOCK_DELAY 20 |
Duration (in milliseconds) to wait after writing a Joybus RTC block.
The software should wait for the previous RTC write to finish before issuing another Joybus RTC command. Ideally, you could read the RTC status byte to determine when to proceed, but some RTC reproductions do not correctly implement the RTC status response, so a delay is used for compatibility.
#define JOYBUS_RTC_WRITE_FINISHED_DELAY 500 |
Duration (in milliseconds) to wait after setting Joybus RTC time.
64drive hw2 only updates the RTC readout a few times per second, so it is possible to write a new time, then read back the previous time before the 64drive clock ticks to update the "shadow interface" that the SI reads from.
Without this delay, the rtc_is_writable test may fail intermittently on 64drive hw2.
#define JOYBUS_RTC_STATUS_RUNNING 0x00 |
The Joybus RTC is running.
It is safe to read the current time from the RTC.
#define JOYBUS_RTC_STATUS_STOPPED 0x80 |
The Joybus RTC is stopped.
It is safe to write new time data to the RTC.
#define JOYBUS_RTC_CONTROL_MODE_SET 0x0004 |
Control mode for setting the Joybus RTC date/time.
Clears the write-protection bits and sets the stop bit.
#define JOYBUS_RTC_CONTROL_MODE_RUN 0x0300 |
Control mode for normal operation of the Joybus RTC.
Clears the stop bit sets the write-protection bits.
0x0100 is the block 1 write-protection bit. 0x0200 is the block 2 write-protection bit.
enum rtc_type_t |