MCUSW
Loading...
Searching...
No Matches

Introduction

This files defines SPI MCAL configuration structures

Data Structures

struct  Spi_ChannelConfigType
 SPI Channel configuration structure. More...
 
struct  Spi_McspiExternalDeviceConfigType
 SPI Job configuration structure specific to McSPI peripheral. More...
 
struct  Spi_ExternalDeviceConfigType
 SPI external device specific configuration structure . More...
 
struct  Spi_JobConfigType
 SPI Job configuration structure. More...
 
struct  Spi_SeqConfigType
 SPI Sequence configuration structure. More...
 
struct  Spi_HwUnitConfigType
 SPI Hardware unit configuration structure. More...
 
struct  Spi_ConfigType
 SPI config structure. More...
 
struct  Spi_ChannelConfigType_PC
 SPI channel config structure parameters Pre-Compile only. More...
 
struct  Spi_JobConfigType_PC
 SPI job config structure parameters Pre-Compile only. More...
 
struct  Spi_SeqConfigType_PC
 SPI sequence config structure parameters Pre-Compile only. More...
 
struct  Spi_RegisterReadbackType
 SPI register readback structure. More...
 

Variables

uint8 Spi_ChannelConfigType::channelBufType
 
uint8 Spi_ChannelConfigType::dataWidth
 
uint32 Spi_ChannelConfigType::defaultTxData
 
Spi_NumberOfDataType Spi_ChannelConfigType::maxBufLength
 
Spi_TransferType Spi_ChannelConfigType::transferType
 
uint16 Spi_McspiExternalDeviceConfigType::csEnable
 
Spi_CsModeType Spi_McspiExternalDeviceConfigType::csMode
 
Spi_LevelType Spi_McspiExternalDeviceConfigType::csPolarity
 
Spi_DataDelayType Spi_McspiExternalDeviceConfigType::csIdleTime
 
uint32 Spi_McspiExternalDeviceConfigType::clkDivider
 
Spi_ClkMode Spi_McspiExternalDeviceConfigType::clkMode
 
Spi_TxRxMode Spi_McspiExternalDeviceConfigType::txRxMode
 
uint16 Spi_McspiExternalDeviceConfigType::startBitEnable
 
Spi_LevelType Spi_McspiExternalDeviceConfigType::startBitLevel
 
Spi_DataLineReceiveType Spi_McspiExternalDeviceConfigType::receptionLineEnable
 
Spi_DataLineTransmitType Spi_McspiExternalDeviceConfigType::transmissionLineEnable
 
Spi_McspiExternalDeviceConfigType Spi_ExternalDeviceConfigType::mcspi
 
Spi_JobPriorityType Spi_JobConfigType::jobPriority
 
Spi_HWUnitType Spi_JobConfigType::hwUnitId
 
Spi_JobEndNotifyType Spi_JobConfigType::Spi_JobEndNotification
 
uint32 Spi_JobConfigType::channelPerJob
 
Spi_ChannelType Spi_JobConfigType::channelList [SPI_MAX_CHANNELS_PER_JOB]
 
uint8 Spi_SeqConfigType::seqInterruptible
 
Spi_SeqEndNotifyType Spi_SeqConfigType::Spi_SequenceEndNotification
 
uint32 Spi_SeqConfigType::jobPerSeq
 
Spi_JobType Spi_SeqConfigType::jobList [SPI_MAX_JOBS_PER_SEQ]
 
Spi_HWUnitType Spi_HwUnitConfigType::hwUnitId
 
boolean Spi_HwUnitConfigType::enabledmaMode
 
uint32 Spi_HwUnitConfigType::dmaTxChIntrNum
 
uint32 Spi_HwUnitConfigType::dmaRxChIntrNum
 
uint8 Spi_ConfigType::maxChannels
 
uint8 Spi_ConfigType::maxJobs
 
uint8 Spi_ConfigType::maxSeq
 
uint8 Spi_ConfigType::maxHwUnit
 
uint8 Spi_ConfigType::maxExtDevCfg
 
uint32 Spi_ConfigType::udmaInstId
 
Spi_CacheWbInv Spi_ConfigType::cacheWbInv
 
Spi_CacheWb Spi_ConfigType::cacheWb
 
Spi_CacheInv Spi_ConfigType::cacheInv
 
Spi_ChannelConfigType Spi_ConfigType::channelCfg [SPI_MAX_CHANNELS]
 
Spi_JobConfigType Spi_ConfigType::jobCfg [SPI_MAX_JOBS]
 
Spi_SeqConfigType Spi_ConfigType::seqCfg [SPI_MAX_SEQ]
 
Spi_HwUnitConfigType Spi_ConfigType::hwUnitCfg [SPI_MAX_HW_UNIT]
 
Spi_ExternalDeviceConfigType Spi_ConfigType::extDevCfg [SPI_MAX_EXT_DEV]
 
Spi_ChannelType Spi_ChannelConfigType_PC::channelId
 
Spi_JobType Spi_JobConfigType_PC::jobId
 
Spi_CsPinType Spi_JobConfigType_PC::csPin
 
uint8 Spi_JobConfigType_PC::externalDeviceCfgId
 
Spi_SequenceType Spi_SeqConfigType_PC::seqId
 
uint32 Spi_RegisterReadbackType::mcspiHlRev
 
uint32 Spi_RegisterReadbackType::mcspiHlHwInfo
 
uint32 Spi_RegisterReadbackType::mcspiHlSysConfig
 
uint32 Spi_RegisterReadbackType::mcspiRev
 
uint32 Spi_RegisterReadbackType::mcspiSysStatus
 
uint32 Spi_RegisterReadbackType::mcspiSyst
 
uint32 Spi_RegisterReadbackType::mcspiModulctrl
 
uint32 Spi_RegisterReadbackType::mcspiSysConfig
 
uint32 Spi_RegisterReadbackType::mcspiCh0config
 
uint32 Spi_RegisterReadbackType::mcspiCh1config
 
uint32 Spi_RegisterReadbackType::mcspiCh2config
 
uint32 Spi_RegisterReadbackType::mcspiCh3config
 
uint32 Spi_RegisterReadbackType::mcspiIrqenable
 

Macros

#define SPI_VARIANT_POST_BUILD   (STD_ON)
 SPI Build Variant. Build variants.(i.e Pre Compile,Post Build or Link time)
 

SPI Config Ids

The Config Ids used for different SPI Configuration builds

enum  Spi_StatusType { SPI_UNINIT = 0U , SPI_IDLE = 1U , SPI_BUSY = 2U }
 This type defines a range of specific status for SPI Handler/Driver. More...
 
enum  Spi_JobResultType { SPI_JOB_OK = 0U , SPI_JOB_PENDING = 1U , SPI_JOB_FAILED = 2U , SPI_JOB_QUEUED = 3U }
 This type defines a range of specific Jobs status for SPI Handler/Driver. More...
 
enum  Spi_SeqResultType { SPI_SEQ_OK = 0U , SPI_SEQ_PENDING = 1U , SPI_SEQ_FAILED = 2U , SPI_SEQ_CANCELLED = 3U }
 This type defines a range of specific Sequences status for SPI Handler/Driver. More...
 
enum  Spi_HwUnitResultType { SPI_HW_UNIT_OK = 0U , SPI_HW_UNIT_PENDING = 1U , SPI_HW_UNIT_FAILED = 2U }
 This type defines a range of specific HW unit status for SPI Handler/Driver. More...
 
enum  Spi_AsyncModeType { SPI_POLLING_MODE = 0U , SPI_INTERRUPT_MODE = 1U }
 Specifies the asynchronous mechanism mode for SPI busses handled asynchronously in LEVEL 2. More...
 
enum  Spi_TransferType { SPI_MSB = 0U , SPI_LSB = 1U }
 Word transfer order - MSB first or LSB first. More...
 
enum  Spi_LevelType { SPI_LOW = STD_LOW , SPI_HIGH }
 Type for SPI Chip Select Polarity and Clock Idle Level. More...
 
enum  Spi_CsPinType { SPI_CS0 = 0U , SPI_CS1 , SPI_CS2 , SPI_CS3 }
 SPI Chip Select Pin. More...
 
enum  Spi_ClkMode { SPI_CLK_MODE_0 = 0x00U , SPI_CLK_MODE_1 = 0x01U , SPI_CLK_MODE_2 = 0x02U , SPI_CLK_MODE_3 = 0x03U }
 SPI Clock Mode - sets the clock polarity and phase. Note: These values are a direct register mapping. So don't change value. More...
 
enum  Spi_TxRxMode { SPI_TX_RX_MODE_BOTH = 0x00U , SPI_TX_RX_MODE_TX_ONLY = 0x02U }
 SPI TX/RX Mode. More...
 
enum  Spi_JobPriorityType { SPI_JOB_PRIORITY_0 = 0U , SPI_JOB_PRIORITY_1 , SPI_JOB_PRIORITY_2 , SPI_JOB_PRIORITY_3 }
 SPI Job Priority. More...
 
enum  Spi_CsModeType { SPI_SINGLE = 0U , SPI_CONTINUOUS = 1U }
 SPI Chip Select Mode. More...
 
