| 150 | } |
| 151 | |
| 152 | static 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 | |
| 176 | static void gpt_init_events(void) { |
| 177 | enum sched_item_id id; |
nothing calls this directly
no test coverage detected