8000 Disallow ctrl-C interrupts of RP2040 SPI and PIO · domdfcoding/circuitpython@ab52a92 · GitHub
[go: up one dir, main page]

Skip to content

Commit ab52a92

Browse files
committed
Disallow ctrl-C interrupts of RP2040 SPI and PIO
1 parent a843b8a commit ab52a92

File tree

2 files changed

+3
-27
lines changed

2 files changed

+3
-27
lines changed

ports/raspberrypi/common-hal/busio/SPI.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -212,15 +212,6 @@ static bool _transfer(busio_spi_obj_t *self,
212212
while (dma_channel_is_busy(chan_rx) || dma_channel_is_busy(chan_tx)) {
213213
// TODO: We should idle here until we get a DMA interrupt or something else.
214214
RUN_BACKGROUND_TASKS;
215-
if (mp_hal_is_interrupted()) {
216-
if (dma_channel_is_busy(chan_rx)) {
217-
dma_channel_abort(chan_rx);
218-
}
219-
if (dma_channel_is_busy(chan_tx)) {
220-
dma_channel_abort(chan_tx);
221-
}
222-
break;
223-
}
224215
}
225216
}
226217

@@ -233,15 +224,15 @@ static bool _transfer(busio_spi_obj_t *self,
233224
dma_channel_unclaim(chan_tx);
234225
}
235226

236-
if (!use_dma && !mp_hal_is_interrupted()) {
227+
if (!use_dma) {
237228
// Use software for small transfers, or if couldn't claim two DMA channels
238229
// Never have more transfers in flight than will fit into the RX FIFO,
239230
// else FIFO will overflow if this code is heavily interrupted.
240231
const size_t fifo_depth = 8;
241232
size_t rx_remaining = len;
242233
size_t tx_remaining = len;
243234

244-
while (!mp_hal_is_interrupted() && (rx_remaining || tx_remaining)) {
235+
while (rx_remaining || tx_remaining) {
245236
if (tx_remaining && spi_is_writable(self->peripheral) && rx_remaining - tx_remaining < fifo_depth) {
246237
spi_get_hw(self->peripheral)->dr = (uint32_t)*data_out;
247238
// Increment only if the buffer is the transfer length. It's 1 otherwise.

ports/raspberrypi/common-hal/rp2pio/StateMachine.c

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -654,15 +654,6 @@ static bool _transfer(rp2pio_statemachine_obj_t *self,
654654
(tx && dma_channel_is_busy(chan_tx))) {
655655
// TODO: We should idle here until we get a DMA interrupt or something else.
656656
RUN_BACKGROUND_TASKS;
657-
if (mp_hal_is_interrupted()) {
658-
if (rx && dma_channel_is_busy(chan_rx)) {
659-
dma_channel_abort(chan_rx);
660-
}
661-
if (tx && dma_channel_is_busy(chan_tx)) {
662-
dma_channel_abort(chan_tx);
663-
}
664-
break;
665-
}
666657
}
667658
// Clear the stall bit so we can detect when the state machine is done transmitting.
668659
self->pio->fdebug = stall_mask;
@@ -677,7 +668,7 @@ static bool _transfer(rp2pio_statemachine_obj_t *self,
677668
dma_channel_unclaim(chan_tx);
678669
}
679670

680-
if (!use_dma && !mp_hal_is_interrupted()) {
671+
if (!use_dma) {
681672
// Use software for small transfers, or if couldn't claim two DMA channels
682673
size_t rx_remaining = in_len / in_stride_in_bytes;
683674
size_t tx_remaining = out_len / out_stride_in_bytes;
@@ -706,9 +697,6 @@ static bool _transfer(rp2pio_statemachine_obj_t *self,
706697
--rx_remaining;
707698
}
708699
RUN_BACKGROUND_TASKS;
709-
if (mp_hal_is_interrupted()) {
710-
break;
711-
}
712700
}
713701
// Clear the stall bit so we can detect when the state machine is done transmitting.
714702
self->pio->fdebug = stall_mask;
@@ -719,9 +707,6 @@ static bool _transfer(rp2pio_statemachine_obj_t *self,
719707
while (!pio_sm_is_tx_fifo_empty(self->pio, self->state_machine) ||
720708
(self->wait_for_txstall && (self->pio->fdebug & stall_mask) == 0)) {
721709
RUN_BACKGROUND_TASKS;
722-
if (mp_hal_is_interrupted()) {
723-
break;
724-
}
725710
}
726711
}
727712
return true;

0 commit comments

Comments
 (0)
0