enum  Spi_DataDelayType { SPI_DATADELAY_0 = 0U , SPI_DATADELAY_1 = 1U , SPI_DATADELAY_2 = 2U , SPI_DATADELAY_3 = 3U }
 Spi_DataDelayType defines the number of interface clock cycles between CS toggling and first or last edge of MCSPI clock. More...
 
enum  Spi_DataLineReceiveType { DATA_LINE_0_RECEPTION = 0U , DATA_LINE_1_RECEPTION = 1U }
 Spi_DataLineReceiveType defines the lines selected for reception. More...
 
enum  Spi_DataLineTransmitType { DATA_LINE_NO_TRANSMISSION = 0x3U , DATA_LINE_0_TRANSMISSION = 0x2U , DATA_LINE_1_TRANSMISSION = 0x1U , DATA_LINE_BOTH_TRANSMISSION = 0x0U }
 Spi_DataLineTransmitType defines the lines selected for transmission. More...
 
enum  Mcspi_IrqStatusType { SPI_NO_EVENT = 0U , SPI_EVENT_PENDING = 1U , SPI_STATUS_READ_FAIL = 2U }
 Irq status and std return type. More...
 
typedef void(* Spi_CacheWbInv) (uint8 *BufPtr, uint16 LenByte)
 Cache write-back invalidate function.
 
typedef void(* Spi_CacheWb) (uint8 *BufPtr, uint16 LenByte)
 Cache write-back function.
 
typedef void(* Spi_CacheInv) (uint8 *BufPtr, uint16 LenByte)
 Cache invalidate function.
 
void Spi_Init (const Spi_ConfigType *CfgPtr)
 Service for SPI initialization.
 
Std_ReturnType Spi_DeInit (void)
 Service for SPI de-initialization.
 
Spi_StatusType Spi_GetStatus (void)
 Service returns the SPI Handler/Driver software module status.
 
Spi_JobResultType Spi_GetJobResult (Spi_JobType Job)
 This service returns the last transmission result of the specified Job.
 
Spi_SeqResultType Spi_GetSequenceResult (Spi_SequenceType Sequence)
 This service returns the last transmission result of the specified Sequence.
 
void Spi_GetVersionInfo (Std_VersionInfoType *versioninfo)
 This service returns the version information of this module.
 
Spi_StatusType Spi_GetHWUnitStatus (Spi_HWUnitType HWUnit)
 This service returns the status of the specified SPI Hardware microcontroller peripheral.
 
Std_ReturnType Spi_WriteIB (Spi_ChannelType Channel, const Spi_DataBufferType *DataBufferPtr)
 Service for writing one or more data to an IB SPI Handler/Driver Channel specified by parameter.
 
Std_ReturnType Spi_ReadIB (Spi_ChannelType Channel, Spi_DataBufferType *DataBufferPointer)
 Service for reading synchronously one or more data from an IB SPI Handler/Driver Channel specified by parameter.
 
Std_ReturnType Spi_SetupEB (Spi_ChannelType Channel, const Spi_DataBufferType *SrcDataBufferPtr, Spi_DataBufferType *DesDataBufferPtr, Spi_NumberOfDataType Length)
 Service to setup the buffers and the length of data for the EB SPI Handler/Driver Channel specified.
 
Std_ReturnType Spi_AsyncTransmit (Spi_SequenceType Sequence)
 Service to transmit data on the SPI bus.
 
void Spi_Cancel (Spi_SequenceType Sequence)
 Service cancels the specified on-going sequence transmission.
 
Std_ReturnType Spi_SyncTransmit (Spi_SequenceType Sequence)
 Service to transmit data on the SPI bus.
 
Std_ReturnType Spi_SetAsyncMode (Spi_AsyncModeType Mode)
 Service to set the asynchronous mechanism mode for SPI busses handled asynchronously.
 
void Spi_MainFunction_Handling (void)
 This function polls the SPI interrupts linked to HW Units allocated to the transmission of SPI sequences to enable the evolution of transmission state machine.
 
Std_ReturnType Spi_GetDmaHandle (struct Udma_DrvObj *udmaObjPtr)
 Service for getting DMA handle in SPI.
 
Std_ReturnType Spi_RegisterReadback (Spi_HWUnitType HWUnit, Spi_RegisterReadbackType *RegRbPtr)
 This function reads the important registers of the hardware unit and returns the value in the structure.
 
Std_ReturnType Spi_dataOverflowUnderflowIntrEnable (Spi_HWUnitType HWUnit, uint32 intFlags)
 This function Enable Under/Overflow Interupts of the hardware unit and returns the status.
 
Std_ReturnType Spi_dataOverflowUnderflowIntrDisable (Spi_HWUnitType HWUnit, uint32 intFlags)
 This function Disable Under/Overflow Interupts of the hardware unit and returns the status.
 
Mcspi_IrqStatusType Spi_dataOverflowUnderflowIntrGetStatus (Spi_HWUnitType HWUnit, uint32 intFlags)
 This function status Under/Overflow Interupts of the hardware unit and returns the status.
 
Std_ReturnType Spi_dataOverflowUnderflowIntrStatusClear (Spi_HWUnitType HWUnit, uint32 intFlags)
 This function status clear Under/Overflow Interupts of the hardware unit and returns the status.
 

SPI HW unit Info

enum  Spi_HwUnitType {
  CSIB0 = 0U , CSIB1 , CSIB2 , CSIB3 ,
  CSIB4 , CSIB5 , CSIB6 , CSIB7 ,
  CSIB8 , CSIB9 , CSIB10
}
 This type defines a range of HW SPI Hardware microcontroller peripheral allocated to this Job. More...
 
const uint32 Spi_HwUnitBaseAddr [SPI_HW_UNIT_CNT]
 
const struct Spi_ConfigType_s SpiDriver
 SPI Configuration struct declaration.
 
void SpiApp_wbInvCache (uint8 *buf, uint16 len)
 Cache write-back invalidate function.
 
void SpiApp_wbCache (uint8 *buf, uint16 len)
 Cache write-back function.
 
void SpiApp_invCache (uint8 *buf, uint16 len)
 Cache invalidate function.
 
void Spi_IrqUnitMcuMcspi0TxRx (void)
 SPI Hwunit ISR.
 
void Spi_IrqUnitMcuMcspi1TxRx (void)
 SPI MCU_MCSPI1 ISR.
 
void Spi_IrqUnitMcuMcspi2TxRx (void)
 SPI MCU_MCSPI2 ISR.
 
void Spi_IrqUnitMcspi0TxRx (void)
 SPI MCSPI0 ISR.
 
void Spi_IrqUnitMcspi1TxRx (void)
 SPI MCSPI1 ISR.
 
void Spi_IrqUnitMcspi2TxRx (void)
 SPI MCSPI2 ISR.
 
void Spi_IrqUnitMcspi3TxRx (void)
 SPI MCSPI3 ISR.
 
void Spi_IrqUnitMcspi4TxRx (void)
 SPI MCSPI4 ISR.
 
#define SPI_UNIT_MCU_MCSPI0   ((Spi_HWUnitType) CSIB0)
 MCU MCSPI0 instance.
 
#define SPI_UNIT_MCU_MCSPI1   ((Spi_HWUnitType) CSIB1)
 MCU MCSPI1 instance.
 
#define SPI_UNIT_MCU_MCSPI2   ((Spi_HWUnitType) CSIB2)
 MCU MCSPI2 instance.
 
#define SPI_UNIT_MCSPI0   ((Spi_HWUnitType) CSIB3)
 MCSPI0 instance.
 
#define SPI_UNIT_MCSPI1   ((Spi_HWUnitType) CSIB4)
 MCSPI1 instance.
 
#define SPI_UNIT_MCSPI2   ((Spi_HWUnitType) CSIB5)
 MCSPI2 instance.
 
#define SPI_UNIT_MCSPI3   ((Spi_HWUnitType) CSIB6)
 MCSPI3 instance.
 
#define SPI_UNIT_MCSPI4   ((Spi_HWUnitType) CSIB7)
 MCSPI4 instance.
 
#define SPI_UNIT_MCSPI5   ((Spi_HWUnitType) CSIB8)
 MCSPI5 instance.
 
#define SPI_UNIT_MCSPI6   ((Spi_HWUnitType) CSIB9)
 MCSPI6 instance.
 
#define SPI_UNIT_MCSPI7   ((Spi_HWUnitType) CSIB10)
 MCSPI7 instance.
 
#define SPI_HW_UNIT_CNT   (11U)
 Total HW units - used for array allocation. This should be +1 of the max unit number.
 

SPI Driver ISR category level

Definitions for SPI Driver ISR ISR category level.

#define SPI_ISR_VOID   (0x00U)
 void ISR type
 
#define SPI_ISR_CAT1   (0x01U)
 Category 1 ISR type.
 
#define SPI_ISR_CAT2   (0x02U)
 Category 2 ISR type.
 
#define SPI_CHANNELBUFFERS   (SPI_IB_EB)
 Pre Compile config macro name.
 
