Skip to content

Nuvoton: Remove unnecessary UART INT in UART DMA transfer #6392

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions targets/TARGET_NUVOTON/TARGET_M451/serial_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,10 @@ int serial_tx_asynch(serial_t *obj, const void *tx, size_t tx_length, uint8_t tx
// Register DMA event handler
dma_set_handler(obj->serial.dma_chn_id_tx, (uint32_t) uart_dma_handler_tx, (uint32_t) obj, DMA_EVENT_ALL);
serial_tx_enable_interrupt(obj, handler, 1);
/* We needn't actually enable UART INT to go UART ISR -> handler.
* Instead, as PDMA INT is triggered, we will go PDMA ISR -> UART ISR -> handler
* with serial_tx/rx_enable_interrupt having set up this call path. */
UART_DISABLE_INT(((UART_T *) NU_MODBASE(obj->serial.uart)), UART_INTEN_THREIEN_Msk);
((UART_T *) NU_MODBASE(obj->serial.uart))->INTEN |= UART_INTEN_TXPDMAEN_Msk; // Start DMA transfer
}

Expand Down Expand Up @@ -566,6 +570,10 @@ void serial_rx_asynch(serial_t *obj, void *rx, size_t rx_length, uint8_t rx_widt
// Register DMA event handler
dma_set_handler(obj->serial.dma_chn_id_rx, (uint32_t) uart_dma_handler_rx, (uint32_t) obj, DMA_EVENT_ALL);
serial_rx_enable_interrupt(obj, handler, 1);
/* We needn't actually enable UART INT to go UART ISR -> handler.
* Instead, as PDMA INT is triggered, we will go PDMA ISR -> UART ISR -> handler
* with serial_tx/rx_enable_interrupt having set up this call path. */
UART_DISABLE_INT(((UART_T *) NU_MODBASE(obj->serial.uart)), (UART_INTEN_RDAIEN_Msk | UART_INTEN_RXTOIEN_Msk));
((UART_T *) NU_MODBASE(obj->serial.uart))->INTEN |= UART_INTEN_RXPDMAEN_Msk; // Start DMA transfer
}
}
Expand Down
8 changes: 8 additions & 0 deletions targets/TARGET_NUVOTON/TARGET_M480/serial_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,10 @@ int serial_tx_asynch(serial_t *obj, const void *tx, size_t tx_length, uint8_t tx
// Register DMA event handler
dma_set_handler(obj->serial.dma_chn_id_tx, (uint32_t) uart_dma_handler_tx, (uint32_t) obj, DMA_EVENT_ALL);
serial_tx_enable_interrupt(obj, handler, 1);
/* We needn't actually enable UART INT to go UART ISR -> handler.
* Instead, as PDMA INT is triggered, we will go PDMA ISR -> UART ISR -> handler
* with serial_tx/rx_enable_interrupt having set up this call path. */
UART_DISABLE_INT(((UART_T *) NU_MODBASE(obj->serial.uart)), UART_INTEN_THREIEN_Msk);
((UART_T *) NU_MODBASE(obj->serial.uart))->INTEN |= UART_INTEN_TXPDMAEN_Msk; // Start DMA transfer
}

