This specification describes the clock device of the Bedrock computer system.
Ports
Port | Name | Description | Read | Write |
---|---|---|---|---|
0x30 |
Year | Current year. | ✓ | ✓ |
0x31 |
Month | Current month of the year. | ✓ | ✓ |
0x32 |
Day | Current day of the month. | ✓ | ✓ |
0x33 |
Hour | Current hour of the day. | ✓ | ✓ |
0x34 |
Minute | Current minute of the hour. | ✓ | ✓ |
0x35 |
Second | Current second of the minute. | ✓ | ✓ |
0x36 |
Uptime | Incrementing uptime counter. | ✓ | ✗ |
0x37 |
grouped | grouped | ✓ | ✗ |
0x38 |
Timer | Countdown timer 1. | ✓ | ✓ |
0x39 |
grouped | grouped | ✓ | ✓ |
0x3A |
Timer | Countdown timer 2. | ✓ | ✓ |
0x3B |
grouped | grouped | ✓ | ✓ |
0x3C |
Timer | Countdown timer 3. | ✓ | ✓ |
0x3D |
grouped | grouped | ✓ | ✓ |
0x3E |
Timer | Countdown timer 4. | ✓ | ✓ |
0x3F |
grouped | grouped | ✓ | ✓ |
Year
Reading from this port will return the number of full years elapsed since midnight of January 1st 2000. The value returned after the year 2255 is implementation defined.
Writing to this port will optionally set the year on the clock to the value written.
Month
Reading from this port will return the number of full months elapsed since midnight of January 1st.
Writing to this port will optionally set the month on the clock to the value written.
Day
Reading from this port will return the number of full days elapsed since midnight of the first day of the month.
Writing to this port will optionally set the day on the clock to the value written.
Hour
Reading from this port will return the number of full hours elapsed since midnight.
Writing to this port will optionally set the hour on the clock to the value written.
Minute
Reading from this port will return the number of full minutes elapsed since the start of the hour.
Writing to this port will optionally set the minute on the clock to the value written.
Second
Reading from this port will return the number of full seconds elapsed since the start of the minute. The value returned during a leap second is implementation defined.
Writing to this port will optionally set the second on the clock to the value written.
Uptime
Reading from this port group will perform an atomic read, returning the number of full 1/256 second durations elapsed since the system was started. This value will wrap to zero on overflow.
Timer
Each timer port group is associated with a countdown timer.
Reading from a timer port group will perform an atomic read, returning the value of the associated timer.
Writing to a timer port group will perform an atomic write, setting the value of the timer to the value written on commit.
Data structures
Countdown timer
A countdown timer is an unsigned 16-bit integer. The value of each timer will decrement by 1 for each full 1/256 second duration elapsed, stopping at zero. The initial value of each timer is zero.
This device contains four countdown timers: one for each of the four timer port groups.
Wake
This device will send a wake request to the system device when a countdown timer reaches zero.