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

Function gpt_write

core/timers.c:152–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150}
151
152static void gpt_write(uint16_t address, uint8_t value, bool poke) {
153 int timer;
154 bool counter_delay;
155 uint8_t index = address >> 2;
156 uint8_t bit_offset = (address & 3) << 3;
157 (void)poke;
158
159 if (index == 0xD) {
160 uint32_t mask = ~((uint32_t)value << bit_offset & 0x1FF);
161 gpt.status &= mask;
162 if (sched_active(SCHED_TIMER_DELAY) && sched_ticks_remaining(SCHED_TIMER_DELAY) == 1) {
163 gpt.delayStatus &= mask;
164 }
165 } else if (index < 0xF) {
166 counter_delay = index < 0xC && (index & 3) == 0;
167 cpu.cycles += counter_delay;
168 timer = index >> 2;
169 gpt_some(timer, gpt_restore_state);
170 write8(gpt.regs[index], bit_offset, value);
171 gpt_some(timer, gpt_refresh);
172 cpu.cycles -= counter_delay;
173 }
174}
175
176static void gpt_init_events(void) {
177 enum sched_item_id id;

Callers

nothing calls this directly

Calls 3

sched_activeFunction · 0.85
sched_ticks_remainingFunction · 0.85
gpt_someFunction · 0.85

Tested by

no test coverage detected