103 const LPSPI_Type *base = g_lpspiBase[instance];
127 uint32_t wordToSend = 0;
134 while(availableSpace != 0U)
163 for (j = 0; j < numOfBytes; j++)
165 wordToSend = ((wordToSend)<<8) + (lpspiState->
txBuff[index]);
176 for (j = 0; j < numOfBytes; j++)
178 wordToSend = wordToSend + ((uint32_t)*(lpspiState->
txBuff) << (8U * j));
185 lpspiState->
txCount = (uint16_t)(lpspiState->
txCount - numOfBytes);
191 availableSpace = (uint8_t)(availableSpace - 1U);
203 const LPSPI_Type *base = g_lpspiBase[instance];
204 uint32_t receivedWord;
209 while (filledSpace!= 0U)
225 for (j = numOfBytes; j > 0U; j--)
227 lpspiState->
rxBuff[index] = (uint8_t)(receivedWord >> ((j - 1U) * 8U));
238 for (j = 0; j < numOfBytes; j++)
240 *(lpspiState->
rxBuff) = (uint8_t)(receivedWord >> (j * 8U));
247 lpspiState->
rxCount = (uint16_t)(lpspiState->
rxCount - numOfBytes);
253 filledSpace = (uint8_t)(filledSpace - 1U);
volatile uint16_t rxFrameCnt
static uint32_t LPSPI_HAL_ReadRxCount(const LPSPI_Type *base)
Reads RX COUNT form the FIFO Status Register.
#define LPSPI_INSTANCE_COUNT
volatile uint16_t txFrameCnt
Runtime state structure for the LPSPI master driver.
void LPSPI_DRV_ReadRXBuffer(uint32_t instance)
Read all data from RX FIFO This function will read all data from RX FIFO and will transfer this infro...
static void LPSPI_HAL_ClearContCBit(LPSPI_Type *base)
Clear CONTC bit form TCR Register.
lpspi_state_t * g_lpspiStatePtr[LPSPI_INSTANCE_COUNT]
IRQn_Type
Defines the Interrupt Numbers definitions.
static uint32_t LPSPI_HAL_ReadData(const LPSPI_Type *base)
Reads data from the data buffer.
void LPSPI_DRV_FillupTxBuffer(uint32_t instance)
Fill up the TX FIFO with data. This function fills up the TX FIFO with data based on the bytes/frame...
static bool LPSPI_HAL_IsMaster(const LPSPI_Type *base)
Returns whether the LPSPI module is in master mode.
volatile uint16_t rxCount
void LPSPI_DRV_MasterIRQHandler(uint32_t instance)
Interrupt handler for LPSPI master mode. This handler uses the buffers stored in the lpspi_master_sta...
volatile uint16_t txCount
static uint32_t LPSPI_HAL_ReadTxCount(const LPSPI_Type *base)
Reads TX COUNT form the FIFO Status Register.
void LPSPI_DRV_IRQHandler(uint32_t instance)
The function LPSPI_DRV_IRQHandler passes IRQ control to either the master or slave driver...
IRQn_Type g_lpspiIrqId[LPSPI_INSTANCE_COUNT]
Table to save LPSPI IRQ enumeration numbers defined in the CMSIS header file.
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...
static void LPSPI_HAL_SetIntMode(LPSPI_Type *base, lpspi_status_flag_t interruptSrc, bool enable)
Configures the LPSPI interrupts.
status_t LPSPI_HAL_ClearStatusFlag(LPSPI_Type *base, lpspi_status_flag_t statusFlag)
Clears the LPSPI status flag.
LPSPI_Type * g_lpspiBase[LPSPI_INSTANCE_COUNT]
Table of base pointers for SPI instances.
void LPSPI_DRV_SlaveIRQHandler(uint32_t instance)
Interrupt handler for LPSPI slave mode. This handler uses the buffers stored in the lpspi_master_stat...
static void LPSPI_HAL_WriteData(LPSPI_Type *base, uint32_t data)
Writes data into the TX data buffer.