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

Function watchdog_read

core/misc.c:121–152  ·  view source on GitHub ↗

Watchdog read routine */

Source from the content-addressed store, hash-verified

119
120/* Watchdog read routine */
121static uint8_t watchdog_read(const uint16_t pio, bool peek) {
122 uint8_t index = pio;
123 uint8_t bit_offset = (index & 3) << 3;
124 uint8_t value = 0;
125 (void)peek;
126
127 switch (index) {
128 case 0x000: case 0x001: case 0x002: case 0x003:
129 value = read8(watchdog_counter(), bit_offset);
130 break;
131 case 0x004: case 0x005: case 0x006: case 0x007:
132 value = read8(watchdog.load, bit_offset);
133 break;
134 case 0x00C:
135 value = watchdog.control;
136 break;
137 case 0x010:
138 value = watchdog.status;
139 break;
140 case 0x018:
141 value = watchdog_pulse_counter();
142 break;
143 case 0x01C: case 0x01D: case 0x01E: case 0x01F:
144 value = read8(watchdog.revision, bit_offset);
145 break;
146 default:
147 break;
148 }
149
150 /* Return 0 if unimplemented */
151 return value;
152}
153
154/* Watchdog write routine */
155static void watchdog_write(const uint16_t pio, const uint8_t byte, bool poke) {

Callers

nothing calls this directly

Calls 2

watchdog_counterFunction · 0.85
watchdog_pulse_counterFunction · 0.85

Tested by

no test coverage detected