This module contains APIs to program and use the MIBSPI module. The APIs can be used by other drivers to get access to MIBSPI and also by application to initiate data transfer operation.
|
| MIBSPI Feature defines |
| MIBSPI_FEATURE_* macros indicate presence of a particular features in SPI instance on the given SoC. Used internally in driver.
|
|
|
enum | MIBSPI_EdmaCBFlag_e { MIBSPI_NONE_EDMA_CALLBACK_OCCURED = 0x0U,
MIBSPI_TX_EDMA_CALLBACK_OCCURED = 0x1U,
MIBSPI_RX_EDMA_CALLBACK_OCCURED = 0x2U
} |
| Enum used to track status of EDMA callbacks internally in driver. More...
|
|
enum | MIBSPI_XferErr_e { MIBSPI_XFER_ERR_NONE,
MIBSPI_XFER_ERR_RXOR,
MIBSPI_XFER_ERR_BE,
MIBSPI_XFER_ERR_TIMEOUT
} |
| SPI_v3 transfer error code. More...
|
|
enum | MIBSPI_Status {
MIBSPI_TRANSFER_COMPLETED = 0,
MIBSPI_TRANSFER_STARTED,
MIBSPI_TRANSFER_CANCELED,
MIBSPI_TRANSFER_FAILED,
MIBSPI_TRANSFER_CSN_DEASSERT,
MIBSPI_TRANSFER_TIMEOUT
} |
| Status codes that are set by the SPI driver. More...
|
|
enum | MIBSPI_PinMode { MIBSPI_PINMODE_3PIN = 0,
MIBSPI_PINMODE_4PIN_CS = 1
} |
| Definitions for MIBSPI Pins Operation Mode. More...
|
|
enum | MIBSPI_DataShiftFmt { MIBSPI_MSB_FIRST = 0,
MIBSPI_LSB_FIRST = 1
} |
| Definitions for MIBSPI Data shift format. More...
|
|
enum | MIBSPI_LoopBackType { MIBSPI_LOOPBK_DIGITAL = 0,
MIBSPI_LOOPBK_ANALOG = 1,
MIBSPI_LOOPBK_NONE = 2
} |
| Definitions for MIBSPI loopback modes. More...
|
|
enum | MIBSPI_Mode { MIBSPI_CONTROLLER = 0,
MIBSPI_PERIPHERAL = 1
} |
| Definitions for various SPI modes of operation. More...
|
|
enum | MIBSPI_FrameFormat { MIBSPI_POL0_PHA0 = 0,
MIBSPI_POL0_PHA1 = 1,
MIBSPI_POL1_PHA0 = 2,
MIBSPI_POL1_PHA1 = 3
} |
| Definitions for various SPI data frame formats. More...
|
|
enum | MIBSPI_TransferMode { MIBSPI_MODE_BLOCKING,
MIBSPI_MODE_CALLBACK
} |
| MIBSPI transfer mode determines the whether the MIBSPI controller operates synchronously or asynchronously. In MIBSPI_MODE_BLOCKING mode MIBSPI_transfer() blocks code execution until the MIBSPI transaction has completed. In MIBSPI_MODE_CALLBACK MIBSPI_transfer() does not block code execution and instead calls a MIBSPI_CallbackFxn callback function when the transaction has completed. More...
|
|
enum | MIBSPI_DmaCtrlChType { MIBSPI_DMACTRL_CH_TX,
MIBSPI_DMACTRL_CH_RX,
MIBSPI_DMACTRL_CH_BOTH
} |
| Definitions for DMA controller channel type. More...
|
|
◆ MIBSPI_RAM_BUFFER_MODE
#define MIBSPI_RAM_BUFFER_MODE (7U) |
◆ MIBSPI_PERIPHERALMODE_TRANS_GROUP
#define MIBSPI_PERIPHERALMODE_TRANS_GROUP (0U) |
Transfer group used in peripheral mode.
◆ MIBSPI_INT_LEVEL
#define MIBSPI_INT_LEVEL (1U) |
◆ MIBSPI_RAM_MAX_ELEM
#define MIBSPI_RAM_MAX_ELEM (128U) |
Maximum element in MibSPI RAM. For 8bit data size, the maximum transfer size is 64 bytes For 16bit data size, the maximum transfer size is 128 bytes.
◆ MIBSPI_PERIPHERAL_MAX
#define MIBSPI_PERIPHERAL_MAX (3U) |
Max number of peripherals supported when MibSPI is configured as controller.
◆ MIBSPI_DMA_REQLINE_MAX
#define MIBSPI_DMA_REQLINE_MAX (3U) |
Max number of DMA REQ lines supported by MIBSPI.
◆ MIBSPI_MAX_CS
Maximum CS supported for the device.
◆ MIBSPI_NUM_TRANS_GROUP
#define MIBSPI_NUM_TRANS_GROUP (8U) |
Max number of transport group.
◆ MIBSPI_NUM_DMA_GROUP
#define MIBSPI_NUM_DMA_GROUP (8U) |
◆ MIBSPI_CS_NONE
#define MIBSPI_CS_NONE (0xFFU) |
CS configuration value when none of the CS is activated.
◆ MIBSPI_Handle
◆ MIBSPI_CallbackFxn
The definition of a callback function used by the SPI driver when used in MIBSPI_MODE_CALLBACK.
- Parameters
-
handle | MIBSPI_Handle |
transaction* | MIBSPI_Transaction* |
◆ MIBSPI_EdmaCBFlag_e
Enum used to track status of EDMA callbacks internally in driver.
Enumerator |
---|
MIBSPI_NONE_EDMA_CALLBACK_OCCURED | Flag to indicate that Transmission EDMA callback has occured
|
MIBSPI_TX_EDMA_CALLBACK_OCCURED | Flag to indicate that Transmission EDMA callback has occured
|
MIBSPI_RX_EDMA_CALLBACK_OCCURED | Flag to indicate that Reception EDMA callback has occured
|
◆ MIBSPI_XferErr_e
SPI_v3 transfer error code.
Enumerator |
---|
MIBSPI_XFER_ERR_NONE | |
MIBSPI_XFER_ERR_RXOR | |
MIBSPI_XFER_ERR_BE | |
MIBSPI_XFER_ERR_TIMEOUT | |
◆ MIBSPI_Status
Status codes that are set by the SPI driver.
Enumerator |
---|
MIBSPI_TRANSFER_COMPLETED | |
MIBSPI_TRANSFER_STARTED | |
MIBSPI_TRANSFER_CANCELED | |
MIBSPI_TRANSFER_FAILED | |
MIBSPI_TRANSFER_CSN_DEASSERT | |
MIBSPI_TRANSFER_TIMEOUT | |
◆ MIBSPI_PinMode
Definitions for MIBSPI Pins Operation Mode.
Enumerator |
---|
MIBSPI_PINMODE_3PIN | 3 Pin operation Mode
|
MIBSPI_PINMODE_4PIN_CS | 4 Pin operation Mode with CS signal
|
◆ MIBSPI_DataShiftFmt
Definitions for MIBSPI Data shift format.
Enumerator |
---|
MIBSPI_MSB_FIRST | MSB shift out first
|
MIBSPI_LSB_FIRST | LSB shift out first
|
◆ MIBSPI_LoopBackType
Definitions for MIBSPI loopback modes.
Enumerator |
---|
MIBSPI_LOOPBK_DIGITAL | MIBSPI digital loopback mode
|
MIBSPI_LOOPBK_ANALOG | MIBSPI analog loopback mode
|
MIBSPI_LOOPBK_NONE | MIBSPI loopback disable
|
◆ MIBSPI_Mode
Definitions for various SPI modes of operation.
Enumerator |
---|
MIBSPI_CONTROLLER | SPI in controller mode
|
MIBSPI_PERIPHERAL | SPI in peripheral mode
|
◆ MIBSPI_FrameFormat
Definitions for various SPI data frame formats.
Enumerator |
---|
MIBSPI_POL0_PHA0 | SPI mode Polarity 0 Phase 0
|
MIBSPI_POL0_PHA1 | SPI mode Polarity 0 Phase 1
|
MIBSPI_POL1_PHA0 | SPI mode Polarity 1 Phase 0
|
MIBSPI_POL1_PHA1 | SPI mode Polarity 1 Phase 1
|
◆ MIBSPI_TransferMode
◆ MIBSPI_DmaCtrlChType
Definitions for DMA controller channel type.
Enumerator |
---|
MIBSPI_DMACTRL_CH_TX | Configure DMA channel as transmit only
|
MIBSPI_DMACTRL_CH_RX | Configure DMA channel as receive only
|
MIBSPI_DMACTRL_CH_BOTH | Configure DMA channel as transmit and receive
|
◆ MIBSPI_init()
void MIBSPI_init |
( |
void |
| ) |
|
This function initializes the MIBSPI module.
◆ MIBSPI_deinit()
void MIBSPI_deinit |
( |
void |
| ) |
|
This function de-initializes the MIBSPI module.
◆ MIBSPI_open()
This function opens a given instance of the MIBSPI peripheral.
- Precondition
- MIBSPI controller has been initialized using MIBSPI_init()
- Parameters
-
index | Id of the SPI instance. |
params | Pointer to an parameter block, if NULL it will use default values. |
- Returns
- A MIBSPI_Handle on success or a NULL on an error or if it has been opened already.
- See also
- MIBSPI_init()
-
MIBSPI_close()
-
MIBSPI_Params_init()
◆ MIBSPI_close()
Function to close a instance of a MIBSPI peripheral specified by the MIBSPI handle.
- Precondition
- MIBSPI_open() has to be called first.
- Parameters
-
- See also
- MIBSPI_open()
◆ MIBSPI_transfer()
Function to perform MIBSPI transactions on a instance of a MIBSPI peripheral specified by the MIBSPI handle for a specific peripheral.
If the MIBSPI is in MIBSPI_CONTROLLER mode, it will immediately start the transaction. If the MIBSPI is in MIBSPI_PERIPHERAL mode, it prepares itself for a transaction with a SPI controller.
In MIBSPI_MODE_BLOCKING, MIBSPI_transfer will block task execution until the transaction has completed.
In MIBSPI_MODE_CALLBACK, MIBSPI_transfer() does not block task execution and calls a MIBSPI_CallbackFxn. This makes the MIBSPI_tranfer() safe to be used within a Task, Swi, or Hwi context. The MIBSPI_Transaction structure must stay persistent until the MIBSPI_transfer function has completed!
- Parameters
-
- Returns
- true if started successfully; else false
- See also
- MIBSPI_open
-
MIBSPI_transferCancel
◆ MIBSPI_transferCancel()
◆ MIBSPI_enableLoopback()
This function enables the Loopback mode for self test. Loopback is SPI controller only feature.
- Parameters
-
- Returns
- On success returns SystemP_SUCCESS. Negative values indicate unsuccessful operations.
◆ MIBSPI_disableLoopback()
This function disable the Loopback mode.
- Parameters
-
- Returns
- On success returns SystemP_SUCCESS. Negative values indicate unsuccessful operations.
◆ MIBSPI_setClockPhasePolarity()
int32_t MIBSPI_setClockPhasePolarity |
( |
MIBSPI_Handle |
handle, |
|
|
uint8_t |
clockFmt |
|
) |
| |
This function sets the Polarity and phase for MibSpi as requested.
- Parameters
-
[in] | handle | MIBSPI_Handle MibSpiSPI |
[in] | clockFmt | MIBSPI functional mode (clock/polarity) |
- Returns
- On success returns SystemP_SUCCESS. Negative values indicate unsuccessful operations.
◆ MIBSPI_getDrvStats()
Get SPI driver internal stats.
- Parameters
-
[in] | handle | SPI device handle |
[in] | ptrStats | pointer to SPI driver stats structure |
- Returns
- On success returns SystemP_SUCCESS. Negative values indicate unsuccessful operations.
- See also
- MIBSPI_open
-
MIBSPI_transfer
◆ MIBSPI_dmaDoneCb()
Function invoked by the SoC DMA implementation to the driver on DMA transfer completion.
- Parameters
-
mibspiHandle | A MIBSPI_Handle |
◆ MIBSPI_Params_init()
◆ gMibspiConfig
Externally defined driver configuration array.
◆ gMibspiConfigNum
uint32_t gMibspiConfigNum |
|
extern |
Externally defined driver configuration array size.