The SPI Driver MCAL provides low level access to SPI peripheral present on Device.
The SPI Driver implements a standardized interface specified in the AUTOSAR_SWS_SPIHandlerDriver document.
Limitations of the driver:
- A job could belong to several sequences but can't be active at the same time i.e. a job queued in a sequence cannot be queued via another sequence. This is a design limitation to reduce driver complexity.
- A channel could belong to several sequences or jobs but can't be active at the same time i.e. a channel in a job in a sequence cannot be part of another active job or sequeuence. This is a design limitation to reduce driver complexity.
Non-Interruptible sequences applies only within a HW unit. If a sequence is started, another high priority job belonging to another sequence cannot interrupt the job belonging to the same hardware unit. But the job can be scheduled ahead of another pending job of the started sequence if it belongs to another HW queue. This is illustrated in below example
Example of non-interruptible sequence across HW units: SEQ1 - JOB1 (HW1, P0) SEQ2 - JOB2 (HW2, P0), JOB3 (HW1, P0) SEQ3 - JOB4 (HW2, P3)
Consider the above sequence of calls happening back to back at time T1. The job schedule for this case will be
Time T1 - JOB1 and JOB2 (Since different HW)
Time T2 - JOB4 (could interrupts SEQ2 JOB3 if JOB1
takes more time that JOB2)
Time T3 - JOB3
- See also
- SPI Configuration
-
Defines Interrupt Handler for all SPI instances
-
Defines variables that could be used to driver
|
#define | SPI_MCSPI_FCLK (48000000U) |
| MCSPI functional clock input in Hz. This clock is used to generate the serial clock output after the divider. More...
|
|
|
#define | SPI_IB (0U) |
| Buffer definitions IB - internal buffers. More...
|
|
#define | SPI_EB (1U) |
| Buffer definitions EB - external buffers. Only this is supported. More...
|
|
#define | SPI_IB_EB (2U) |
| Buffer definitions IB/EB - internal/external buffers. More...
|
|
|
The Config Ids used for different SPI Configuration builds
|
#define | SPI_CFG_ID_0 (0x01U) |
| Config 0 (All configurations ON), Scaleability level 2) More...
|
|
#define | SPI_CFG_ID_1 (0x02U) |
| Config 1 (All configurations OFF). SPI_CFG_ID_1 is used only for compile check. More...
|
|
#define | SPI_CFG_ID_2 (0x04U) |
| Config 2 (All configurations ON except DET OFF) More...
|
|
#define | SPI_CFG_ID_3 (0x08U) |
| Config 3 (Configurator auto generated file) More...
|
|
#define | SPI_CFG_ID_4 (0x10U) |
| Config 4 (Config is used only by Unit Test, Scaleability level 0) More...
|
|
#define | SPI_CFG_ID_5 (0x20U) |
| Config 5 (Config is used only by Unit Test for DMA. More...
|
|
#define | SPI_CFG_ID_6 (0x40U) |
| Config 6 (Config is used only by Unit Test for DMA. More...
|
|
#define | SPI_CFG_ID_7 (0x80U) |
| Config 7 (Performance testing only, level 2, asynch, no DMA) More...
|
|
◆ SPI_SW_MAJOR_VERSION
#define SPI_SW_MAJOR_VERSION (9U) |
Driver Implementation Major Version.
◆ SPI_SW_MINOR_VERSION
#define SPI_SW_MINOR_VERSION (0U) |
Driver Implementation Minor Version.
◆ SPI_SW_PATCH_VERSION
#define SPI_SW_PATCH_VERSION (1U) |
Driver Implementation Patch Version.
◆ SPI_AR_RELEASE_MAJOR_VERSION
#define SPI_AR_RELEASE_MAJOR_VERSION (4U) |
AUTOSAR Major version specification implemented by SPI Driver.
◆ SPI_AR_RELEASE_MINOR_VERSION
#define SPI_AR_RELEASE_MINOR_VERSION (3U) |
AUTOSAR Minor version specification implemented by SPI Driver.
◆ SPI_AR_RELEASE_REVISION_VERSION
#define SPI_AR_RELEASE_REVISION_VERSION (1U) |
AUTOSAR Patch version specification implemented by SPI Driver.
◆ SPI_VENDOR_ID
#define SPI_VENDOR_ID ((uint16) 44U) |
Texas Instruments Vendor ID.
◆ SPI_MODULE_ID
#define SPI_MODULE_ID ((uint16) 83U) |
◆ SPI_INSTANCE_ID
#define SPI_INSTANCE_ID ((uint8) 0U) |
◆ SPI_IB
Buffer definitions IB - internal buffers.
◆ SPI_EB
Buffer definitions EB - external buffers. Only this is supported.
◆ SPI_IB_EB
Buffer definitions IB/EB - internal/external buffers.
◆ SPI_E_PARAM_CHANNEL
#define SPI_E_PARAM_CHANNEL ((uint8) 0x0AU) |
API service called with wrong parameter.
◆ SPI_E_PARAM_JOB
#define SPI_E_PARAM_JOB ((uint8) 0x0BU) |
API service called with wrong parameter.
◆ SPI_E_PARAM_SEQ
#define SPI_E_PARAM_SEQ ((uint8) 0x0CU) |
API service called with wrong parameter.
◆ SPI_E_PARAM_LENGTH
#define SPI_E_PARAM_LENGTH ((uint8) 0x0DU) |
API service called with wrong parameter.
◆ SPI_E_PARAM_UNIT
#define SPI_E_PARAM_UNIT ((uint8) 0x0EU) |
API service called with wrong parameter.
◆ SPI_E_PARAM_POINTER
#define SPI_E_PARAM_POINTER ((uint8) 0x10U) |
APIs called with a Null Pointer.
◆ SPI_E_UNINIT
#define SPI_E_UNINIT ((uint8) 0x1AU) |
API service used without module initiali-zation.
◆ SPI_E_SEQ_PENDING
#define SPI_E_SEQ_PENDING ((uint8) 0x2AU) |
Services called in a wrong sequence.
◆ SPI_E_SEQ_IN_PROCESS
#define SPI_E_SEQ_IN_PROCESS ((uint8) 0x3AU) |
Synchronous transmission service called at wrong time.
◆ SPI_E_ALREADY_INITIALIZED
#define SPI_E_ALREADY_INITIALIZED ((uint8) 0x4AU) |
API Spi_Init service called while the SPI driver has already been initialized.
◆ SPI_E_SEQUENCE_NOT_OK
#define SPI_E_SEQUENCE_NOT_OK ((uint8) 0x5AU) |
Sequence did not complete successfully.
◆ SPI_SID_INIT
#define SPI_SID_INIT ((uint8) 0x00U) |
◆ SPI_SID_DEINIT
#define SPI_SID_DEINIT ((uint8) 0x01U) |
◆ SPI_SID_WRITE_IB
#define SPI_SID_WRITE_IB ((uint8) 0x02U) |
◆ SPI_SID_ASYNC_TRANSMIT
#define SPI_SID_ASYNC_TRANSMIT ((uint8) 0x03U) |
◆ SPI_SID_READ_IB
#define SPI_SID_READ_IB ((uint8) 0x04U) |
◆ SPI_SID_SETUP_EB
#define SPI_SID_SETUP_EB ((uint8) 0x05U) |
Spi_SetupEB() API Service ID.
◆ SPI_SID_GET_STATUS
#define SPI_SID_GET_STATUS ((uint8) 0x06U) |
◆ SPI_SID_GET_JOB_RESULT
#define SPI_SID_GET_JOB_RESULT ((uint8) 0x07U) |
◆ SPI_SID_GET_SEQ_RESULT
#define SPI_SID_GET_SEQ_RESULT ((uint8) 0x08U) |
◆ SPI_SID_GET_VERSION_INFO
#define SPI_SID_GET_VERSION_INFO ((uint8) 0x09U) |
◆ SPI_SID_SYNC_TRANSMIT
#define SPI_SID_SYNC_TRANSMIT ((uint8) 0x0AU) |
◆ SPI_SID_GET_HW_UNIT_STATUS
#define SPI_SID_GET_HW_UNIT_STATUS ((uint8) 0x0BU) |
◆ SPI_SID_CANCEL
#define SPI_SID_CANCEL ((uint8) 0x0CU) |
◆ SPI_SID_SET_ASYNC_MODE
#define SPI_SID_SET_ASYNC_MODE ((uint8) 0x0DU) |
◆ SPI_SID_MAINFUNCTION_HANDLING
#define SPI_SID_MAINFUNCTION_HANDLING ((uint8) 0x10U) |
◆ SPI_MCSPI_FCLK
#define SPI_MCSPI_FCLK (48000000U) |
MCSPI functional clock input in Hz. This clock is used to generate the serial clock output after the divider.
Note: This is given here for reference and can't be changed.
◆ SPI_CFG_ID_0
#define SPI_CFG_ID_0 (0x01U) |
Config 0 (All configurations ON), Scaleability level 2)
◆ SPI_CFG_ID_1
#define SPI_CFG_ID_1 (0x02U) |
Config 1 (All configurations OFF). SPI_CFG_ID_1 is used only for compile check.
◆ SPI_CFG_ID_2
#define SPI_CFG_ID_2 (0x04U) |
Config 2 (All configurations ON except DET OFF)
◆ SPI_CFG_ID_3
#define SPI_CFG_ID_3 (0x08U) |
Config 3 (Configurator auto generated file)
◆ SPI_CFG_ID_4
#define SPI_CFG_ID_4 (0x10U) |
Config 4 (Config is used only by Unit Test, Scaleability level 0)
◆ SPI_CFG_ID_5
#define SPI_CFG_ID_5 (0x20U) |
Config 5 (Config is used only by Unit Test for DMA.
◆ SPI_CFG_ID_6
#define SPI_CFG_ID_6 (0x40U) |
Config 6 (Config is used only by Unit Test for DMA.
◆ SPI_CFG_ID_7
#define SPI_CFG_ID_7 (0x80U) |
Config 7 (Performance testing only, level 2, asynch, no DMA)
◆ Spi_DataBufferType
Type of application data buffer elements.
◆ Spi_NumberOfDataType
Type for defining the number of data elements of the type Spi_DataBufferType to send and / or receive by Channel.
◆ Spi_ChannelType
Specifies the identification (ID) for a Channel.
◆ Spi_JobType
Specifies the identification (ID) for a Job.
◆ Spi_SequenceType
Specifies the identification (ID) for a sequence of jobs.
◆ Spi_HWUnitType
Specifies the identification (ID) for a SPI Hardware micro controller peripheral (unit)