#define SPI_IB_MAX_LENGTH   (64U)
 Internal Buffer length in bytes - applicable only for SPI_IB.
 
#define SPI_DEV_ERROR_DETECT   (STD_ON)
 Enable/disable SPI dev detect error.
 
#define SPI_JOB_LOG   (STD_OFF)
 Enable/disable SPI job log.
 
#define SPI_MAX_JOB_LOG   (100U)
 Maximum job log entries when logging is ON.
 
#define SPI_MAX_HW_DMA_UNIT   (0U)
 Enable/disable SPI DMA Support.
 
#define SPI_DMA_ENABLE   (STD_OFF)
 Enable/disable SPI DMA Support.
 
#define SPI_LEVEL_0   (0U)
 Basic Synchronous functions.
 
#define SPI_LEVEL_1   (1U)
 Basic Asynchronous functions.
 
#define SPI_LEVEL_2   (2U)
 Synchronous and Asynchronous functions.
 
#define SPI_SUPPORT_CONCURRENT_SYNC_TRANSMIT   (STD_OFF)
 Concurrent sync transmit support - by defualt this is off.
 
#define SPI_SCALEABILITY   (SPI_LEVEL_2)
 Scalability level.
 
#define SPI_VERSION_INFO_API   (STD_ON)
 Enable/disable SPI get version info API.
 
#define SPI_HW_STATUS_API   (STD_ON)
 Enable/disable SPI HW Status API.
 
#define SPI_CANCEL_API   (STD_ON)
 Enable/disable SPI cancel API.
 
#define SPI_MAX_CHANNELS_PER_JOB   (1U)
 Maximum channels allowed per job.
 
#define SPI_MAX_JOBS_PER_SEQ   (1U)
 Maximum jobs allowed per sequence.
 
#define SPI_MAX_CHANNELS   (1U)
 Maximum channels across all jobs/sequence/hwunit.
 
#define SPI_MAX_JOBS   (1U)
 Maximum jobs across all sequence/hwunit.
 
#define SPI_MAX_SEQ   (1U)
 Maximum sequence across all hwunit.
 
#define SPI_MAX_HW_UNIT   (8U)
 Maximum HW unit - This should match the sum for the below units ISR which are ON.
 
#define SPI_MAX_EXT_DEV   (11U)
 Maximum external device cfg.
 
#define SPI_UNIT_MCU_MCSPI0_ACTIVE   (STD_ON)
 Enable/disable SPI MCU MCSPI0 unit ISR.
 
#define SPI_UNIT_MCU_MCSPI1_ACTIVE   (STD_ON)
 Enable/disable SPI MCU MCSPI1 unit ISR.
 
#define SPI_UNIT_MCU_MCSPI2_ACTIVE   (STD_ON)
 Enable/disable SPI MCU MCSPI2 unit ISR.
 
#define SPI_UNIT_MCSPI0_ACTIVE   (STD_ON)
 Enable/disable SPI MCSPI0 unit ISR.
 
#define SPI_UNIT_MCSPI1_ACTIVE   (STD_ON)
 Enable/disable SPI MCSPI1 unit ISR.
 
#define SPI_UNIT_MCSPI2_ACTIVE   (STD_ON)
 Enable/disable SPI MCSPI2 unit ISR.
 
#define SPI_UNIT_MCSPI3_ACTIVE   (STD_ON)
 Enable/disable SPI MCSPI3 unit ISR.
 
#define SPI_UNIT_MCSPI4_ACTIVE   (STD_ON)
 Enable/disable SPI MCSPI4 unit ISR.
 
#define SPI_UNIT_MCSPI5_ACTIVE   (STD_OFF)
 Enable/disable SPI MCSPI5 unit ISR.
 
#define SPI_UNIT_MCSPI6_ACTIVE   (STD_OFF)
 Enable/disable SPI MCSPI6 unit ISR.
 
#define SPI_UNIT_MCSPI7_ACTIVE   (STD_OFF)
 Enable/disable SPI MCSPI7 unit ISR.
 
#define SPI_ISR_TYPE   (SPI_ISR_CAT1)
 ISR type.
 
#define SPI_OS_COUNTER_ID   ((CounterType)OsCounter_0)
 OS counter ID - used for timeout in case of error.
 
#define SPI_TIMEOUT_DURATION   (32000U)
 SPI timeout - used in McSPI IP reset Each tick is 31.25us (for 32K Counter). Wait for 100ms which comes to below value.
 
#define SPI_REGISTER_READBACK_API   (STD_ON)
 Enable/disable SPI register read back API.
 
#define SPI_SAFETY_API   (STD_ON)
 Enable/disable SPI safety API.
 
#define SpiConf_SpiChannel_SpiChannel_0   (0U)
 Symbolic Name Channel Id - 0 SpiChannel_0.
 
#define SpiConf_SpiExternalDevice_CS0   (SPI_CS0)
 Symbolic Name Chip Select - 0.
 
#define SpiConf_SpiJob_SpiJob_0   (0U)
 Symbolic Name Job Id - 0 SpiJob_0.
 
#define SpiConf_SpiSequence_SpiSequence_0   (0U)
 Symbolic Name Sequence Id - 0 SpiSequence_0.
 
#define SpiConf_SpiExternalDevice_HwUnitId0   (CSIB0)
 Symbolic Name HW Unit - 0.
 
#define SpiConf_SpiExternalDevice_HwUnitId1   (CSIB1)
 Symbolic Name HW Unit - 0.
 
#define SpiConf_SpiExternalDevice_HwUnitId2   (CSIB2)
 Symbolic Name HW Unit - 0.
 
#define SpiConf_SpiExternalDevice_HwUnitId3   (CSIB3)
 Symbolic Name HW Unit - 0.
 
#define SpiConf_SpiExternalDevice_HwUnitId4   (CSIB4)
 Symbolic Name HW Unit - 0.
 
#define SpiConf_SpiExternalDevice_HwUnitId5   (CSIB5)
 Symbolic Name HW Unit - 0.
 
#define SpiConf_SpiExternalDevice_HwUnitId6   (CSIB6)
 Symbolic Name HW Unit - 0.
 
#define SpiConf_SpiExternalDevice_HwUnitId7   (CSIB7)
 Symbolic Name HW Unit - 0.
 

SPI DEM Error codes to report

Pre-compile switches for enabling/disabling DEM events

#define SPI_E_HARDWARE_ERROR   (DemConf_DemEventParameter_SPI_E_HARDWARE_ERROR)
 Hardware failed.
 

Macro Definition Documentation

◆ SPI_VARIANT_POST_BUILD

#define SPI_VARIANT_POST_BUILD   (STD_ON)

SPI Build Variant. Build variants.(i.e Pre Compile,Post Build or Link time)

◆ SPI_ISR_VOID

#define SPI_ISR_VOID   (0x00U)

void ISR type

◆ SPI_ISR_CAT1

#define SPI_ISR_CAT1   (0x01U)

Category 1 ISR type.

◆ SPI_ISR_CAT2

#define SPI_ISR_CAT2   (0x02U)

Category 2 ISR type.

◆ SPI_CHANNELBUFFERS

#define SPI_CHANNELBUFFERS   (SPI_IB_EB)

Pre Compile config macro name.

Buffer mode - Internal or External or Both

◆ SPI_IB_MAX_LENGTH

#define SPI_IB_MAX_LENGTH   (64U)

Internal Buffer length in bytes - applicable only for SPI_IB.

◆ SPI_DEV_ERROR_DETECT

#define SPI_DEV_ERROR_DETECT   (STD_ON)

Enable/disable SPI dev detect error.

◆ SPI_JOB_LOG

#define SPI_JOB_LOG   (STD_OFF)

Enable/disable SPI job log.

◆ SPI_MAX_JOB_LOG

#define SPI_MAX_JOB_LOG   (100U)

Maximum job log entries when logging is ON.

◆ SPI_MAX_HW_DMA_UNIT

#define SPI_MAX_HW_DMA_UNIT   (0U)

Enable/disable SPI DMA Support.

◆ SPI_DMA_ENABLE

#define SPI_DMA_ENABLE   (STD_OFF)

Enable/disable SPI DMA Support.

◆ SPI_LEVEL_0

#define SPI_LEVEL_0   (0U)

Basic Synchronous functions.

◆ SPI_LEVEL_1

#define SPI_LEVEL_1   (1U)

Basic Asynchronous functions.

◆ SPI_LEVEL_2

#define SPI_LEVEL_2   (2U)

Synchronous and Asynchronous functions.

◆ SPI_SUPPORT_CONCURRENT_SYNC_TRANSMIT

#define SPI_SUPPORT_CONCURRENT_SYNC_TRANSMIT   (STD_OFF)

Concurrent sync transmit support - by defualt this is off.

◆ SPI_SCALEABILITY

#define SPI_SCALEABILITY   (SPI_LEVEL_2)

Scalability level.

◆ SPI_VERSION_INFO_API

#define SPI_VERSION_INFO_API   (STD_ON)

Enable/disable SPI get version info API.

◆ SPI_HW_STATUS_API

