57 #include "HL_reg_spi.h"
59 #include "HL_sys_common.h"
69 #define SPI_FLAG_REGISTER_TRANSMISSION_ERRORS (0x5Fu)
83 uint16_t spi_cmdDummy[1] = {0x00};
89 spiTransmitData(pSpiInterface->
pNode, ((spiDAT1_t *)pSpiInterface->
pConfig), 1u, spi_cmdDummy);
111 spiTransmitData(pSpiInterface->
pNode, ((spiDAT1_t *)pSpiInterface->
pConfig), frameLength, pTxBuff);
129 uint32_t frameLength) {
146 uint32 frameLength) {
170 uint32 frameLength) {
173 uint32_t spiRetval = spiTransmitAndReceiveData(
174 pSpiInterface->
pNode, ((spiDAT1_t *)pSpiInterface->
pConfig), frameLength, pTxBuff, pRxBuff);
187 uint32_t frameLength) {
209 (frameLength << 16U) | 1U;
216 (frameLength << 16U) | 1U;
218 uint8_t spiFmtRegister = 0U;
219 switch (pSpiInterface->
pConfig->DFSEL) {
255 switch (spiFmtRegister) {
259 pSpiInterface->
pNode->FMT0 = pSpiInterface->
pNode->FMT1;
262 pSpiInterface->
pNode->FMT0 = pSpiInterface->
pNode->FMT2;
265 pSpiInterface->
pNode->FMT0 = pSpiInterface->
pNode->FMT3;
296 uint32_t frameLength) {
298 uint16_t spi_cmdDummy[1] = {0x00};
316 (frameLength << 16U) | 1U;
323 (frameLength << 16U) | 1U;
325 uint8_t spiFmtRegister = 0U;
326 switch (pSpiInterface->
pConfig->DFSEL) {
362 switch (spiFmtRegister) {
366 pSpiInterface->
pNode->FMT0 = pSpiInterface->
pNode->FMT1;
369 pSpiInterface->
pNode->FMT0 = pSpiInterface->
pNode->FMT2;
372 pSpiInterface->
pNode->FMT0 = pSpiInterface->
pNode->FMT3;
385 spiTransmitData(pSpiInterface->
pNode, ((spiDAT1_t *)pSpiInterface->
pConfig), 1u, spi_cmdDummy);
430 extern void SPI_SetFunctional(spiBASE_t *pNode,
enum spiPinSelect bit,
bool hardwareControlled) {
435 spi_config_reg_t configRegisterBuffer = {0};
436 if (pNode == spiREG1) {
437 spi1GetConfigValue(&configRegisterBuffer, CurrentValue);
438 }
else if (pNode == spiREG2) {
439 spi2GetConfigValue(&configRegisterBuffer, CurrentValue);
440 }
else if (pNode == spiREG3) {
441 spi3GetConfigValue(&configRegisterBuffer, CurrentValue);
442 }
else if (pNode == spiREG4) {
443 spi4GetConfigValue(&configRegisterBuffer, CurrentValue);
444 }
else if (pNode == spiREG5) {
445 spi5GetConfigValue(&configRegisterBuffer, CurrentValue);
450 uint32_t newPc0 = configRegisterBuffer.CONFIG_PC0;
452 if (hardwareControlled ==
false) {
454 newPc0 &= ~(uint32_t)((uint32_t)1u << (uint8_t)(bit));
457 newPc0 |= (uint32_t)((uint32_t)1u << (uint8_t)(bit));
461 spiSetFunctional(pNode, newPc0);
Headers for the driver for the DMA module.
DMA_CHANNEL_CONFIG_s dma_spiDmaChannels[DMA_NUMBER_SPI_INTERFACES]
#define FAS_ASSERT(x)
Assertion macro that asserts that x is true.
#define FAS_TRAP
Define that evaluates to essential boolean false thus tripping an assert.
#define NULL_PTR
Null pointer.
enum STD_RETURN_TYPE STD_RETURN_TYPE_e
Function to switch between user mode and privilege mode.
#define FSYS_SwitchToUserMode()
Switch back to user mode.
long FSYS_RaisePrivilege(void)
raise privilege
#define LARGEST_PIN_NUMBER
largest pin number that exists in TMS570LC4357
void IO_PinSet(volatile uint32_t *pRegisterAddress, uint32_t pin)
Set pin by writing in pin output register.
void IO_PinReset(volatile uint32_t *pRegisterAddress, uint32_t pin)
Set pin by writing in pin output register.
Header for the driver for the IO module.
void MCU_delay_us(uint32_t delay_us)
Wait blocking a certain time in microseconds.
Headers for the driver for the MCU module.
void OS_ExitTaskCritical(void)
Exit Critical interface function for use in FreeRTOS-Tasks and FreeRTOS-ISR.
void OS_EnterTaskCritical(void)
Enter Critical interface function for use in FreeRTOS-Tasks and FreeRTOS-ISR.
Implementation of the tasks used by the system, headers.
STD_RETURN_TYPE_e SPI_TransmitReceiveDataDma(SPI_INTERFACE_CONFIG_s *pSpiInterface, uint16_t *pTxBuff, uint16_t *pRxBuff, uint32_t frameLength)
Transmits and receives data on SPI with DMA.
void SPI_SetFunctional(spiBASE_t *pNode, enum spiPinSelect bit, bool hardwareControlled)
Sets the functional of a SPI pin.
STD_RETURN_TYPE_e SPI_DirectlyTransmitReceiveData(SPI_INTERFACE_CONFIG_s *pSpiInterface, uint16 *pTxBuff, uint16 *pRxBuff, uint32 frameLength)
Transmits and receives data on SPI without DMA.
STD_RETURN_TYPE_e SPI_TransmitDummyByte(SPI_INTERFACE_CONFIG_s *pSpiInterface, uint32_t delay)
Sends a dummy byte to wake up the SPI interface.
STD_RETURN_TYPE_e SPI_TransmitData(SPI_INTERFACE_CONFIG_s *pSpiInterface, uint16_t *pTxBuff, uint32_t frameLength)
Sends data on SPI without DMA.
STD_RETURN_TYPE_e SPI_Lock(uint8_t spi)
Locks SPI interfaces.
STD_RETURN_TYPE_e SPI_TransmitReceiveDataWithDummyDma(SPI_INTERFACE_CONFIG_s *pSpiInterface, uint32_t delay, uint16_t *pTxBuff, uint16_t *pRxBuff, uint32_t frameLength)
Transmits and receives data on SPI with DMA.
void SPI_Unlock(uint8_t spi)
Unlocks SPI interfaces.
STD_RETURN_TYPE_e SPI_TransmitReceiveData(SPI_INTERFACE_CONFIG_s *pSpiInterface, uint16 *pTxBuff, uint16 *pRxBuff, uint32 frameLength)
Transmits and receives data on SPI without DMA.
STD_RETURN_TYPE_e SPI_TransmitDataWithDummy(SPI_INTERFACE_CONFIG_s *pSpiInterface, uint32_t delay, uint16_t *pTxBuff, uint32_t frameLength)
Sends data on SPI without DMA, with wake-up byte.
#define SPI_FLAG_REGISTER_TRANSMISSION_ERRORS
Headers for the driver for the SPI module.
SPI_INTERFACE_CONFIG_s spi_dmaTransmission[]
Variable used for SPI over DMA transmission. Retains the CS pin to deactivate in DMA callback.
SPI_BUSY_STATE_e spi_busyFlags[]
const uint8_t spi_nrBusyFlags
const spiDAT1_t * pConfig
volatile uint32_t * pGioPort