Expand Down Expand Up @@ -622,6 +626,10 @@ void serial_rx_asynch(serial_t *obj, void *rx, size_t rx_length, uint8_t rx_widt
// Register DMA event handler
dma_set_handler(obj->serial.dma_chn_id_rx, (uint32_t) uart_dma_handler_rx, (uint32_t) obj, DMA_EVENT_ALL);
serial_rx_enable_interrupt(obj, handler, 1);
/* We needn't actually enable UART INT to go UART ISR -> handler.
* Instead, as PDMA INT is triggered, we will go PDMA ISR -> UART ISR -> handler
* with serial_tx/rx_enable_interrupt having set up this call path. */
UART_DISABLE_INT(((UART_T *) NU_MODBASE(obj->serial.uart)), (UART_INTEN_RDAIEN_Msk | UART_INTEN_RXTOIEN_Msk));
((UART_T *) NU_MODBASE(obj->serial.uart))->INTEN |= UART_INTEN_RXPDMAEN_Msk; // Start DMA transfer
}
}
Expand Down
8 changes: 8 additions & 0 deletions targets/TARGET_NUVOTON/TARGET_NANO100/serial_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,10 @@ int serial_tx_asynch(serial_t *obj, const void *tx, size_t tx_length, uint8_t tx
// Register DMA event handler
dma_set_handler(obj->serial.dma_chn_id_tx, (uint32_t) uart_dma_handler_tx, (uint32_t) obj, DMA_EVENT_ALL);
serial_tx_enable_interrupt(obj, handler, 1);
/* We needn't actually enable UART INT to go UART ISR -> handler.
* Instead, as PDMA INT is triggered, we will go PDMA ISR -> UART ISR -> handler
* with serial_tx/rx_enable_interrupt having set up this call path. */
UART_DISABLE_INT(((UART_T *) NU_MODBASE(obj->serial.uart)), UART_IER_THRE_IE_Msk);
PDMA_Trigger(obj->serial.dma_chn_id_tx);
((UART_T *) NU_MODBASE(obj->serial.uart))->CTL |= UART_CTL_DMA_TX_EN_Msk; // Start DMA transfer
}
Expand Down Expand Up @@ -514,6 +518,10 @@ void serial_rx_asynch(serial_t *obj, void *rx, size_t rx_length, uint8_t rx_widt
// Register DMA event handler
dma_set_handler(obj->serial.dma_chn_id_rx, (uint32_t) uart_dma_handler_rx, (uint32_t) obj, DMA_EVENT_ALL);
serial_rx_enable_interrupt(obj, handler, 1);
/* We needn't actually enable UART INT to go UART ISR -> handler.
* Instead, as PDMA INT is triggered, we will go PDMA ISR -> UART ISR -> handler
* with serial_tx/rx_enable_interrupt having set up this call path. */
UART_DISABLE_INT(((UART_T *) NU_MODBASE(obj->serial.uart)), (UART_IER_RDA_IE_Msk | UART_IER_RTO_IE_Msk));
PDMA_Trigger(obj->serial.dma_chn_id_rx);
((UART_T *) NU_MODBASE(obj->serial.uart))->CTL |= UART_CTL_DMA_RX_EN_Msk; // Start DMA transfer
}
Expand Down
8 changes: 8 additions & 0 deletions targets/TARGET_NUVOTON/TARGET_NUC472/serial_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,10 @@ int serial_tx_asynch(serial_t *obj, const void *tx, size_t tx_length, uint8_t tx
// Register DMA event handler
dma_set_handler(obj->serial.dma_chn_id_tx, (uint32_t) uart_dma_handler_tx, (uint32_t) obj, DMA_EVENT_ALL);
serial_tx_enable_interrupt(obj, handler, 1);
/* We needn't actually enable UART INT to go UART ISR -> handler.
* Instead, as PDMA INT is triggered, we will go PDMA ISR -> UART ISR -> handler
* with serial_tx/rx_enable_interrupt having set up this call path. */
UART_DISABLE_INT(((UART_T *) NU_MODBASE(obj->serial.uart)), UART_INTEN_THREIEN_Msk);
((UART_T *) NU_MODBASE(obj->serial.uart))->INTEN |= UART_INTEN_TXPDMAEN_Msk; // Start DMA transfer
}

Expand Down Expand Up @@ -604,6 +608,10 @@ void serial_rx_asynch(serial_t *obj, void *rx, size_t rx_length, uint8_t rx_widt
// Register DMA event handler
dma_set_handler(obj->serial.dma_chn_id_rx, (uint32_t) uart_dma_handler_rx, (uint32_t) obj, DMA_EVENT_ALL);
serial_rx_enable_interrupt(obj, handler, 1);
/* We needn't actually enable UART INT to go UART ISR -> handler.
* Instead, as PDMA INT is triggered, we will go PDMA ISR -> UART ISR -> handler
* with serial_tx/rx_enable_interrupt having set up this call path. */
UART_DISABLE_INT(((UART_T *) NU_MODBASE(obj->serial.uart)), (UART_INTEN_RDAIEN_Msk | UART_INTEN_RXTOIEN_Msk));
((UART_T *) NU_MODBASE(obj->serial.uart))->INTEN |= UART_INTEN_RXPDMAEN_Msk; // Start DMA transfer
}
}
Expand Down