#define SPI_HW_STATUS_API   (STD_ON)

Enable/disable SPI HW Status API.

◆ SPI_CANCEL_API

#define SPI_CANCEL_API   (STD_ON)

Enable/disable SPI cancel API.

◆ SPI_MAX_CHANNELS_PER_JOB

#define SPI_MAX_CHANNELS_PER_JOB   (1U)

Maximum channels allowed per job.

◆ SPI_MAX_JOBS_PER_SEQ

#define SPI_MAX_JOBS_PER_SEQ   (1U)

Maximum jobs allowed per sequence.

◆ SPI_MAX_CHANNELS

#define SPI_MAX_CHANNELS   (1U)

Maximum channels across all jobs/sequence/hwunit.

◆ SPI_MAX_JOBS

#define SPI_MAX_JOBS   (1U)

Maximum jobs across all sequence/hwunit.

◆ SPI_MAX_SEQ

#define SPI_MAX_SEQ   (1U)

Maximum sequence across all hwunit.

◆ SPI_MAX_HW_UNIT

#define SPI_MAX_HW_UNIT   (8U)

Maximum HW unit - This should match the sum for the below units ISR which are ON.

◆ SPI_MAX_EXT_DEV

#define SPI_MAX_EXT_DEV   (11U)

Maximum external device cfg.

◆ SPI_UNIT_MCU_MCSPI0_ACTIVE

#define SPI_UNIT_MCU_MCSPI0_ACTIVE   (STD_ON)

Enable/disable SPI MCU MCSPI0 unit ISR.

◆ SPI_UNIT_MCU_MCSPI1_ACTIVE

#define SPI_UNIT_MCU_MCSPI1_ACTIVE   (STD_ON)

Enable/disable SPI MCU MCSPI1 unit ISR.

◆ SPI_UNIT_MCU_MCSPI2_ACTIVE

#define SPI_UNIT_MCU_MCSPI2_ACTIVE   (STD_ON)

Enable/disable SPI MCU MCSPI2 unit ISR.

◆ SPI_UNIT_MCSPI0_ACTIVE

#define SPI_UNIT_MCSPI0_ACTIVE   (STD_ON)

Enable/disable SPI MCSPI0 unit ISR.

◆ SPI_UNIT_MCSPI1_ACTIVE

#define SPI_UNIT_MCSPI1_ACTIVE   (STD_ON)

Enable/disable SPI MCSPI1 unit ISR.

◆ SPI_UNIT_MCSPI2_ACTIVE

#define SPI_UNIT_MCSPI2_ACTIVE   (STD_ON)

Enable/disable SPI MCSPI2 unit ISR.

◆ SPI_UNIT_MCSPI3_ACTIVE

#define SPI_UNIT_MCSPI3_ACTIVE   (STD_ON)

Enable/disable SPI MCSPI3 unit ISR.

◆ SPI_UNIT_MCSPI4_ACTIVE

#define SPI_UNIT_MCSPI4_ACTIVE   (STD_ON)

Enable/disable SPI MCSPI4 unit ISR.

◆ SPI_UNIT_MCSPI5_ACTIVE

#define SPI_UNIT_MCSPI5_ACTIVE   (STD_OFF)

Enable/disable SPI MCSPI5 unit ISR.

◆ SPI_UNIT_MCSPI6_ACTIVE

#define SPI_UNIT_MCSPI6_ACTIVE   (STD_OFF)

Enable/disable SPI MCSPI6 unit ISR.

◆ SPI_UNIT_MCSPI7_ACTIVE

#define SPI_UNIT_MCSPI7_ACTIVE   (STD_OFF)

Enable/disable SPI MCSPI7 unit ISR.

◆ SPI_ISR_TYPE

#define SPI_ISR_TYPE   (SPI_ISR_CAT1)

ISR type.

◆ SPI_OS_COUNTER_ID

#define SPI_OS_COUNTER_ID   ((CounterType)OsCounter_0)

OS counter ID - used for timeout in case of error.

◆ SPI_TIMEOUT_DURATION

#define SPI_TIMEOUT_DURATION   (32000U)

SPI timeout - used in McSPI IP reset Each tick is 31.25us (for 32K Counter). Wait for 100ms which comes to below value.

◆ SPI_REGISTER_READBACK_API

#define SPI_REGISTER_READBACK_API   (STD_ON)

Enable/disable SPI register read back API.

◆ SPI_SAFETY_API

#define SPI_SAFETY_API   (STD_ON)

Enable/disable SPI safety API.

◆ SpiConf_SpiChannel_SpiChannel_0

#define SpiConf_SpiChannel_SpiChannel_0   (0U)

Symbolic Name Channel Id - 0 SpiChannel_0.

◆ SpiConf_SpiExternalDevice_CS0

#define SpiConf_SpiExternalDevice_CS0   (SPI_CS0)

Symbolic Name Chip Select - 0.

◆ SpiConf_SpiJob_SpiJob_0

#define SpiConf_SpiJob_SpiJob_0   (0U)

Symbolic Name Job Id - 0 SpiJob_0.

◆ SpiConf_SpiSequence_SpiSequence_0

#define SpiConf_SpiSequence_SpiSequence_0   (0U)

Symbolic Name Sequence Id - 0 SpiSequence_0.

◆ SpiConf_SpiExternalDevice_HwUnitId0

#define SpiConf_SpiExternalDevice_HwUnitId0   (CSIB0)

Symbolic Name HW Unit - 0.

◆ SpiConf_SpiExternalDevice_HwUnitId1

#define SpiConf_SpiExternalDevice_HwUnitId1   (CSIB1)

Symbolic Name HW Unit - 0.

◆ SpiConf_SpiExternalDevice_HwUnitId2

#define SpiConf_SpiExternalDevice_HwUnitId2   (CSIB2)

Symbolic Name HW Unit - 0.

◆ SpiConf_SpiExternalDevice_HwUnitId3

#define SpiConf_SpiExternalDevice_HwUnitId3   (CSIB3)

Symbolic Name HW Unit - 0.

◆ SpiConf_SpiExternalDevice_HwUnitId4

#define SpiConf_SpiExternalDevice_HwUnitId4   (CSIB4)

Symbolic Name HW Unit - 0.

◆ SpiConf_SpiExternalDevice_HwUnitId5

#define SpiConf_SpiExternalDevice_HwUnitId5   (CSIB5)

Symbolic Name HW Unit - 0.

◆ SpiConf_SpiExternalDevice_HwUnitId6

#define SpiConf_SpiExternalDevice_HwUnitId6   (CSIB6)

Symbolic Name HW Unit - 0.

◆ SpiConf_SpiExternalDevice_HwUnitId7

#define SpiConf_SpiExternalDevice_HwUnitId7   (CSIB7)

Symbolic Name HW Unit - 0.

◆ SPI_E_HARDWARE_ERROR

#define SPI_E_HARDWARE_ERROR   (DemConf_DemEventParameter_SPI_E_HARDWARE_ERROR)

Hardware failed.

◆ SPI_UNIT_MCU_MCSPI0

#define SPI_UNIT_MCU_MCSPI0   ((Spi_HWUnitType) CSIB0)

MCU MCSPI0 instance.

◆ SPI_UNIT_MCU_MCSPI1

#define SPI_UNIT_MCU_MCSPI1   ((Spi_HWUnitType) CSIB1)

MCU MCSPI1 instance.

◆ SPI_UNIT_MCU_MCSPI2

#define SPI_UNIT_MCU_MCSPI2   ((Spi_HWUnitType) CSIB2)

MCU MCSPI2 instance.

◆ SPI_UNIT_MCSPI0

#define SPI_UNIT_MCSPI0   ((Spi_HWUnitType) CSIB3)

MCSPI0 instance.

◆ SPI_UNIT_MCSPI1

#define SPI_UNIT_MCSPI1   ((Spi_HWUnitType) CSIB4)

MCSPI1 instance.

◆ SPI_UNIT_MCSPI2

#define SPI_UNIT_MCSPI2   ((Spi_HWUnitType) CSIB5)

MCSPI2 instance.

◆ SPI_UNIT_MCSPI3

#define SPI_UNIT_MCSPI3   ((Spi_HWUnitType) CSIB6)

MCSPI3 instance.

◆ SPI_UNIT_MCSPI4

#define SPI_UNIT_MCSPI4   ((Spi_HWUnitType) CSIB7)

MCSPI4 instance.

◆ SPI_UNIT_MCSPI5

#define SPI_UNIT_MCSPI5   ((Spi_HWUnitType) CSIB8)

MCSPI5 instance.

◆ SPI_UNIT_MCSPI6

#define SPI_UNIT_MCSPI6   ((Spi_HWUnitType) CSIB9)

MCSPI6 instance.

◆ SPI_UNIT_MCSPI7

#define SPI_UNIT_MCSPI7   ((Spi_HWUnitType) CSIB10)

MCSPI7 instance.

◆ SPI_HW_UNIT_CNT

#define SPI_HW_UNIT_CNT   (11U)

Total HW units - used for array allocation. This should be +1 of the max unit number.

Typedef Documentation

