84 denominator = baudrate;
86 bdr = numerator / n / denominator - 1;
88 SPIx->PREDR = ( uint16_t )( bdr & 0xffff );
110 if( SPIx == ( SPIn_Type* )SPI0 )
119 if( SPIx == ( SPIn_Type* )SPI1 )
133 | ( SPIn_Config->
Order << SPIn_CR_FLSBn_Pos )
134 | ( SPIn_Config->
ACK << SPIn_CR_CPOLn_Pos )
135 | ( SPIn_Config->
Edge << SPIn_CR_CPHAn_Pos )
140 | SPIn_SR_SPInIFLAG_Msk
141 | SPIn_SR_SSnHIGH_Msk
170 if( SPIx == ( SPIn_Type* )SPI0 )
179 if( SPIx == ( SPIn_Type* )SPI1 )
203 if( SPIn_Config == NULL )
211 #if 1 // CPOLn : 0, CPHAn : 0 (X) 216 #if 0 // CPOLn : 0, CPHAn : 1 (O) 221 #if 0 // CPOLn : 1, CPHAn : 0 (X) 226 #if 0 // CPOLn : 1, CPHAn : 1 (O) 259 switch( SPIn_IntCfg )
262 mask = SPIn_CR_SPInIEN_Msk;
314 mask = SPIn_CR_SPInMS_Msk;
334 mask = SPIn_SR_FXCHn_Msk;
337 mask = SPIn_SR_SSnEN_Msk;
374 SPIx->CR |= ( 1 << SPIn_CR_SPInEN_Pos );
378 SPIx->CR &= ~( 1 << SPIn_CR_SPInEN_Pos );
404 reg &= ~SPIn_SR_SSnHIGH_Msk;
409 reg |= SPIn_SR_SPInIFLAG_Msk;
486 uint32_t bToSend, bSent, timeOut;
487 uint8_t* pChar = txbuf;
502 timeOut = SPIn_BLOCKING_TIMEOUT;
503 while( !( SPIx->SR & SPIn_SR_SPInIFLAG_Msk ) )
536 if( SPIx->SR & SPIn_SR_SPInIFLAG_Msk )
573 uint32_t bToRecv, bRecv, timeOut;
574 uint8_t* pChar = rxbuf;
586 timeOut = SPIn_BLOCKING_TIMEOUT;
620 if( !( SPIx->SR & SPIn_SR_SPInIFLAG_Msk ) )
HAL_Status_Type SPIn_Enable(SPIn_Type *SPIx, FunctionalState state)
SPIn enable control.
uint32_t SPIn_Send(SPIn_Type *SPIx, uint8_t *txbuf, uint32_t buflen, TRANSFER_BLOCK_Type flag)
Send a block of data via SPIn peripheral.
void HAL_SCU_Peripheral_EnableClock2(uint32_t u32PeriClk2, uint32_t u32Ind)
Set Each Peripheral Clock.
HAL_Status_Type HAL_SPIn_Init(SPIn_Type *SPIx, SPIn_CFG_Type *SPIn_Config)
Initialize the SPIn peripheral with the specified parameters.
HAL_Status_Type SPIn_DeInit(SPIn_Type *SPIx)
Deinitialize the SPIn peripheral registers to their default reset values.
static void spi_set_divisors(SPIn_Type *SPIx, uint32_t baudrate)
Determines best dividers to get a target clock rate.
uint8_t SPIn_ReceiveByte(SPIn_Type *SPIx)
Receive a single data from SPIn peripheral.
HAL_Status_Type SPIn_DataControlConfig(SPIn_Type *SPIx, SPIn_CONTROL_Type Control, FunctionalState NewState)
Configure Data Control mode for SPIn peripheral.
uint32_t SPIn_Receive(SPIn_Type *SPIx, uint8_t *rxbuf, uint32_t buflen, TRANSFER_BLOCK_Type flag)
Receive a block of data via SPIn peripheral.
HAL_Status_Type SPIn_ClearStatus(SPIn_Type *SPIx, SPIn_STATUS_Type Status)
This function clears the flag bit of Status Register.
HAL_Status_Type SPIn_ConfigStructInit(SPIn_CFG_Type *SPIn_Config)
Fills each SPIn_CFG_Type structure member with its default value:
HAL_Status_Type SPIn_SendByte(SPIn_Type *SPIx, uint8_t Data)
Transmit a single data through SPIn peripheral.
Contains all macro definitions and function prototypes support for spin firmware library on A31L12x.
void HAL_SCU_Peripheral_SetReset2(uint32_t u32EachPeri2)
Set/Reset Each Peripheral Block Reset of PPRST2 Register.
SPIn_SPI_ORDER_Type Order
Contains all macro definitions and function prototypes support for scu firmware library on A31L12x.
HAL_Status_Type SPIn_ConfigInterrupt(SPIn_Type *SPIx, SPIn_INT_Type SPIn_IntCfg, FunctionalState NewState)
Configure the interrupt source of selected SPIn peripheral.
uint8_t SPIn_GetStatus(SPIn_Type *SPIx)
This function returns the current value of Status Register.