diff options
author | edolomb <none@example.com> | 2018-02-21 20:57:29 +0000 |
---|---|---|
committer | edolomb <none@example.com> | 2018-02-21 20:57:29 +0000 |
commit | 86c2338782ceecc6c3c17f2c7ecbb53e4fcfda1c (patch) | |
tree | 72eb4696f8c4f5eb63c24d00050e99cec9a0193a /os | |
parent | b75eda3185ddd11f31bc38f7c7aa493638d376b1 (diff) | |
download | ChibiOS-86c2338782ceecc6c3c17f2c7ecbb53e4fcfda1c.tar.gz ChibiOS-86c2338782ceecc6c3c17f2c7ecbb53e4fcfda1c.tar.bz2 ChibiOS-86c2338782ceecc6c3c17f2c7ecbb53e4fcfda1c.zip |
Fixed bug related to spurious interrupt
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11533 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os')
-rw-r--r-- | os/hal/ports/SAMA/LLD/USARTv1/hal_uart_lld.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/os/hal/ports/SAMA/LLD/USARTv1/hal_uart_lld.c b/os/hal/ports/SAMA/LLD/USARTv1/hal_uart_lld.c index 7589c82fb..abf5f9e9b 100644 --- a/os/hal/ports/SAMA/LLD/USARTv1/hal_uart_lld.c +++ b/os/hal/ports/SAMA/LLD/USARTv1/hal_uart_lld.c @@ -1343,6 +1343,13 @@ void uart_lld_stop(UARTDriver *uartp) { */
void uart_lld_start_send(UARTDriver *uartp, size_t n, const void *txbuf) {
+ /* TX DMA channel preparation.*/
+ dmaChannelSetSource(uartp->dmatx, txbuf);
+ dmaChannelSetTransactionSize(uartp->dmatx, n);
+
+ /* Starting transfer.*/
+ dmaChannelEnable(uartp->dmatx);
+
/* Only enable TC interrupt if there's a callback attached to it.
Also we need to clear TC flag which could be set before. */
if (uartp->config->txend2_cb != NULL) {
@@ -1355,13 +1362,6 @@ void uart_lld_start_send(UARTDriver *uartp, size_t n, const void *txbuf) { uartp->usart->US_IER = US_IER_TXEMPTY;
#endif
}
-
- /* TX DMA channel preparation.*/
- dmaChannelSetSource(uartp->dmatx, txbuf);
- dmaChannelSetTransactionSize(uartp->dmatx, n);
-
- /* Starting transfer.*/
- dmaChannelEnable(uartp->dmatx);
}
/**
@@ -1378,8 +1378,8 @@ void uart_lld_start_send(UARTDriver *uartp, size_t n, const void *txbuf) { size_t uart_lld_stop_send(UARTDriver *uartp) {
dmaChannelDisable(uartp->dmatx);
- /* number of data frames not transmitted is always zero */
- return 0;
+
+ return dmaChannelGetTransactionSize(uartp->dmatx);
}
/**
@@ -1400,7 +1400,7 @@ void uart_lld_start_receive(UARTDriver *uartp, size_t n, void *rxbuf) { /* Enabling BIE interrupt if disabled */
if ((uartp->dmarx->xdmac->XDMAC_CHID[uartp->dmarx->chid].XDMAC_CIM & XDMAC_CIM_BIM) == 0) {
- uartp->dmarx->xdmac->XDMAC_CHID[uartp->dmarx->chid].XDMAC_CIE = XDMAC_CIE_BIE;
+ uartp->dmarx->xdmac->XDMAC_CHID[uartp->dmarx->chid].XDMAC_CIE = XDMAC_CIE_BIE;
}
/* Resetting the XDMAC_CNCDAx */
@@ -1440,7 +1440,7 @@ size_t uart_lld_stop_receive(UARTDriver *uartp) { size_t n;
dmaChannelDisable(uartp->dmarx);
- n = 0;
+ n = dmaChannelGetTransactionSize(uartp->dmarx);
uart_enter_rx_idle_loop(uartp);
return n;
|