◆ Spi_CacheWbInv

typedef void(* Spi_CacheWbInv) (uint8 *BufPtr, uint16 LenByte)

Cache write-back invalidate function.

Pointer to a function that performs the cache write-back invalidate operation. This function is to be called on TX buffers before they are given to the Spi controller hardware.

◆ Spi_CacheWb

typedef void(* Spi_CacheWb) (uint8 *BufPtr, uint16 LenByte)

Cache write-back function.

Pointer to a function that performs the cache write-back operation. This function is to be called on TX buffers before they are given to the Spi controller hardware.

◆ Spi_CacheInv

typedef void(* Spi_CacheInv) (uint8 *BufPtr, uint16 LenByte)

Cache invalidate function.

Pointer to a function that performs the cache invalidate operation. This function is to be called on RX buffers after they have been retrieved from the Spi controller hardware.

Enumeration Type Documentation

◆ Spi_StatusType

This type defines a range of specific status for SPI Handler/Driver.

Enumerator
SPI_UNINIT 

The SPI Handler/Driver is not initialized or not usable

SPI_IDLE 

The SPI Handler/Driver is not currently transmitting any Job

SPI_BUSY 

The SPI Handler/Driver is performing a SPI Job (transmit)

◆ Spi_JobResultType

This type defines a range of specific Jobs status for SPI Handler/Driver.

Enumerator
SPI_JOB_OK 

The last transmission of the Job has been finished successfully

SPI_JOB_PENDING 

The SPI Handler/Driver is performing a SPI Job. The meaning of this status is equal to SPI_BUSY

SPI_JOB_FAILED 

The last transmission of the Job has failed

SPI_JOB_QUEUED 

An asynchronous transmit Job has been accepted, while actual transmission for this Job has not started yet

◆ Spi_SeqResultType

This type defines a range of specific Sequences status for SPI Handler/Driver.

Enumerator
SPI_SEQ_OK 

The last transmission of the Sequence has been finished successfully

SPI_SEQ_PENDING 

The SPI Handler/Driver is performing a SPI Sequence. The meaning of this status is equal to SPI_BUSY

SPI_SEQ_FAILED 

The last transmission of the Sequence has failed

SPI_SEQ_CANCELLED 

The last transmission of the Sequence has been canceled by user

◆ Spi_HwUnitResultType

This type defines a range of specific HW unit status for SPI Handler/Driver.

Enumerator
SPI_HW_UNIT_OK 

HW unit result is ok

SPI_HW_UNIT_PENDING 

HW unit result is pending

SPI_HW_UNIT_FAILED 

HW unit result is failed

◆ Spi_AsyncModeType

Specifies the asynchronous mechanism mode for SPI busses handled asynchronously in LEVEL 2.

Enumerator
SPI_POLLING_MODE 

The asynchronous mechanism is ensured by polling, so interrupts related to SPI busses handled asynchronously are disabled

SPI_INTERRUPT_MODE 

The asynchronous mechanism is ensured by interrupt, so interrupts related to SPI busses handled asynchronously are enabled

◆ Spi_TransferType

Word transfer order - MSB first or LSB first.

Enumerator
SPI_MSB 

MSB is transferred first. Only this is supported

SPI_LSB 

LSB is transferred first. This is not supported

◆ Spi_LevelType

Type for SPI Chip Select Polarity and Clock Idle Level.

Enumerator
SPI_LOW 

Low clock or chip select

SPI_HIGH 

High clock or chip select

◆ Spi_CsPinType

SPI Chip Select Pin.

Enumerator
SPI_CS0 

Chip select 0

SPI_CS1 

Chip select 1

SPI_CS2 

Chip select 2

SPI_CS3 

Chip select 3

◆ Spi_ClkMode

SPI Clock Mode - sets the clock polarity and phase. Note: These values are a direct register mapping. So don't change value.

Enumerator
SPI_CLK_MODE_0 

SPI Clock Phase = 0 (rising edge latch), Polarity = 0 (Active HIGH)

SPI_CLK_MODE_1 

SPI Clock Phase = 1 (falling edge latch), Polarity = 0 (Active HIGH)

SPI_CLK_MODE_2 

SPI Clock Phase = 0 (rising edge latch), Polarity = 1 (Active LOW)

SPI_CLK_MODE_3 

SPI Clock Phase = 1 (falling edge latch), Polarity = 1 (Active LOW)

◆ Spi_TxRxMode

SPI TX/RX Mode.

Note:

  1. These values are a direct register mapping. So don't change value.
  2. RX only mode doesn't make sense in master mode because to receive data the master has to generate clock, which means it should transmit. Hence this mode is not supported. The user can alternatively set the TX buffer pointer to NULL and set the default TX value (defaultTxData) to make TX data line at the desired level.
Enumerator
SPI_TX_RX_MODE_BOTH 

Both TX and RX are enabled

SPI_TX_RX_MODE_TX_ONLY 

Only TX is enabled

◆ Spi_JobPriorityType

SPI Job Priority.

Enumerator
SPI_JOB_PRIORITY_0 

Job priority 0 - low

SPI_JOB_PRIORITY_1 

Job priority 1

SPI_JOB_PRIORITY_2 

Job priority 2

SPI_JOB_PRIORITY_3 

Job priority 3 - High

◆ Spi_CsModeType

SPI Chip Select Mode.

Enumerator
SPI_SINGLE 

Chip select mode - single. Active only when transfer is on.

SPI_CONTINUOUS 

Chip select mode - continuous. Active throughout.

◆ Spi_DataDelayType

Spi_DataDelayType defines the number of interface clock cycles between CS toggling and first or last edge of MCSPI clock.

Enumerator
SPI_DATADELAY_0 

0.5 clock cycles delay

SPI_DATADELAY_1 

1.5 clock cycles delay

SPI_DATADELAY_2 

2.5 clock cycles delay

SPI_DATADELAY_3 

3.5 clock cycles delay

◆ Spi_DataLineReceiveType

Spi_DataLineReceiveType defines the lines selected for reception.

Enumerator
DATA_LINE_0_RECEPTION 

Data line 0 (SPIDAT[0]) selected for reception

DATA_LINE_1_RECEPTION 

Data line 1 (SPIDAT[1]) selected for reception

◆ Spi_DataLineTransmitType

Spi_DataLineTransmitType defines the lines selected for transmission.

Enumerator
DATA_LINE_NO_TRANSMISSION 

No transmission on data lines

DATA_LINE_0_TRANSMISSION 

Data line 0 (SPIDAT[0]) selected for transmission

DATA_LINE_1_TRANSMISSION 

Data line 1 (SPIDAT[1]) selected for transmission

DATA_LINE_BOTH_TRANSMISSION 

Data line 0 and 1 (SPIDAT[0] & SPIDAT[1]) selected for transmission

◆ Mcspi_IrqStatusType

Irq status and std return type.

Enumerator
SPI_NO_EVENT 

No event ocuurs in Overflow/Under flow

SPI_EVENT_PENDING 

Event occurs in Overflow/Under flow

SPI_STATUS_READ_FAIL 

The status reading fails

◆ Spi_HwUnitType

This type defines a range of HW SPI Hardware microcontroller peripheral allocated to this Job.

Enumerator
CSIB0 

MCU MCSPI0 instance

CSIB1 

MCU MCSPI1 instance

CSIB2 

MCU MCSPI2 instance

CSIB3 

MCSPI0 instance

CSIB4 

MCSPI1 instance

CSIB5 

MCSPI2 instance

CSIB6 

MCSPI3 instance

CSIB7 

MCSPI4 instance

CSIB8 

MCSPI5 instance

CSIB9 

MCSPI6 instance

CSIB10 

MCSPI7 instance

Function Documentation

◆ Spi_Init()

void Spi_Init ( const Spi_ConfigType * CfgPtr)

Service for SPI initialization.

*  Service name        : Spi_Init
*  Syntax              : void Spi_Init( const Spi_ConfigType* CfgPtr )
*  Mode                : Supervisor Mode (Privileged Mode)
*  Service ID[hex]     : 0x00
*  Sync/Async          : Synchronous
*  Reentrancy          : Non Reentrant
*  Parameters (in)     : CfgPtr - Pointer to configuration set
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : None
*  Description         : Service for SPI initialization
*  

◆ Spi_DeInit()

Std_ReturnType Spi_DeInit ( void )

Service for SPI de-initialization.

*  Service name        : Spi_DeInit
*  Syntax              : Std_ReturnType Spi_DeInit( void )
*  Mode                : Supervisor Mode (Privileged Mode)
*  Service ID[hex]     : 0x01
*  Sync/Async          : Synchronous
*  Reentrancy          : Non Reentrant
*  Parameters (in)     : None
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : Std_ReturnType
*                        E_OK: de-initialisation command has been accepted
*                        E_NOT_OK: de-initialisation command has not been
*                                  accepted
*  Description         : Service for SPI de-initialization
*  

◆ Spi_GetStatus()

Spi_StatusType Spi_GetStatus ( void )

Service returns the SPI Handler/Driver software module status.

