201 const uint8_t *sendBuffer,
202 uint8_t *receiveBuffer,
203 uint16_t transferByteCount,
239 const uint8_t *sendBuffer,
240 uint8_t *receiveBuffer,
241 uint16_t transferByteCount)
244 DEV_ASSERT(!((sendBuffer == NULL) && (receiveBuffer == NULL)));
252 if ((uint16_t)(transferByteCount % state->
bytesPerFrame) != (uint16_t)0)
270 state->
rxBuff = receiveBuffer;
271 state->
txBuff = sendBuffer;
272 state->
txCount = transferByteCount;
273 state->
rxCount = transferByteCount;
317 if(receiveBuffer != NULL)
320 (uint32_t)(&(base->
RDR)),(uint32_t)receiveBuffer, dmaTransferSize, (uint32_t)1U<<(uint8_t)(dmaTransferSize));
324 state->
rxCount = transferByteCount;
332 if(sendBuffer != NULL)
335 (uint32_t)sendBuffer, (uint32_t)(&(base->
TDR)), dmaTransferSize, (uint32_t)1U<<(uint8_t)(dmaTransferSize));
339 state->
txCount = transferByteCount;
351 if(receiveBuffer != NULL)
361 if (receiveBuffer != NULL)
365 if (sendBuffer != NULL)
377 uint16_t txCount, rxCount;
407 if (txCount == (uint8_t)0)
412 if (rxCount == (uint8_t)0)
416 if ((rxCount == (uint8_t)0) && (txCount == (uint8_t)0))
471 if (bytesRemained != NULL)
473 *bytesRemained = lpspiState->
txCount;
491 uint32_t instance = (uint32_t)parameter;
volatile uint16_t rxFrameCnt
#define LPSPI_INSTANCE_COUNT
volatile uint16_t txFrameCnt
Runtime state structure for the LPSPI master driver.
static void LPSPI_HAL_SetTxWatermarks(LPSPI_Type *base, uint32_t txWater)
Sets the TX FIFO watermark values.
void LPSPI_DRV_ReadRXBuffer(uint32_t instance)
The function LPSPI_DRV_ReadRXBuffer reads data from RX hardware buffer and writes this data in RX sof...
void LPSPI_HAL_GetFifoSizes(const LPSPI_Type *base, uint8_t *txFifoSize, uint8_t *rxFifoSize)
Gets the TX and RX FIFO sizes of the LPSPI module.
status_t OSIF_SemaDestroy(const semaphore_t *const pSem)
Destroys a previously created semaphore.
Chip specific module features.
lpspi_transfer_type transferType
#define LPSPI_DMA_INSTANCE
lpspi_signal_polarity_t pcsPolarity
lpspi_state_t * g_lpspiStatePtr[LPSPI_INSTANCE_COUNT]
void LPSPI_HAL_SetFlushFifoCmd(LPSPI_Type *base, bool flushTxFifo, bool flushRxFifo)
Flushes the LPSPI FIFOs.
void EDMA_HAL_TCDSetMajorCount(DMA_Type *base, uint32_t channel, uint32_t count)
Sets the major iteration count according to minor loop channel link setting.
lpspi_which_pcs_t whichPcs
status_t OSIF_SemaCreate(semaphore_t *const pSem, const uint8_t initValue)
Creates a semaphore with a given value.
status_t LPSPI_HAL_SetPinConfigMode(LPSPI_Type *base, lpspi_pin_config_t pinCfg, lpspi_data_out_config_t dataOutConfig, bool pcs3and2Enable)
Configures the LPSPI SDO/SDI pin configuration mode.
static void LPSPI_HAL_SetTxDmaCmd(LPSPI_Type *base, bool enable)
Sets the LPSPI Transmit Data DMA configuration (enable or disable).
void LPSPI_DRV_FillupTxBuffer(uint32_t instance)
The function LPSPI_DRV_FillupTxBuffer writes data in TX hardware buffer depending on driver state and...
status_t LPSPI_DRV_SlaveTransfer(uint32_t instance, const uint8_t *sendBuffer, uint8_t *receiveBuffer, uint16_t transferByteCount)
Starts the transfer data on LPSPI bus using an interrupt and a non-blocking call. ...
void INT_SYS_DisableIRQ(IRQn_Type irqNumber)
Disables an interrupt for a given IRQ number.
lpspi_clock_phase_t clkPhase
volatile uint16_t rxCount
edma_chn_status_t
Channel status for eDMA channel.
status_t LPSPI_DRV_SlaveTransferBlocking(uint32_t instance, const uint8_t *sendBuffer, uint8_t *receiveBuffer, uint16_t transferByteCount, uint32_t timeout)
Transfers data on LPSPI bus using interrupt and a blocking call.
status_t LPSPI_HAL_SetPcsPolarityMode(LPSPI_Type *base, lpspi_which_pcs_t whichPcs, lpspi_signal_polarity_t pcsPolarity)
Configures the desired LPSPI PCS polarity.
volatile uint16_t txCount
lpspi_sck_polarity_t clkPolarity
status_t
Status return codes. Common error codes will be a unified enumeration (C enum) that will contain all ...
IRQn_Type g_lpspiIrqId[LPSPI_INSTANCE_COUNT]
Table to save LPSPI IRQ enumeration numbers defined in the CMSIS header file.
status_t LPSPI_DRV_SlaveInit(uint32_t instance, lpspi_state_t *lpspiState, const lpspi_slave_config_t *slaveConfig)
Initializes a LPSPI instance for a slave mode operation, using interrupt mechanism.
static void LPSPI_HAL_Enable(LPSPI_Type *base)
Enables the LPSPI module.
User configuration structure for the SPI slave driver. Implements : lpspi_slave_config_t_Class.
void LPSPI_DRV_DisableTEIEInterrupts(uint32_t instance)
Disable the TEIE interrupts at the end of a transfer. Disable the interrupts and clear the status for...
edma_transfer_size_t
eDMA transfer configuration Implements : edma_transfer_size_t_Class
static void LPSPI_DRV_SlaveCompleteDMATransfer(void *parameter, edma_chn_status_t status)
Finish up a transfer DMA. The main purpose of this function is to create a function compatible with D...
static void LPSPI_HAL_SetRxDmaCmd(LPSPI_Type *base, bool enable)
Sets the LPSPI Receive Data DMA configuration (enable or disable).
static void LPSPI_HAL_SetIntMode(LPSPI_Type *base, lpspi_status_flag_t interruptSrc, bool enable)
Configures the LPSPI interrupts.
static void EDMA_HAL_TCDSetDisableDmaRequestAfterTCDDoneCmd(DMA_Type *base, uint32_t channel, bool disable)
Disables/Enables the DMA request after the major loop completes for the TCD.
status_t OSIF_SemaWait(semaphore_t *const pSem, const uint32_t timeout)
Decrement a semaphore with timeout.
void LPSPI_HAL_Init(LPSPI_Type *base)
Resets the LPSPI internal logic and registers to their default settings.
status_t EDMA_DRV_StartChannel(uint8_t channel)
Starts an eDMA channel.
status_t LPSPI_HAL_ClearStatusFlag(LPSPI_Type *base, lpspi_status_flag_t statusFlag)
Clears the LPSPI status flag.
static void LPSPI_HAL_SetRxWatermarks(LPSPI_Type *base, uint32_t rxWater)
Sets the RX FIFO watermark values.
volatile bool isTransferInProgress
status_t LPSPI_DRV_SlaveAbortTransfer(uint32_t instance)
Aborts the transfer that started by a non-blocking call transfer function.
LPSPI Transmit Command Register configuration structure.
status_t OSIF_SemaPost(semaphore_t *const pSem)
Increment a semaphore.
DMA_Type *const g_edmaBase[DMA_INSTANCE_COUNT]
Array for the eDMA module register base address.
lpspi_transfer_type transferType
status_t LPSPI_DRV_SlaveGetTransferStatus(uint32_t instance, uint32_t *bytesRemained)
Returns whether the previous transfer is finished.
void INT_SYS_EnableIRQ(IRQn_Type irqNumber)
Enables an interrupt for a given IRQ number.
status_t LPSPI_DRV_SlaveDeinit(uint32_t instance)
Shuts down an LPSPI instance interrupt mechanism.
LPSPI_Type * g_lpspiBase[LPSPI_INSTANCE_COUNT]
Table of base pointers for SPI instances.
status_t EDMA_DRV_ConfigSingleBlockTransfer(uint8_t channel, edma_transfer_type_t type, uint32_t srcAddr, uint32_t destAddr, edma_transfer_size_t transferSize, uint32_t dataBufferSize)
Configures a simple single block data transfer with DMA.
void LPSPI_HAL_SetTxCommandReg(LPSPI_Type *base, const lpspi_tx_cmd_config_t *txCmdCfgSet)
Sets the Transmit Command Register (TCR) parameters.
void LPSPI_DRV_SlaveIRQHandler(uint32_t instance)
Interrupt handler for LPSPI slave mode. This handler uses the buffers stored in the lpspi_master_stat...
status_t LPSPI_HAL_SetMasterSlaveMode(LPSPI_Type *base, lpspi_master_slave_mode_t mode)
Configures the LPSPI for master or slave.
status_t EDMA_DRV_InstallCallback(uint8_t channel, edma_callback_t callback, void *parameter)
Registers the callback function and the parameter for eDMA channel.
semaphore_t lpspiSemaphore
static bool LPSPI_HAL_GetStatusFlag(const LPSPI_Type *base, lpspi_status_flag_t statusFlag)
Gets the LPSPI status flag state.