diff options
author | Dominik Sliwa <dominik.sliwa@toradex.com> | 2018-09-11 15:37:36 +0200 |
---|---|---|
committer | Dominik Sliwa <dominik.sliwa@toradex.com> | 2018-09-25 14:46:22 +0200 |
commit | 01010e72728a979b0a991576d1101d19829ecec5 (patch) | |
tree | e636978754c914767ca9df791c5164c2f2a9be31 /drivers/fsl_dspi.c | |
parent | 44b9ce104362ecc6b8850afbf97ce8007845c869 (diff) |
Improved CAN, locking and general IRQ performance
Fixes issues with CAN stopping when overwhelmed by data RX\TX.
Keeps can in freezemode until explicitly activated.
CANINTF_TX is now a CAN TX in progress flag.
Runtime asserts are now disabled.
Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Diffstat (limited to 'drivers/fsl_dspi.c')
-rw-r--r-- | drivers/fsl_dspi.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/fsl_dspi.c b/drivers/fsl_dspi.c index 66f8974..1ec01b3 100644 --- a/drivers/fsl_dspi.c +++ b/drivers/fsl_dspi.c @@ -1445,7 +1445,7 @@ void DSPI_SlaveTransferHandleIRQ(SPI_Type *base, dspi_slave_handle_t *handle) assert(handle); volatile uint32_t dataReceived; - uint32_t dataSend = 0; +// uint32_t dataSend = 0; /* Because SPI protocol is synchronous, the number of bytes that that slave received from the * master is the actual number of bytes that the slave transmitted to the master. So we only @@ -1492,25 +1492,26 @@ void DSPI_SlaveTransferHandleIRQ(SPI_Type *base, dspi_slave_handle_t *handle) case APALIS_TK1_K20_IRQREG: registers[APALIS_TK1_K20_IRQREG] = 0; break; - case APALIS_TK1_K20_CANREG: - registers[APALIS_TK1_K20_CANREG] &= ~0x10; - break; - case APALIS_TK1_K20_CANREG + APALIS_TK1_K20_CAN_OFFSET: - registers[APALIS_TK1_K20_CANREG - + APALIS_TK1_K20_CAN_OFFSET] &= ~0x10; - break; + case APALIS_TK1_K20_CANERR: + registers[APALIS_TK1_K20_CANERR] = 0x00; + case APALIS_TK1_K20_CANERR + APALIS_TK1_K20_CAN_OFFSET: + registers[APALIS_TK1_K20_CANERR + + APALIS_TK1_K20_CAN_OFFSET] = 0x00; } } else { - base->PUSHR_SLAVE = 0x55; + if ( *(handle->rxData - 1) == APALIS_TK1_K20_READ_INST) + { + base->PUSHR_SLAVE = 0x55; + } } } } /* Decrease remaining receive byte count */ --handle->remainingReceiveByteCount; - +#ifndef SPI_DMA if (handle->remainingSendByteCount > 0) { if (handle->txData) @@ -1527,6 +1528,7 @@ void DSPI_SlaveTransferHandleIRQ(SPI_Type *base, dspi_slave_handle_t *handle) /* Write the data to the DSPI data register */ base->PUSHR_SLAVE = dataSend; } +#endif #if 0 } else /* If bits/frame is 2 bytes */ @@ -1617,7 +1619,6 @@ void DSPI_SlaveTransferHandleIRQ(SPI_Type *base, dspi_slave_handle_t *handle) if ((handle->remainingReceiveByteCount == 0) || (handle->state == kDSPI_Error)) { /* Other cases, stop the transfer. */ - dataReceived = base->POPR; DSPI_SlaveTransferComplete(base, handle); return; } |