From 3020f5caf0b09fcaf85b3b3fa84fdf688ba22cc0 Mon Sep 17 00:00:00 2001 From: Dominik Sliwa Date: Thu, 9 Nov 2017 19:51:32 +0100 Subject: K20: can and spi fixes Signed-off-by: Dominik Sliwa --- drivers/fsl_dspi.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'drivers/fsl_dspi.c') diff --git a/drivers/fsl_dspi.c b/drivers/fsl_dspi.c index e2b90ba..dcd93aa 100644 --- a/drivers/fsl_dspi.c +++ b/drivers/fsl_dspi.c @@ -29,6 +29,7 @@ */ #include "fsl_dspi.h" +#include "com_task.h" /******************************************************************************* * Definitions @@ -1465,10 +1466,18 @@ void DSPI_SlaveTransferHandleIRQ(SPI_Type *base, dspi_slave_handle_t *handle) { if (handle->rxData) { + if ((handle->totalByteCount - handle->remainingReceiveByteCount) == 1){ + if ( *(handle->rxData - 1) == APALIS_TK1_K20_BULK_WRITE_INST) { + handle->remainingReceiveByteCount += dataReceived; + handle->totalByteCount += dataReceived; + handle->remainingSendByteCount += dataReceived; + } + } /* Receive buffer is not null, store data into it */ *handle->rxData = dataReceived; ++handle->rxData; } + /* Descrease remaining receive byte count */ --handle->remainingReceiveByteCount; -- cgit v1.2.3