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

Function usb_read

core/usb/usb.c:213–227  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

211}
212
213static uint8_t usb_read(uint16_t pio, bool peek) {
214 uint8_t value = 0;
215 if (pio < sizeof usb.regs) {
216 if (unlikely(usb.regs.dma_ctrl >> 31 & usb.regs.phy_tmsr) && pio >= 0x044 && pio < 0x1C8) {
217 value = 0;
218 } else if (pio >= 0x1A0 && pio < 0x1AC) {
219 value = usb.regBytes[pio];
220 } else {
221 value = read8(usb.regWords[pio >> 2], (pio & 3) << 3);
222 }
223 } else if (pio < (peek ? 0x1d8 : 0x1d4)) {
224 value = usb.ep0_data[peek ? (usb.ep0_idx & 4) ^ (pio & 7) : (usb_ep0_idx_update() & 4) | (pio & 3)];
225 }
226 return value;
227}
228
229static void usb_write(uint16_t pio, uint8_t value, bool poke) {
230 uint8_t index = pio >> 2;

Callers

nothing calls this directly

Calls 1

usb_ep0_idx_updateFunction · 0.85

Tested by

no test coverage detected