This page provides the official documentation of the RTC device protocol of MINIX 3. It describes the protocol used between the readclock command and the readclock driver as well as the protocol used between readclock and other drivers. The current version documents the protocol used in git commit 039c8db774 and later. If you update this document because of changes to MINIX 3, please mention the commit ID of the change in the wiki comment.
The RTC device protocol provides a means of getting and setting the time of hardware clocks. For devices that power off via an alarm, a method for setting the alarm is also provided. Drivers should use the grant based message *_G for communicating with readclock, and user programs should use the pointer based messages. Currently, only PM is allowed to set the power off alarm, and only root is allowed to set the time.
You may set various flags that affect how the time is written or read. You may bit-wise OR flags. If you don't wish to use any flags, set RTCDEV_FLAGS to RTCDEV_NOFLAGS.
RTCDEV_Y2KBUG | Interpret 1980 as 2000 for RTC w/Y2K bug. |
RTCDEV_CMOSREG | Also set the CMOS clock register bits. |
RTCDEV_NOFLAGS | No flags set. |
Get the time from the hardware clock.
Request fields
RTCDEV_GRANT | m2_i3 | grant | Grant where the time should be stored. |
RTCDEV_FLAGS | m2_s1 | short | Any combination of flags or RTCDEV_NOFLAGS. |
Reply fields
Response fields
<16% >RTCDEV_STATUS | m2_i2 | OK or error code |
Description
Gets the time from the real time clock and writes it to the grant.
Set the time in the hardware clock.
Request fields
RTCDEV_GRANT | m2_i3 | grant | Grant where the time should be stored. |
RTCDEV_FLAGS | m2_s1 | short | Any combination of flags or RTCDEV_NOFLAGS. |
Reply fields
Response fields
<16% >RTCDEV_STATUS | m2_i2 | OK or error code |
Description
Sets the time of the real time clock to the time given in the request.
Get the time from the hardware clock.
Request fields
RTCDEV_TM | m2_p1 | pointer | struct tm * where the time should be stored. |
RTCDEV_FLAGS | m2_s1 | short | Any combination of flags or RTCDEV_NOFLAGS. |
Reply fields
Response fields
<16% >RTCDEV_STATUS | m2_i2 | OK or error code |
Description
Gets the time from the real time clock and writes it to the caller's struct tm.
Set the time in the hardware clock.
Request fields
RTCDEV_TM | m2_p1 | pointer | struct tm * where the time should be stored. |
RTCDEV_FLAGS | m2_s1 | short | Any combination of flags or RTCDEV_NOFLAGS. |
Reply fields
Response fields
<16% >RTCDEV_STATUS | m2_i2 | OK or error code |
Description
Sets the time of the real time clock to the time given in the request.
Set the time to cut the power.
Request fields
Reply fields
Response fields
<16% >RTCDEV_STATUS | m2_i2 | OK or error code |
Description
The BeagleBone and BeagleBone Black use an alarm in the real time clock to power off the the board. Use this message to set the alarm. The alarm is set to 3 seconds from the current time and then the real time clock is disabled. The kernel will re-enable the clock when the system is in a good state to be powered down.