*  Service name        : Spi_GetStatus
*  Syntax              : Spi_StatusType Spi_GetStatus( void )
*  Mode                : User Mode (Non-Privileged Mode)
*  Service ID[hex]     : 0x06
*  Sync/Async          : Synchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : None
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : Spi_StatusType - Spi_StatusType
*  Description         : Service for SPI de-initialization
*  

◆ Spi_GetJobResult()

Spi_JobResultType Spi_GetJobResult ( Spi_JobType Job)

This service returns the last transmission result of the specified Job.

*  Service name        : Spi_GetJobResult
*  Syntax              : Spi_JobResultType Spi_GetJobResult( Spi_JobType Job )
*  Mode                : User Mode (Non-Privileged Mode)
*  Service ID[hex]     : 0x07
*  Sync/Async          : Synchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : Job - Job ID. An invalid job ID will return an
*                        undefined result
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : Spi_JobResultType - Spi_JobResultType
*  Description         : Service for SPI de-initialization
*  

◆ Spi_GetSequenceResult()

Spi_SeqResultType Spi_GetSequenceResult ( Spi_SequenceType Sequence)

This service returns the last transmission result of the specified Sequence.

*  Service name        : Spi_GetSequenceResult
*  Syntax              : Spi_SeqResultType Spi_GetSequenceResult(
*                                                   Spi_SequenceType Sequence )
*  Mode                : User Mode (Non-Privileged Mode)
*  Service ID[hex]     : 0x08
*  Sync/Async          : Synchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : Sequence - Sequence ID. An invalid sequence ID will
*                        return an undefined result
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : Spi_SeqResultType - Spi_SeqResultType
*  Description         : This service returns the last transmission result of
*                        the specified Sequence
*  

◆ Spi_GetVersionInfo()

void Spi_GetVersionInfo ( Std_VersionInfoType * versioninfo)

This service returns the version information of this module.

*  Service name        : Spi_GetVersionInfo
*  Syntax              : void Spi_GetVersionInfo( Std_VersionInfoType*
*                                                                 versioninfo )
*  Mode                : User Mode (Non-Privileged Mode)
*  Service ID[hex]     : 0x09
*  Sync/Async          : Synchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : None
*  Parameters (inout)  : versioninfo - Pointer to where to store the version
*                        information of this module
*  Parameters (out)    : None
*  Return value        : None
*  Description         : This service returns the version information of this
*                        module
*  

◆ Spi_GetHWUnitStatus()

Spi_StatusType Spi_GetHWUnitStatus ( Spi_HWUnitType HWUnit)

This service returns the status of the specified SPI Hardware microcontroller peripheral.

*  Service name        : Spi_GetHWUnitStatus
*  Syntax              : Spi_StatusType Spi_GetHWUnitStatus( Spi_HWUnitType
*                                                                      HWUnit )
*  Mode                : User Mode (Non-Privileged Mode)
*  Service ID[hex]     : 0x0b
*  Sync/Async          : Synchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : HWUnit - SPI Hardware microcontroller peripheral
*                        unit ID.
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : Spi_StatusType - Spi_StatusType
*  Description         : This service returns the status of the specified SPI
*                        Hardware microcontroller peripheral
*  

◆ Spi_WriteIB()

Std_ReturnType Spi_WriteIB ( Spi_ChannelType Channel,
const Spi_DataBufferType * DataBufferPtr )

Service for writing one or more data to an IB SPI Handler/Driver Channel specified by parameter.

*  Service name        : Spi_WriteIB
*  Syntax              : Std_ReturnType Spi_WriteIB(
*                              Spi_ChannelType Channel,
*                              const Spi_DataBufferType* DataBufferPtr )
*
*  Mode                : User Mode (Non-Privileged Mode)
*  Service ID[hex]     : 0x02
*  Sync/Async          : Synchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : Channel - Channel ID
*                        DataBufferPtr - Pointer to source data buffer.
*                        If this pointer is null, it is assumed that the data
*                        to be transmitted is not relevant and the default
*                        transmit value of this channel will be used instead.
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : Std_ReturnType
*                        E_OK: Write command has been accepted
*                        E_NOT_OK: Write command has not been accepted
*  Description         : Service for writing one or more data to an IB SPI
*                        Handler/Driver Channel specified by parameter
*  

◆ Spi_ReadIB()

Std_ReturnType Spi_ReadIB ( Spi_ChannelType Channel,
Spi_DataBufferType * DataBufferPointer )

Service for reading synchronously one or more data from an IB SPI Handler/Driver Channel specified by parameter.

*  Service name        : Spi_ReadIB
*  Syntax              : Std_ReturnType Spi_ReadIB(
*                              Spi_ChannelType Channel,
*                              Spi_DataBufferType* DataBufferPointer )
*
*  Mode                : User Mode (Non-Privileged Mode)
*  Service ID[hex]     : 0x04
*  Sync/Async          : Synchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : Channel - Channel ID
*  Parameters (inout)  : None
*  Parameters (out)    : DataBufferPointer - Pointer to destination data buffer.
*  Return value        : Std_ReturnType
*                        E_OK: Read command has been accepted
*                        E_NOT_OK: Read command has not been accepted
*  Description         : Service for reading synchronously one or more data
*                        from an IB SPI Handler/Driver Channel specified by
*                        parameter
*  

◆ Spi_SetupEB()

Std_ReturnType Spi_SetupEB ( Spi_ChannelType Channel,
const Spi_DataBufferType * SrcDataBufferPtr,
Spi_DataBufferType * DesDataBufferPtr,
Spi_NumberOfDataType Length )

Service to setup the buffers and the length of data for the EB SPI Handler/Driver Channel specified.

*  Service name        : Spi_SetupEB
*  Syntax              : Std_ReturnType Spi_SetupEB( Spi_ChannelType Channel,
*                                  const Spi_DataBufferType* SrcDataBufferPtr,
*                                  Spi_DataBufferType* DesDataBufferPtr,
*                                   Spi_NumberOfDataType Length )
*  Mode                : User Mode (Non-Privileged Mode)
*  Service ID[hex]     : 0x05
*  Sync/Async          : Synchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : Channel - Channel ID
*                        SrcDataBufferPtr - Pointer to source data buffer
*                        DesDataBufferPtr - Pointer to destination data buffer
*                                           in RAM.
*                        Length - Length (number of data elements) of the data
*                        to be transmitted from SrcDataBufferPtr and/or
*                        received
*                        from DesDataBufferPtr Min.: 1 Max.: Max of data
*                        specified at configuration for this channel
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : Std_ReturnType
*                        E_OK: Setup command has been accepted
*                        E_NOT_OK: Setup command has not been accepted
*  Description         : Service to setup the buffers and the length of data
*                        for the EB SPI Handler/Driver Channel specified
*  

◆ Spi_AsyncTransmit()

Std_ReturnType Spi_AsyncTransmit ( Spi_SequenceType Sequence)

Service to transmit data on the SPI bus.

*  Service name        : Spi_AsyncTransmit
*  Syntax              : Std_ReturnType Spi_AsyncTransmit( Spi_SequenceType
*                                                              Sequence )
*  Mode                : Supervisor Mode (Privileged Mode)
*  Service ID[hex]     : 0x03
*  Sync/Async          : Asynchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : Sequence - Sequence ID
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : Std_ReturnType
*                        E_OK: Transmission command has been accepted
*                        E_NOT_OK: Transmission command has not been accepted
*  Description         : Service to transmit data on the SPI bus
*  

◆ Spi_Cancel()

void Spi_Cancel ( Spi_SequenceType Sequence)

Service cancels the specified on-going sequence transmission.

*  Service name        : Spi_Cancel
*  Syntax              : void Spi_Cancel( Spi_SequenceType Sequence )
*  Mode                : User Mode (Non-Privileged Mode)
*  Service ID[hex]     : 0x0c
*  Sync/Async          : Asynchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : Sequence - Sequence ID
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : None
*  Description         : Service cancels the specified on-going sequence
*                        transmission
*  

◆ Spi_SyncTransmit()

Std_ReturnType Spi_SyncTransmit ( Spi_SequenceType Sequence)

Service to transmit data on the SPI bus.

*  Service name        : Spi_SyncTransmit
*  Syntax              : Std_ReturnType Spi_SyncTransmit( Spi_SequenceType
*                                                                  Sequence)
*  Mode                : Supervisor Mode (Privileged Mode)
*  Service ID[hex]     : 0x0A
*  Sync/Async          : Synchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : Sequence - Sequence ID
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : Std_ReturnType
*                        E_OK: Transmission command has been completed
*                        E_NOT_OK: Transmission command has not been completed
*  Description         : Service to transmit data on the SPI bus
*  

◆ Spi_SetAsyncMode()

Std_ReturnType Spi_SetAsyncMode ( Spi_AsyncModeType Mode)

Service to set the asynchronous mechanism mode for SPI busses handled asynchronously.

