Skip to content

Commit d5fca6d

Browse files
committed
K64F DSPI Driver: Fix errors where DSPI state is incorrectly kept busy
Signed-off-by: Mahadevan Mahesh <[email protected]>
1 parent 5eb92ea commit d5fca6d

File tree

1 file changed

+4
-4
lines changed
  • targets/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_MCU_K64F/drivers

1 file changed

+4
-4
lines changed

targets/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_MCU_K64F/drivers/fsl_dspi_edma.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,6 @@ status_t DSPI_MasterTransferEDMA(SPI_Type *base, dspi_master_edma_handle_t *hand
162162

163163
handle->txBuffIfNull = ((uint32_t)DSPI_DUMMY_DATA << 8) | DSPI_DUMMY_DATA;
164164

165-
handle->state = kDSPI_Busy;
166-
167165
dspi_command_data_config_t commandStruct;
168166
DSPI_StopTransfer(base);
169167
DSPI_FlushFifo(base, true, true);
@@ -222,6 +220,8 @@ status_t DSPI_MasterTransferEDMA(SPI_Type *base, dspi_master_edma_handle_t *hand
222220
return kStatus_InvalidArgument;
223221
}
224222

223+
handle->state = kDSPI_Busy;
224+
225225
DSPI_DisableDMA(base, kDSPI_RxDmaEnable | kDSPI_TxDmaEnable);
226226

227227
EDMA_SetCallback(handle->edmaRxRegToRxDataHandle, EDMA_DspiMasterCallback,
@@ -706,13 +706,13 @@ static void EDMA_DspiMasterCallback(edma_handle_t *edmaHandle,
706706

707707
DSPI_DisableDMA((dspiEdmaPrivateHandle->base), kDSPI_RxDmaEnable | kDSPI_TxDmaEnable);
708708

709+
dspiEdmaPrivateHandle->handle->state = kDSPI_Idle;
710+
709711
if (dspiEdmaPrivateHandle->handle->callback)
710712
{
711713
dspiEdmaPrivateHandle->handle->callback(dspiEdmaPrivateHandle->base, dspiEdmaPrivateHandle->handle,
712714
kStatus_Success, dspiEdmaPrivateHandle->handle->userData);
713715
}
714-
715-
dspiEdmaPrivateHandle->handle->state = kDSPI_Idle;
716716
}
717717

718718
void DSPI_MasterTransferAbortEDMA(SPI_Type *base, dspi_master_edma_handle_t *handle)

0 commit comments

Comments
 (0)