Device: Clock
The clock device provides access to the time and date, and to four countdown timers.
Port | Name | Description | Read | Write |
---|---|---|---|---|
0x30 | Year | Current year. | ✓ | ✓ |
0x31 | Month | Current month. | ✓ | ✓ |
0x32 | Day | Current day. | ✓ | ✓ |
0x33 | Hour | Current hour. | ✓ | ✓ |
0x34 | Minute | Current minute. | ✓ | ✓ |
0x35 | Second | Current second. | ✓ | ✓ |
0x36 | Uptime | Uptime counter. | ✓ | ✗ |
0x37 | continued | continued | ✓ | ✗ |
0x38 | Timer 1 | Countdown timer 1. | ✓ | ✓ |
0x39 | continued | continued | ✓ | ✓ |
0x3A | Timer 2 | Countdown timer 2. | ✓ | ✓ |
0x3B | continued | continued | ✓ | ✓ |
0x3C | Timer 3 | Countdown timer 3. | ✓ | ✓ |
0x3D | continued | continued | ✓ | ✓ |
0x3E | Timer 4 | Countdown timer 4. | ✓ | ✓ |
0x3F | continued | continued | ✓ | ✓ |
Ports
Year
Reading from this port will return the number of full years elapsed since midnight of January 1st 2000. A value of zero represents the year 2000, and the maximum value 0xff
represents the year 2255. The value returned past the year 2255 is implementation defined.
Writing to this port will set the year stored in the system clock to the year represented by the value written, if supported by the host system.
Month
Reading from this port will return the number of full months elapsed since midnight of January 1st. A value of zero represents the month of January, and the maximum value 0x0b
represents the month of December.
Writing to this port will set the month stored in the system clock to the month represented by the value written, if supported by the host system.
Day
Reading from this port will return the number of full days elapsed since midnight of the first day of the month. A value of zero represents the first day of the month, and the maximum value 0x1e
represents the thirty-first day of the month.
Writing to this port will set the day stored in the system clock to the day represented by the value written, if supported by the host system.
Hour
Reading from this port will return the number of full hours elapsed since midnight. A value of zero represents 12 o’clock midnight, and the maximum value 0x17
represents 11 o’clock at night.
Writing to this port will set the hour stored in the system clock to the hour represented by the value written, if supported by the host system.
Minute
Reading from this port will return the number of full minutes elapsed since the start of the hour. A value of zero represents the zeroth minute, and the maximum value 0x3b
represents the fifty-nineth minute.
Writing to this port will set the minute stored in the system clock to the minute represented by the value written, if supported by the host system.
Second
Reading from this port will return the number of full seconds elapsed since the start of the minute. A value of zero represents the zeroth second, and the maximum value 0x3b
represents the fifty-nineth second. The behaviour around leap seconds is implementation defined.
Writing to this port will set the second stored in the system clock to the second represented by the value written, if supported by the host system.
Uptime
Reading from this port will perform a cached read, returning the number of full 1/256 second durations elapsed since the beginning of program evaluation. The value will wrap to zero on overflow.
Timer
Reading from a timer port group will perform a cached read, returning the duration remaining until the associated timer expires. The initial value of each timer is zero.
Writing to a timer port group will perform a cached write, setting the duration of the timer to the value written.
Each timer port group is associated with one of four countdown timers. The duration of each timer is given as a number of full 1/256 second durations, with the maximum value 0xffff
representing a duration of approximately four minutes and sixteen seconds. Each timer counts continuously down to zero, expiring when the remaining duration transitions from one to zero.
System wake
This device will send a wake request to the system device when a countdown timer expires.