*  Service name        : Spi_SetAsyncMode
*  Syntax              : Std_ReturnType Spi_SetAsyncMode( Spi_AsyncModeType
*                                                                      Mode )
*  Mode                : User Mode (Non-Privileged Mode)
*  Service ID[hex]     : 0x0D
*  Sync/Async          : Synchronous
*  Reentrancy          : Non Reentrant
*  Parameters (in)     : Mode - New mode required.
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : Std_ReturnType
*                        E_OK: Setting command has been done
*                        E_NOT_OK: Setting command has not been accepted
*  Description         : Service to set the asynchronous mechanism mode for
*                        SPI busses handled asynchronously.
*  

◆ Spi_MainFunction_Handling()

void Spi_MainFunction_Handling ( void )

This function polls the SPI interrupts linked to HW Units allocated to the transmission of SPI sequences to enable the evolution of transmission state machine.

*  Service name        : Spi_MainFunction_Handling
*  Syntax              : void Spi_MainFunction_Handling( void )
*  Mode                : Supervisor Mode (Privileged Mode)
*  Service ID[hex]     : 0x10
*  Sync/Async          : Synchronous
*  Reentrancy          : Non Reentrant
*  Parameters (in)     : None
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : None
*  Description         : This function polls the SPI interrupts linked to
*                        HW Units allocated to the transmission of SPI
*                        sequences to enable the evolution of transmission
*                        state machine.
*  

◆ Spi_GetDmaHandle()

Std_ReturnType Spi_GetDmaHandle ( struct Udma_DrvObj * udmaObjPtr)

Service for getting DMA handle in SPI.

*  Service name        : Spi_SetDmaHandle
*  Syntax              : Std_ReturnType Spi_SetDmaHandle(Udma_DrvHandle dmaDrvHandle);
*  Mode                : Supervisor Mode (Privileged Mode)
*  Service ID[hex]     : 0x20
*  Sync/Async          : Synchronous
*  Reentrancy          : Non Reentrant
*  Parameters (in)     : dmaDrvHandle - dma driver handle
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : Spi_StatusType - Spi_StatusType
*  Description         : Service for getting DMA handle in SPI
*  

◆ Spi_RegisterReadback()

Std_ReturnType Spi_RegisterReadback ( Spi_HWUnitType HWUnit,
Spi_RegisterReadbackType * RegRbPtr )

This function reads the important registers of the hardware unit and returns the value in the structure.

This API should be called after Spi_Init is called. Otherwise this API will return E_NOT_OK.

This API could be used to readback the register contents after Spi_Init and then the readback value could be compared during SPI execution to check the correctness of the HW unit. Since this API is used for this purpose, the register returned are the ones which doesn't change after init based on job or channel config.

*  Service name        : Spi_RegisterReadback
*  Mode                : Supervisor Mode (Privileged Mode)
*  Sync/Async          : Synchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : HWUnit - SPI Hardware microcontroller peripheral
*                        unit ID. If this is invalid, then the API will
*                        return E_NOT_OK.
*  Parameters (inout)  : RegRbPtr - Pointer to where to store the readback
*                        values. If this pointer is NULL_PTR, then the API
*                        will return E_NOT_OK.
*  Return value        : Std_ReturnType
*                        E_OK: Register read back has been done
*                        E_NOT_OK: Register read back failed
*  

◆ Spi_dataOverflowUnderflowIntrEnable()

Std_ReturnType Spi_dataOverflowUnderflowIntrEnable ( Spi_HWUnitType HWUnit,
uint32 intFlags )

This function Enable Under/Overflow Interupts of the hardware unit and returns the status.

*  Service name        : Spi_dataOverflowUnderflowIntrEnable
*  Mode                : Supervisor Mode (Privileged Mode)
*  Sync/Async          : Synchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : HWUnit - SPI Hardware microcontroller peripheral
*                        unit ID. If this is invalid, then the API will
*                        return E_NOT_OK.
*                      : intFlags - Mask value of MCSPI_IRQENABLE register
*  Return value        : Std_ReturnType
*                        E_OK: Interupt Enabled
*                        E_NOT_OK: Interupt Enable failed
*  

◆ Spi_dataOverflowUnderflowIntrDisable()

Std_ReturnType Spi_dataOverflowUnderflowIntrDisable ( Spi_HWUnitType HWUnit,
uint32 intFlags )

This function Disable Under/Overflow Interupts of the hardware unit and returns the status.

*  Service name        : Spi_dataOverflowUnderflowIntrDisable
*  Mode                : Supervisor Mode (Privileged Mode)
*  Sync/Async          : Synchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : HWUnit - SPI Hardware microcontroller peripheral
*                        unit ID. If this is invalid, then the API will
*                        return E_NOT_OK.
*                      : intFlags - Mask value of MCSPI_IRQSTATUS register
*  Return value        : Std_ReturnType
*                        E_OK: Interupt Disabled
*                        E_NOT_OK: Interupt Disable failed
*
*  

◆ Spi_dataOverflowUnderflowIntrGetStatus()

Mcspi_IrqStatusType Spi_dataOverflowUnderflowIntrGetStatus ( Spi_HWUnitType HWUnit,
uint32 intFlags )

This function status Under/Overflow Interupts of the hardware unit and returns the status.

*  Service name        : Spi_dataOverflowUnderflowIntrGetStatus
*  Mode                : Supervisor Mode (Privileged Mode)
*  Sync/Async          : Synchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : HWUnit - SPI Hardware microcontroller peripheral
*                        unit ID. If this is invalid, then the API will
*                        return E_NOT_OK.
*                        intFlags - Mask value of MCSPI_IRQSTATUS register
*  Return value        : Mcspi_IrqStatusType
*                        SPI_NO_EVENT: No underflow event
*                        SPI_EVENT_PENDING: Underflow Event
*                        SPI_STATUS_READ_FAIL: Status read fail
*  

◆ Spi_dataOverflowUnderflowIntrStatusClear()

Std_ReturnType Spi_dataOverflowUnderflowIntrStatusClear ( Spi_HWUnitType HWUnit,
uint32 intFlags )

This function status clear Under/Overflow Interupts of the hardware unit and returns the status.

*  Service name        : Spi_dataOverflowUnderflowIntrStatusClear
*  Mode                : Supervisor Mode (Privileged Mode)
*  Sync/Async          : Synchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : HWUnit - SPI Hardware microcontroller peripheral
*                        unit ID. If this is invalid, then the API will
*                        return E_NOT_OK.
*                        intFlags - Mask value of MCSPI_IRQSTATUS register
*  Return value        : Std_ReturnType
*                        E_OK: Interuptstatus cleares
*                        E_NOT_OK: Interupt status clear failed
*
*  

◆ SpiApp_wbInvCache()

void SpiApp_wbInvCache ( uint8 * buf,
uint16 len )
extern

Cache write-back invalidate function.

◆ SpiApp_wbCache()

void SpiApp_wbCache ( uint8 * buf,
uint16 len )
extern

Cache write-back function.

◆ SpiApp_invCache()

void SpiApp_invCache ( uint8 * buf,
uint16 len )
extern

Cache invalidate function.

◆ Spi_IrqUnitMcuMcspi0TxRx()

void Spi_IrqUnitMcuMcspi0TxRx ( void )

SPI Hwunit ISR.

SPI MCU_MCSPI0 ISR

◆ Spi_IrqUnitMcuMcspi1TxRx()

void Spi_IrqUnitMcuMcspi1TxRx ( void )

SPI MCU_MCSPI1 ISR.

◆ Spi_IrqUnitMcuMcspi2TxRx()

void Spi_IrqUnitMcuMcspi2TxRx ( void )

SPI MCU_MCSPI2 ISR.

◆ Spi_IrqUnitMcspi0TxRx()

void Spi_IrqUnitMcspi0TxRx ( void )

SPI MCSPI0 ISR.

◆ Spi_IrqUnitMcspi1TxRx()

void Spi_IrqUnitMcspi1TxRx ( void )

SPI MCSPI1 ISR.

◆ Spi_IrqUnitMcspi2TxRx()

void Spi_IrqUnitMcspi2TxRx ( void )

SPI MCSPI2 ISR.

◆ Spi_IrqUnitMcspi3TxRx()

void Spi_IrqUnitMcspi3TxRx ( void )

SPI MCSPI3 ISR.

◆ Spi_IrqUnitMcspi4TxRx()

void Spi_IrqUnitMcspi4TxRx ( void )

SPI MCSPI4 ISR.

Variable Documentation

◆ channelBufType

uint8 Spi_ChannelConfigType::channelBufType

Buffer Type IB/EB

◆ dataWidth

uint8 Spi_ChannelConfigType::dataWidth

Width of clock frame in bits. In case of McSPI, valid values are from 1 to 32 bits.

◆ defaultTxData

uint32 Spi_ChannelConfigType::defaultTxData

Default transmit value when TX buffer is NULL

◆ maxBufLength

Spi_NumberOfDataType Spi_ChannelConfigType::maxBufLength

Max data length for external or internal buffer in SPI words. In case of internal buffers, this represents the number of words to copy from application buffer to internal buffer in case of Spi_WriteIB() API or from internal buffer to application buffer in case of Spi_ReadIB(). The value of this should be less than or equal to the SPI configuration SPI_IB_MAX_LENGTH as this macro is is used for buffer allocation.

