MCPcopy Create free account
hub / github.com/CE-Programming/CEmu / rtc_write

Function rtc_write

core/realclock.c:130–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128}
129
130static void rtc_write(const uint16_t pio, const uint8_t byte, bool poke) {
131 uint16_t index = pio & 0xFF;
132 uint8_t bit_offset = (index & 3) << 3;
133 (void)poke;
134
135 switch (index) {
136 case 0x10:
137 rtc.alarmSec = byte;
138 break;
139 case 0x14:
140 rtc.alarmMin = byte;
141 break;
142 case 0x18:
143 rtc.alarmHour = byte;
144 break;
145 case 0x20:
146 rtc.control = byte;
147 if (rtc.control & 1) {
148 sched_repeat_relative(SCHED_RTC, SCHED_SECOND, 0, 0);
149 } else {
150 sched_clear(SCHED_RTC);
151 }
152 if (!(rtc.control & 128)) {
153 hold_read();
154 }
155 break;
156 case 0x24:
157 rtc.writeSec = byte;
158 break;
159 case 0x28:
160 rtc.writeMin = byte;
161 break;
162 case 0x2C:
163 rtc.writeHour = byte;
164 break;
165 case 0x30: case 0x31:
166 write8(rtc.writeDay, bit_offset, byte);
167 break;
168 case 0x34:
169 rtc.interrupt &= ~byte;
170 intrpt_set(INT_RTC, rtc.interrupt & rtc.control & 15);
171 break;
172 default:
173 break;
174 }
175}
176
177static void rtc_init_events(void) {
178 sched_init_event(SCHED_RTC, CLOCK_32K, rtc_event);

Callers

nothing calls this directly

Calls 4

sched_repeat_relativeFunction · 0.85
sched_clearFunction · 0.85
hold_readFunction · 0.85
intrpt_setFunction · 0.85

Tested by

no test coverage detected