Skip to content

Commit 55f268f

Browse files
committed
mb9bf560l reworked write_impl so we dont always turn on the interrupt when already on
1 parent ac78896 commit 55f268f

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

  • targets/core/cypress/mb9bf560l

targets/core/cypress/mb9bf560l/usb.hpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,7 @@ namespace klib::core::mb9bf560l::io {
228228
// get the endpoint status register
229229
volatile uint16_t* ep_status = get_endpoint_status(endpoint, mode);
230230

231-
// enable the drqi interrupt
232-
(*ep_status) |= (0x1 << 14);
233-
234-
// wait until the buffer is empty by checking the drqi flag
231+
// wait until the buffer is empty by checking the drq flag
235232
while (!((*ep_status) & (0x1 << 10))) {
236233
// do nothing
237234
}
@@ -251,7 +248,7 @@ namespace klib::core::mb9bf560l::io {
251248
(*((volatile uint8_t*)ep_data)) = data[size - 1];
252249
}
253250

254-
// set the flag we have data to send
251+
// clear the drq flag to mark we have written the data
255252
(*ep_status) &= (~(0x1 << 10));
256253
}
257254

@@ -1018,6 +1015,12 @@ namespace klib::core::mb9bf560l::io {
10181015
// call the write implementation
10191016
write_impl(endpoint, mode, data.data(), s);
10201017

1018+
// get the endpoint status register
1019+
volatile uint16_t* ep_status = get_endpoint_status(endpoint, mode);
1020+
1021+
// enable the drqi interrupt
1022+
(*ep_status) |= (0x1 << 14);
1023+
10211024
// notify everything is correct
10221025
return true;
10231026
}

0 commit comments

Comments
 (0)