◆ transferType

Spi_TransferType Spi_ChannelConfigType::transferType

Start with MSB or LSB. Only MSB is supported.

◆ csEnable

uint16 Spi_McspiExternalDeviceConfigType::csEnable

Chip select functionality on/off

◆ csMode

Spi_CsModeType Spi_McspiExternalDeviceConfigType::csMode

Select single or continuous mode Note: Applicable only for McSPI;

◆ csPolarity

Spi_LevelType Spi_McspiExternalDeviceConfigType::csPolarity

Chip select pin polarity high or low

◆ csIdleTime

Spi_DataDelayType Spi_McspiExternalDeviceConfigType::csIdleTime

CS idle time (Timing between clock and chip select) if single mode is chosen. Values in case of McSPI McSPI 0x00 - 0.5 clock cycles 0x01 - 1.5 clock cycles 0x02 - 2.5 clock cycles 0x03 - 3.5 clock cycles

◆ clkDivider

uint32 Spi_McspiExternalDeviceConfigType::clkDivider

Clock divider. This is used to derive the required baudrate from the McSPI functional clock. This value should be 1 less than the actual divider value. So a value of 0 means the divider is 1.

Maximum allowed value of divider is 4095(12 bit register field)

◆ clkMode

Spi_ClkMode Spi_McspiExternalDeviceConfigType::clkMode

Mode 0 = {0=CPOL,0=CPHA}; Mode 1={0,1}; Mode 2={1,0} Mode 3={1,1}

◆ txRxMode

Spi_TxRxMode Spi_McspiExternalDeviceConfigType::txRxMode

TX and RX mode

◆ startBitEnable

uint16 Spi_McspiExternalDeviceConfigType::startBitEnable

Start bit D/CX added before SPI transfer. Polarity is defined by start bit level (below).

◆ startBitLevel

Spi_LevelType Spi_McspiExternalDeviceConfigType::startBitLevel

Start-bit polarity used when startBitEnable is TRUE.

◆ receptionLineEnable

Spi_DataLineReceiveType Spi_McspiExternalDeviceConfigType::receptionLineEnable

Defines the data lines selected for reception.

◆ transmissionLineEnable

Spi_DataLineTransmitType Spi_McspiExternalDeviceConfigType::transmissionLineEnable

Defines the data lines selected for transmission.

◆ mcspi

Spi_McspiExternalDeviceConfigType Spi_ExternalDeviceConfigType::mcspi

MCSPI HW specific external device config. Should be populated only if hwUnitId is MCSPI

◆ jobPriority

Spi_JobPriorityType Spi_JobConfigType::jobPriority

Job priority

◆ hwUnitId [1/2]

Spi_HWUnitType Spi_JobConfigType::hwUnitId

HWUnit associated with this job

◆ Spi_JobEndNotification

Spi_JobEndNotifyType Spi_JobConfigType::Spi_JobEndNotification

Job end notification callback fxn pointer

◆ channelPerJob

uint32 Spi_JobConfigType::channelPerJob

Number of channels for this job. Should not be more than SPI_MAX_CHANNELS_PER_JOB

◆ channelList

Spi_ChannelType Spi_JobConfigType::channelList[SPI_MAX_CHANNELS_PER_JOB]

Channel index list

◆ seqInterruptible

uint8 Spi_SeqConfigType::seqInterruptible

Sequence interruptible or not (TRUE/FALSE)

◆ Spi_SequenceEndNotification

Spi_SeqEndNotifyType Spi_SeqConfigType::Spi_SequenceEndNotification

Sequence end notification callback fxn pointer

◆ jobPerSeq

uint32 Spi_SeqConfigType::jobPerSeq

Number of jobs for this sequence. Should not be more than SPI_MAX_JOBS_PER_SEQ

◆ jobList

Spi_JobType Spi_SeqConfigType::jobList[SPI_MAX_JOBS_PER_SEQ]

Job index list

◆ hwUnitId [2/2]

Spi_HWUnitType Spi_HwUnitConfigType::hwUnitId

SPI HW unit to use

◆ enabledmaMode

boolean Spi_HwUnitConfigType::enabledmaMode

Enable SPI DMA Support per instance

◆ dmaTxChIntrNum

uint32 Spi_HwUnitConfigType::dmaTxChIntrNum

DMA TX channel interrupt number

◆ dmaRxChIntrNum

uint32 Spi_HwUnitConfigType::dmaRxChIntrNum

DMA RX channel interrupt number

◆ maxChannels

uint8 Spi_ConfigType::maxChannels

Maximum number of channels. Should not be more than SPI_MAX_CHANNELS

◆ maxJobs

uint8 Spi_ConfigType::maxJobs

Maximum number of jobs Should not be more than SPI_MAX_JOBS

◆ maxSeq

uint8 Spi_ConfigType::maxSeq

Maximum number of sequences Should not be more than SPI_MAX_SEQ

◆ maxHwUnit

uint8 Spi_ConfigType::maxHwUnit

Maximum number of HW unit Should not be more than SPI_MAX_HW_UNIT

◆ maxExtDevCfg

uint8 Spi_ConfigType::maxExtDevCfg

Maximum number of external device configurations Should not be more than SPI_MAX_EXT_DEV

◆ udmaInstId

uint32 Spi_ConfigType::udmaInstId

UDMA Instance Id. Based on core in which the SpiDriver is running Udma Instance should be chosen

  • UDMA_INST_ID_MCU_0 for cores in MCU domain
  • UDMA_INST_ID_MAIN_0 for cores in Main domain

◆ cacheWbInv

Spi_CacheWbInv Spi_ConfigType::cacheWbInv

Cache write-back invalidate function

◆ cacheWb

Spi_CacheWb Spi_ConfigType::cacheWb

Cache write-back function

◆ cacheInv

Spi_CacheInv Spi_ConfigType::cacheInv

Cache invalidate function

◆ channelCfg

Spi_ChannelConfigType Spi_ConfigType::channelCfg[SPI_MAX_CHANNELS]

Channel configurations

◆ jobCfg

Spi_JobConfigType Spi_ConfigType::jobCfg[SPI_MAX_JOBS]

Job configurations

◆ seqCfg

Spi_SeqConfigType Spi_ConfigType::seqCfg[SPI_MAX_SEQ]

Sequence configurations

◆ hwUnitCfg

Spi_HwUnitConfigType Spi_ConfigType::hwUnitCfg[SPI_MAX_HW_UNIT]

HW Unit configurations

◆ extDevCfg

Spi_ExternalDeviceConfigType Spi_ConfigType::extDevCfg[SPI_MAX_EXT_DEV]

External HW device config

◆ channelId

Spi_ChannelType Spi_ChannelConfigType_PC::channelId

Channel ID

◆ jobId

Spi_JobType Spi_JobConfigType_PC::jobId

Job ID

◆ csPin

Spi_CsPinType Spi_JobConfigType_PC::csPin

Chip select pin to use

◆ externalDeviceCfgId

uint8 Spi_JobConfigType_PC::externalDeviceCfgId

index into SpiConfig.extDevCfg[] indicating the devCfg associated with the job

◆ seqId

Spi_SequenceType Spi_SeqConfigType_PC::seqId

Sequence ID

◆ mcspiHlRev

uint32 Spi_RegisterReadbackType::mcspiHlRev

IP revision identifier

◆ mcspiHlHwInfo

uint32 Spi_RegisterReadbackType::mcspiHlHwInfo

Information about the IP module's hardware configuration

◆ mcspiHlSysConfig

uint32 Spi_RegisterReadbackType::mcspiHlSysConfig

Clock management configuration

◆ mcspiRev

uint32 Spi_RegisterReadbackType::mcspiRev

IP revision number

◆ mcspiSysStatus

uint32 Spi_RegisterReadbackType::mcspiSysStatus

IP status information

◆ mcspiSyst

uint32 Spi_RegisterReadbackType::mcspiSyst

System config

◆ mcspiModulctrl

uint32 Spi_RegisterReadbackType::mcspiModulctrl

module ctrl register MCSPI_MODULCTRL

◆ mcspiSysConfig

uint32 Spi_RegisterReadbackType::mcspiSysConfig

sysconfig register MCSPI_SYSCONFIG

◆ mcspiCh0config

uint32 Spi_RegisterReadbackType::mcspiCh0config

◆ mcspiCh1config

uint32 Spi_RegisterReadbackType::mcspiCh1config

◆ mcspiCh2config

uint32 Spi_RegisterReadbackType::mcspiCh2config

◆ mcspiCh3config

uint32 Spi_RegisterReadbackType::mcspiCh3config

module Channel config Register MCSPI_CHCONF_0/1/2/3

◆ mcspiIrqenable

uint32 Spi_RegisterReadbackType::mcspiIrqenable

Irqenable MCSPI_IRQENABLE

◆ Spi_HwUnitBaseAddr

const uint32 Spi_HwUnitBaseAddr[SPI_HW_UNIT_CNT]
extern

◆ SpiDriver

const struct Spi_ConfigType_s SpiDriver
extern

SPI Configuration struct declaration.