MCSPI
The Multi Channel Serial Peripheral Interface (MCSPI) driver is a generic, full-duplex driver that transmits and receives data on the SPI bus. The SPI protocol defines the format of a data transfer over the SPI bus, but it leaves flow control, data formatting, and handshaking mechanisms to higher-level software layers.
Features Supported
Master and Slave mode of operation
Per transfer selection of different channels/chip select
Blocking and non-blocking (callback) transfers This example uses polling mode of operation.
DMA mode of operation
For low latency transfers, refer EXAMPLES_DRIVERS_MCSPI_PERFORMANCE_32BIT and EXAMPLES_DRIVERS_MCSPI_PERFORMANCE_8BIT example.
SysConfig Features
Note
It is strongly recommend to use SysConfig where it is available instead of using direct SW API calls. This will help simplify the SW application and also catch common mistakes early in the development cycle.
SysConfig can be used to configure below parameters apart from common configuration like Clock,MPU,RAT and others.
MCSPI module configuration parameters like Transmit/Receive mode,MISO, MOSI pin selection and others.
MCSPI channel configurations.
In the advanced configurations option you can configure initial delay for first transfer, transfer mode and timeout.
MCSPI instances and pin configurations.
Operation Mode selection - Polling, Interrupt or DMA
Based on above parameters, the SysConfig generated code does below as part of Drivers_open and Drivers_close functions
Set MCSPI instance parameter configuration.
Driver ISR registration if Interrupt Mode is enabled.
Features NOT Supported
Default TX data feature is not supported in DMA mode.
In DMA mode, FIFO is not enabled.
Constraint
Due to the design constraint maximum DMA PKTDMA_0 TX/RX channels each can be used is 3 per R5F core. So in case of MCSPI instance with DMA mode enabled can use atmost 3 CS in multi-master mode.
Usage Overview
API Sequence
To use the MCSPI driver to send data over the SPI bus, the application calls the following APIs:
#MCSPI_init(): Initialize the MCSPI driver.
#MCSPI_OpenParams_init(): Initialize a #MCSPI_OpenParams structure with default values. Then change the parameters from non-default values as needed.
#MCSPI_open(): Open an instance of the MCSPI driver, passing the initialized parameters, or NULL, and an index to the configuration to open (detailed later).
#MCSPI_chConfig(): Configure the required channels
#MCSPI_dmaChConfig(): Configure the required DMA channels(in DMA mode only)
#MCSPI_transfer(): Transmit/receive data. This function takes a #MCSPI_Transaction argument that describes the transfer that is requested. -#MCSPI_dmaClose(): De-initialize the DMA channels(in DMA mode only)
#MCSPI_close(): De-initialize the MCSPI instance.
#MCSPI_deinit(): De-Initialize the MCSPI driver.
Initializing the MCSPI Driver
#MCSPI_init() must be called before any other MCSPI APIs. This function iterates through the elements of the MCSPI_config[] array, calling the element’s device implementation MCSPI initialization function. Please note that initializing MCSPI driver is taken care by the SysConfig generated code.
Opening the MCSPI Driver
After initializing the MCSPI driver by calling #MCSPI_init(), the application can open a MCSPI instance by calling #MCSPI_open(). Please note that opening MCSPI driver is taken care by the SysConfig generated code. This function takes an index into the MCSPI_config[] array, and the MCSPI parameters data structure. The MCSPI instance is specified by the index of the SPI in MCSPI_config[]. Calling #MCSPI_open() a second time with the same index previously passed to #MCSPI_open() will result in an error. You can, though, re-use the index if the instance is closed via #MCSPI_close(). In DMA mode, #MCSPI_dmaChConfig() needs to be called after #MCSPI_open() to acquire and initialize DMA channels. This is also taken care by the SysConfig generated code.
If no #MCSPI_OpenParams structure is passed to MCSPI_open(), default values are used. If the open call is successful, it returns a non-NULL value.
MCSPI Transfer Mode
The MCSPI driver supports three transfer modes of operation: Interrupt, Polling and DMA Mode. In Interrupt and DMA mode, it again supports two modes: blocking and callback. The transfer mode is determined by the #MCSPI_OpenParams.transferMode parameter. The MCSPI driver defaults to blocking mode, if the application does not set it. Once a MCSPI driver is opened, the only way to change the operation mode is to close and re-open the MCSPI instance with the new transfer mode.
In blocking mode, a task’s code execution is blocked until a MCSPI transaction has completed or a timeout has occurred. This ensures that only one MCSPI transfer operates at a given time. Other tasks requesting MCSPI transfers while a transfer is currently taking place will receive a error return value. If a timeout occurs the transfer is canceled, the task is unblocked & will receive a error return value. The transaction count field will have the amount of frames which were transferred successfully before the timeout. In blocking mode, transfers cannot be performed in software or hardware ISR context.
In callback mode, a MCSPI transaction functions asynchronously, which means that it does not block code execution. After a MCSPI transaction has been completed, the MCSPI driver calls a user-provided hook function. Callback mode is supported in the execution context of tasks and hardware interrupt routines.
In multichannel mode connected to multiple external devices, the MCSPI exchanges data with one MCSPI device at a time and FIFO is enabled per each channel at a time.
MCSPI Frame Formats and Data Size
The MCSPI driver can configure the device’s MCSPI peripheral to transfer data in several MCSPI format options: MCSPI (with various polarity and phase settings). The frame format is set with #MCSPI_ChConfig.frameFormat.
The smallest single unit of data transmitted onto the MCSPI bus is called a MCSPI frame and is of size #MCSPI_Transaction.dataSize. A series of MCSPI frames transmitted/received on a MCSPI bus is referred to as a MCSPI transaction.
MCSPI Transactions
A MCSPI transaction consists of a series of MCSPI frames transmitted/received on a MCSPI bus. A MCSPI transaction is performed using #MCSPI_transfer(). #MCSPI_transfer() accepts a pointer to a #MCSPI_Transaction structure that dictates the quantity of data to be sent and received. The #MCSPI_Transaction.txBuf and #MCSPI_Transaction.rxBuf are both pointers to data buffers. If txBuf is NULL, the driver sends MCSPI frames with all data set to the default value specified in the hardware attributes. If rxBuf is NULL, the driver discards all MCSPI frames received. #MCSPI_transfer() of a MCSPI transaction is performed atomically.
Warning
The use of NULL as a sentinel txBuf or rxBuf value to determine whether the MCSPI transaction includes a tx or rx component implies that it is not possible to perform a transmit or receive transfer directly from/to a buffer with a base address of 0x00000000. To support this rare use-case, the application will have to manually copy the contents of location 0x00000000 to/from a temporary buffer before/after the tx/rx MCSPI transaction.
#MCSPI_Transaction.dataSize determines the element types of txBuf and rxBuf. If the dataSize is from 4 to 8 bits, the driver assumes the data buffers are of type uint8_t (unsigned char). If the dataSize is from 9 to 16 bits, the driver assumes the data buffers are of type uint16_t (unsigned short). If the dataSize is greater than 16 bits, the driver assumes the data buffers are uint32_t (unsigned long).
#MCSPI_Transaction.csDisable can be set to TRUE/FALSE to disable CS(chip select). If it is set to TRUE, CS is de-asseted automatically at the end of the transfer. If user wants to chain more transfers under one CS pulse, user needs to set it to FALSE for each transfer and for the last transfer, user needs to set to TRUE to de-assert CS. Generally this is useful when SPI needs to communicate with memory device where usually command/address is sent first and then the data will be sent.
The optional #MCSPI_Transaction.args variable can only be used when the MCSPI driver has been opened in callback mode. This variable is used to pass a user-defined value into the user-defined callback function.
#MCSPI_transfer() always performs full-duplex MCSPI transactions. This means the MCSPI simultaneously receives data as it transmits data. The application is responsible for formatting the data to be transmitted as well as determining whether the data received is meaningful. Specifics about MCSPI frame formatting and data sizes are provided in device-specific data sheets and technical reference manuals.
In case of MCSPI operating in #MCSPI_MS_MODE_SLAVE mode if Rx overflow or Tx underflow occurs, driver cancels the current transfer and return status MCSPI_TRANSFER_CANCELLED to the application. Application need to check the status and reinitiate transfers again.
Important Usage Guidelines
The MCSPI protocol does not account for a built-in handshaking mechanism and neither does this driver. Therefore, when operating in #MCSPI_MS_MODE_SLAVE mode, the application must provide such a mechanism to ensure that the MCSPI slave is ready for the MCSPI master. The MCSPI slave must call #MCSPI_transfer() before the master starts transmitting. Some example application mechanisms could include:
Timed delays on the MCSPI master to guarantee the MCSPI slave is ready for a MCSPI transaction.
A form of GPIO flow control from the slave to the MCSPI master to notify the master when ready.
Timeout
The MCSPI driver uses SystemP_WAIT_FOREVER (0xFFFFFFFFU) as the default timeout for blocking transfers.
Configurable Timeout
The transfer timeout is configurable per driver instance via the transferTimeout field in MCSPI_OpenParams, as shown below:
MCSPI_OpenParams openPrms;
MCSPI_OpenParams_init(&openPrms); /* default: openPrms.transferTimeout = SystemP_WAIT_FOREVER */
openPrms.transferTimeout = 5000; /* override: 5000 OS ticks */
handle = MCSPI_open(instance, &openPrms);
When to change: Set a finite timeout when the application must detect a stalled SPI slave or a missing clock signal, for example in a system that requires graceful error recovery instead of hanging indefinitely.
Note: This timeout applies to interrupt and DMA transfer modes. In polled mode, a fixed internal loop timeout (MCSPI_MAX_TIMEOUT_VALUE) is used and is not configurable by the application.
Non-Configurable Timeouts
The following operations always use SystemP_WAIT_FOREVER and cannot be overridden by the application:
Internal driver lock — A mutex protecting driver state, acquired at the start of every transfer. This waits forever if another transfer is already in progress on the same instance.
DMA Transfer Size Limitation (AM62x/AM62Ax/AM275x Series)
Overview
A discrepancy exists between the maximum transfer sizes supported by the Peripheral DMA (PDMA) hardware and the Data Movement Subsystem (DMSS) packet descriptors. While the hardware Transfer Request (TR) mechanism supports payloads up to 16 MB, the practical maximum DMA transfer size per single transaction is limited to 4,194,303 bytes (approximately 4 MB) due to software descriptor constraints.
Architectural Constraint Analysis
Hardware Capability (16 MB): The MCSPI PDMA operates in X-Y FIFO Mode Static TR configuration. The PSI-L (Packet Streaming Interface Link) data management utilizes a 24-bit Z-field to define the transfer count.
Field Range: Bits [23:0]
Theoretical Maximum: 2^24 - 1 = 16,777,215 bytes (approximately 16 MB)
Driver Implementation: Configured via udma_ch.c channel configuration
Descriptor Bottleneck (4 MB): The DMSS manages these transactions using the CPPI5 Host Packet Descriptor structure. Within Word 0 of this descriptor, the Packet Length (PKTLEN) field is constrained to a 22-bit width.
Field Range: Bits [21:0]
Practical Maximum: 2^22 - 1 = 4,194,303 bytes (approximately 4 MB)
Driver Implementation: Defined by the CPPI5 macro layer within csl_udmap_cppi5.h
Conclusion
Because all MCSPI DMA packet transactions must be wrapped by the CPPI5 Host Packet Descriptor, the 22-bit PKTLEN restriction overrides the 24-bit hardware capability. For data transfers exceeding the 4 MB limit, applications must split the transfer into multiple consecutive MCSPI transactions.
Example Usage
Include the below file to access the APIs
#include <drivers/mcspi.h>
Instance Open Example
int32_t status;
MCSPI_OpenParams spiParams;
uint32_t chCnt;
MCSPI_ChConfig *chCfg;
MCSPI_OpenParams_init(&spiParams); /* Initialize SPI parameters */
spiParams.transferMode = MCSPI_TRANSFER_MODE_BLOCKING;
gMcspiHandle = MCSPI_open(CONFIG_MCSPI0, &spiParams);
DebugP_assert(gMcspiHandle != NULL);
/* Channel configuration */
for(chCnt = 0U; chCnt < APP_MCSPI_NUM_CH; chCnt++)
{
chCfg = &gMcspiChConfig[chCnt];
/* Init to default value */
MCSPI_ChConfig_init(chCfg);
/* Override based on need */
chCfg->chNum = chCnt;
chCfg->bitRate = 2000000U;
status = MCSPI_chConfig(gMcspiHandle, chCfg);
DebugP_assert(status == SystemP_SUCCESS);
}
Instance Close Example
MCSPI_close(gMcspiHandle);
Blocking Transfer Example
int32_t transferOK;
MCSPI_Transaction spiTransaction;
uint8_t transmitBuffer[APP_MCSPI_MSGSIZE];
uint8_t receiveBuffer[APP_MCSPI_MSGSIZE];
/* Fill in transmitBuffer */
spiTransaction.channel = 0U;
spiTransaction.dataSize = 16U;
spiTransaction.csDisable = TRUE;
spiTransaction.count = APP_MCSPI_MSGSIZE;
spiTransaction.txBuf = (void *)transmitBuffer;
spiTransaction.rxBuf = (void *)receiveBuffer;
spiTransaction.args = NULL;
/* Initiate transfer */
transferOK = MCSPI_transfer(gMcspiHandle, &spiTransaction);
if((SystemP_SUCCESS != transferOK) ||
(MCSPI_TRANSFER_COMPLETED != spiTransaction.status))
{
/* MCSPI transfer failed!! */
DebugP_assert(FALSE);
}
Chain Transfer Example Blocking Mode
int32_t transferOK;
MCSPI_Transaction spiTransaction;
uint8_t transmitBuffer[APP_MCSPI_MSGSIZE];
uint8_t receiveBuffer[APP_MCSPI_MSGSIZE];
/* Fill in transmitBuffer with commands */
spiTransaction.channel = 0U;
spiTransaction.dataSize = 8U;
spiTransaction.csDisable = FALSE;
spiTransaction.count = APP_MCSPI_MSGSIZE;
spiTransaction.txBuf = (void *)transmitBuffer;
spiTransaction.rxBuf = (void *)receiveBuffer;
spiTransaction.args = NULL;
/* Initiate transfer */
transferOK = MCSPI_transfer(gMcspiHandle, &spiTransaction);
if((SystemP_SUCCESS != transferOK) ||
(MCSPI_TRANSFER_COMPLETED != spiTransaction.status))
{
/* MCSPI transfer failed!! */
DebugP_assert(FALSE);
}
/* Read Data drom slave if any */
/* Fill in transmitBuffer with data */
spiTransaction.channel = 0U;
spiTransaction.dataSize = 16U;
spiTransaction.csDisable = TRUE;
spiTransaction.count = APP_MCSPI_MSGSIZE;
spiTransaction.txBuf = (void *)transmitBuffer;
spiTransaction.rxBuf = (void *)receiveBuffer;
spiTransaction.args = NULL;
/* Initiate transfer */
transferOK = MCSPI_transfer(gMcspiHandle, &spiTransaction);
if((SystemP_SUCCESS != transferOK) ||
(MCSPI_TRANSFER_COMPLETED != spiTransaction.status))
{
/* MCSPI transfer failed!! */
DebugP_assert(FALSE);
}
Non-Blocking Transfer Example
void App_callbackFxn(MCSPI_Handle handle,
MCSPI_Transaction *transaction)
{
SemaphoreP_Object *semObj;
if((NULL != transaction) &&
(MCSPI_TRANSFER_COMPLETED == transaction->status))
{
semObj = (SemaphoreP_Object *) transaction->args;
if(NULL != semObj)
{
SemaphoreP_post(semObj);
}
}
}
void transfer_nonblocking(void)
{
int32_t status;
int32_t transferOK;
MCSPI_OpenParams spiParams;
MCSPI_Transaction spiTransaction;
uint8_t transmitBuffer[APP_MCSPI_MSGSIZE];
uint8_t receiveBuffer[APP_MCSPI_MSGSIZE];
MCSPI_OpenParams_init(&spiParams); /* Initialize SPI parameters */
spiParams.transferMode = MCSPI_TRANSFER_MODE_CALLBACK;
spiParams.transferCallbackFxn = &App_callbackFxn;
gMcspiHandle = MCSPI_open(CONFIG_MCSPI0, &spiParams);
DebugP_assert(gMcspiHandle != NULL);
/* Fill in transmitBuffer */
spiTransaction.channel = 0U;
spiTransaction.csDisable = TRUE;
spiTransaction.dataSize = 16U;
spiTransaction.count = APP_MCSPI_MSGSIZE;
spiTransaction.txBuf = (void *)transmitBuffer;
spiTransaction.rxBuf = (void *)receiveBuffer;
spiTransaction.args = &gMcspiISRDoneSem; /* Pass semaphore */
/* Initiate transfer */
transferOK = MCSPI_transfer(gMcspiHandle, &spiTransaction);
DebugP_assert(transferOK == SystemP_SUCCESS);
/* Wait for callback */
status = SemaphoreP_pend(&gMcspiISRDoneSem, SystemP_WAIT_FOREVER);
DebugP_assert(status == SystemP_SUCCESS);
}
API Reference
MCSPI Driver API/interface file.
Channel Id
Values used to determine the channel number used for McSPI communication. This determines which Chip Select (CS) line to use
-
MCSPI_CHANNEL_0
-
MCSPI_CHANNEL_1
-
MCSPI_CHANNEL_2
-
MCSPI_CHANNEL_3
Operating Mode
Values used to determine the McSPI driver operation.
-
MCSPI_OPER_MODE_POLLED
-
MCSPI_OPER_MODE_INTERRUPT
-
MCSPI_OPER_MODE_DMA
Transfer Status Code
Status codes that are set by the MCSPI driver
-
MCSPI_TRANSFER_COMPLETED
-
MCSPI_TRANSFER_STARTED
-
MCSPI_TRANSFER_CANCELLED
-
MCSPI_TRANSFER_FAILED
-
MCSPI_TRANSFER_CSN_DEASSERT
-
MCSPI_TRANSFER_TIMEOUT
Transfer Mode
This determines whether the driver operates synchronously or asynchronously
In MCSPI_TRANSFER_MODE_BLOCKING mode MCSPI_transfer() blocks code execution until the transaction has completed
In MCSPI_TRANSFER_MODE_CALLBACK MCSPI_transfer() does not block code execution and instead calls a MCSPI_CallbackFxn callback function when the transaction has completed
-
MCSPI_TRANSFER_MODE_BLOCKING
MCSPI_transfer() blocks execution. This mode can only be used when called within a Task context
-
MCSPI_TRANSFER_MODE_CALLBACK
MCSPI_transfer() does not block code execution and will call a MCSPI_CallbackFxn. This mode can be used in a Task, Swi, or Hwi context
Modes of Operation
Definitions for various MCSPI modes of operation
The MCSPI driver operates in both master and SPI slave modes. Logically, the implementation is identical, however the difference between these two modes is driven by hardware. The default mode is MCSPI_MS_MODE_MASTER, but can be set to slave mode by setting MCSPI_OpenParams.msMode to MCSPI_MS_MODE_SLAVE in the parameters passed to MCSPI_open().
-
MCSPI_MS_MODE_MASTER
The module generates the clock and CS.
-
MCSPI_MS_MODE_SLAVE
The module receives the clock and CS.
Frame Format
Definitions for various SPI data frame formats
POL0 = SPICLK is held low during the INACTIVE state POL1 = SPICLK is held high during the INACTIVE state
PHA0 = Data are latched on odd-numbered edges of SPICLK PHA1 = Data are latched on even-numbered edges of SPICLK
-
MCSPI_FF_POL0_PHA0
-
MCSPI_FF_POL0_PHA1
-
MCSPI_FF_POL1_PHA0
-
MCSPI_FF_POL1_PHA1
Chip-select Polarity
Type for SPI Chip Select Polarity and Clock Idle Level
-
MCSPI_CS_POL_HIGH
SPIEN (CS) is held high during the ACTIVE state.
-
MCSPI_CS_POL_LOW
SPIEN (CS) is held low during the ACTIVE state.
Input Select
-
MCSPI_IS_D0
Data line 0 (SPIDAT[0]) selected for reception.
-
MCSPI_IS_D1
Data line 1 (SPIDAT[1]) selected for reception.
Transmission Enable for Data Line
-
MCSPI_DPE_ENABLE
Data line selected for transmission.
-
MCSPI_DPE_DISABLE
No transmission on Data Line.
Slave Chip-select Signal Select
-
MCSPI_SLV_CS_SELECT_0
-
MCSPI_SLV_CS_SELECT_1
-
MCSPI_SLV_CS_SELECT_2
-
MCSPI_SLV_CS_SELECT_3
Start-bit Polarity
-
MCSPI_SB_POL_HIGH
SStart-bit polarity is held to 1 during MCSPI transfer.
-
MCSPI_SB_POL_LOW
Start-bit polarity is held to 0 during MCSPI transfer.
Chip-select Idle Time
Values used to configure the chip select time control (TCS)
-
MCSPI_TCS0_0_CLK
0.5 clock cycles delay
-
MCSPI_TCS0_1_CLK
1.5 clock cycles delay
-
MCSPI_TCS0_2_CLK
2.5 clock cycles delay
-
MCSPI_TCS0_3_CLK
3.5 clock cycles delay
Channel Mode
-
MCSPI_CH_MODE_SINGLE
Only one channel will be used in master mode. This should be used when CS is used in forced enable mode.
-
MCSPI_CH_MODE_MULTI
More than one channel will be used in master mode.
Pin Mode
-
MCSPI_PINMODE_3PIN
SPIEN (CS) is not used. In this mode all related options to chip-select have no meaning.
-
MCSPI_PINMODE_4PIN
Init Delay
Values used to enable initial delay for first transfer
-
MCSPI_INITDLY_0
No delay.
-
MCSPI_INITDLY_4
4 SPI bus clock delays
-
MCSPI_INITDLY_8
8 SPI bus clock delays
-
MCSPI_INITDLY_16
16 SPI bus clock delays
-
MCSPI_INITDLY_32
32 SPI bus clock delays
Defines
-
MCSPI_MAX_TIMEOUT_VALUE
-
MCSPI_MAX_NUM_CHANNELS
Max number of channels/Chip Select (CS) supported.
-
MCSPI_ERROR_TX_UNDERFLOW
McSPI error macro’s.
-
MCSPI_ERROR_RX_OVERFLOW
-
MCSPI_FIFO_LENGTH
Total length of FIFO for both TX/RX.
-
MCSPI_RX_FIFO_ENABLE
McSPI peripheral Rx FIFO is enabled.
-
MCSPI_RX_FIFO_DISABLE
McSPI peripheral Rx FIFO is disabled.
-
MCSPI_TX_FIFO_ENABLE
McSPI peripheral Tx FIFO is enabled.
-
MCSPI_TX_FIFO_DISABLE
McSPI peripheral Tx FIFO is disabled.
-
MCSPI_REG_OFFSET
McSPI Register Offset for MCSPI_CHxCONF, MCSPI_CHxSTAT, MCSPI_CHxCTRL, MCSPI_TXx and MCSPI_RXx register set.
-
MCSPI_CHCONF(x)
Base address of McSPI_CHCONF(x)
-
MCSPI_CHSTAT(x)
Base address of McSPI_CHSTAT(x)
-
MCSPI_CHCTRL(x)
Base address of McSPI_CHCTRL(x)
-
MCSPI_CHTX(x)
Base address of McSPI_CHTX(x)
-
MCSPI_CHRX(x)
Base address of McSPI_CHRX(x)
-
MCSPI_CLKD_MASK
-
MCSPI_IRQSTATUS_CLEAR_ALL
Bit mask to clear all status bits.
Typedefs
-
typedef void *MCSPI_Handle
A handle that is returned from a MCSPI_open() call.
-
typedef void (*MCSPI_CallbackFxn)(MCSPI_Handle handle, MCSPI_Transaction *transaction)
The definition of a callback function used by the SPI driver when used in MCSPI_TRANSFER_MODE_CALLBACK.
- Param handle:
MCSPI_Handle
- Param transaction*:
Pointer to a MCSPI_Transaction
Functions
-
void MCSPI_init(void)
This function initializes the MCSPI module.
-
void MCSPI_deinit(void)
This function de-initializes the MCSPI module.
-
MCSPI_Handle MCSPI_open(uint32_t mcspiConfigIndex, const MCSPI_OpenParams *openPrms)
This function opens a given MCSPI peripheral.
See also
See also
See also
- Parameters:
mcspiConfigIndex – Index of config to use in the MCSPI_Config array
openPrms – Pointer to open parameters. If NULL is passed, then default values will be used
- Pre:
MCSPI controller has been initialized using MCSPI_init()
- Returns:
A MCSPI_Handle on success or a NULL on an error or if it has been opened already
-
void MCSPI_close(MCSPI_Handle handle)
Function to close a MCSPI peripheral specified by the MCSPI handle.
See also
- Parameters:
handle – MCSPI_Handle returned from MCSPI_open()
- Pre:
MCSPI_open() has to be called first
-
int32_t MCSPI_chConfig(MCSPI_Handle handle, const MCSPI_ChConfig *chCfg)
Function to configure a MCSPI channel.
See also
See also
- Parameters:
handle – MCSPI_Handle returned from MCSPI_open()
chCfg – Pointer to MCSPI_ChConfig. This parameter can’t be NULL
- Returns:
SystemP_SUCCESS if successful; else error on failure
-
int32_t MCSPI_dmaChConfig(MCSPI_Handle handle, const MCSPI_ChConfig *chCfg, const MCSPI_DmaChConfig *dmaChCfg)
Function to configure a DMA of a channel.
See also
See also
- Parameters:
handle – MCSPI_Handle returned from MCSPI_open()
chCfg – Pointer to MCSPI_ChConfig. This parameter can’t be NULL
dmaChCfg – Pointer to MCSPI_DmaChConfig. This parameter can’t be NULL
- Returns:
SystemP_SUCCESS if successful; else error on failure
-
int32_t MCSPI_transfer(MCSPI_Handle handle, MCSPI_Transaction *transaction)
Function to perform MCSPI transactions.
If the MCSPI is in MCSPI_MS_MODE_MASTER mode, it will immediately start the transaction. If the MCSPI is in MCSPI_MS_MODE_SLAVE mode, it prepares the driver for a transaction with a MCSPI master device. The device will then wait until the master begins the transfer.
In MCSPI_TRANSFER_MODE_BLOCKING, MCSPI_transfer() will block task execution until the transaction has completed or a timeout has occurred.
In MCSPI_TRANSFER_MODE_CALLBACK, MCSPI_transfer() does not block task execution, but calls a MCSPI_CallbackFxn once the transfer has finished. This makes MCSPI_transfer() safe to be used within a Task, software or hardware interrupt context.
From calling MCSPI_transfer() until transfer completion, the MCSPI_Transaction structure must stay persistent and must not be altered by application code. It is also forbidden to modify the content of the MCSPI_Transaction.txBuf during a transaction, even though the physical transfer might not have started yet. Doing this can result in data corruption. This is especially important for slave operations where MCSPI_transfer() might be called a long time before the actual data transfer begins.
See also
See also
- Parameters:
handle – MCSPI_Handle returned from MCSPI_open()
transaction – Pointer to a MCSPI_Transaction. All of the fields within transaction except MCSPI_Transaction.count and MCSPI_Transaction.status are WO (write-only) unless otherwise noted in the driver implementations. If a transaction timeout has occurred, MCSPI_Transaction.count will contain the number of frames that were transferred. Neither is it allowed to modify the transaction object nor the content of MCSPI_Transaction.txBuf until the transfer has completed
- Returns:
SystemP_SUCCESS if started successfully; else error on failure
-
int32_t MCSPI_transferCancel(MCSPI_Handle handle)
Function to cancel MCSPI transactions on channel of a SPI peripheral specified by the MCSPI handle.
In MCSPI_TRANSFER_MODE_BLOCKING, MCSPI_transferCancel has no effect.
In MCSPI_TRANSFER_MODE_CALLBACK, MCSPI_transferCancel() will stop an MCSPI transfer if if one is in progress. If a transaction was in progress, its callback function will be called in context from which this API is called from. The MCSPI_CallbackFxn function can determine if the transaction was successful or not by reading the MCSPI_TransferStatus status value in the MCSPI_Transaction structure.
See also
See also
- Parameters:
handle – MCSPI_Handle returned from MCSPI_open()
-
static inline void MCSPI_OpenParams_init(MCSPI_OpenParams *openPrms)
Function to initialize the MCSPI_OpenParams struct to its defaults.
- Parameters:
openPrms – Pointer to MCSPI_OpenParams structure for initialization
-
static inline void MCSPI_ChConfig_init(MCSPI_ChConfig *chConfig)
Function to initialize the MCSPI_ChConfig struct to its defaults.
- Parameters:
chConfig – Pointer to MCSPI_ChConfig structure for initialization
-
static inline void MCSPI_Transaction_init(MCSPI_Transaction *trans)
Function to initialize the MCSPI_Transaction struct to its defaults.
- Parameters:
trans – Pointer to MCSPI_Transaction structure for initialization
-
uint32_t MCSPI_getBaseAddr(MCSPI_Handle handle)
Function to get base address of MCSPI instance of a particular handle.
See also
- Parameters:
handle – MCSPI_Handle returned from MCSPI_open()
-
int32_t MCSPI_reConfigFifo(MCSPI_Handle handle, uint32_t chNum, uint32_t numWordsRxTx)
Function to re-configure Effective FIFO Words.
See also
- Parameters:
handle – MCSPI_Handle returned from MCSPI_open()
chNum – Channel used for communication.
numWordsRxTx – Number of words to transfer
- Returns:
SystemP_SUCCESS if successful; else error on failure
-
static inline uint32_t MCSPI_getBufWidthShift(uint32_t dataSize)
This API will return the buffer width in bytes based on dataSize.
See also
- Parameters:
dataSize – MCSPI data frame size in bits - valid values: 4 bits to 32 bits
- Returns:
bufWidthShift Width of buffer in bytes - used for accessing the TX/RX buffer. When dataWidth <= 8, (1 byte - 0 shift) When dataWidth > 8 && <= 16, (2 bytes - 1 shift) When dataWidth > 16 && <= 32, (4 bytes - 2 shift)
-
static inline uint32_t MCSPI_readChStatusReg(uint32_t baseAddr, uint32_t chNum)
This API will return the status of the McSPI channel currently in use.
See also
- Parameters:
baseAddr – Memory Address of the McSPI instance used.
chNum – Channel used for communication.
'chNum' can take the following values.\n MCSPI_CHANNEL_n - Channel n is used for communication.\n
- Returns:
This API will return the status of the McSPI channel status register. User can use the following macros to check the status
MCSPI_CH_STAT_RXS_FULL - Receiver register is full
MCSPI_CH_STAT_TXS_EMPTY - Transmitter register is full
MCSPI_CH_STAT_EOT - End of transfer status
MCSPI_CH_TXFFE - FIFO transmit buffer empty status
MCSPI_CH_TXFFF - FIFO transmit buffer full status
MCSPI_CH_RXFFE - FIFO receive buffer empty status
MCSPI_CH_RXFFF - FIFO receive buffer full status
-
static inline uint32_t MCSPI_readChCtrlReg(uint32_t baseAddr, uint32_t chNum)
This API returns Channel control register value.
See also
- Parameters:
baseAddr – Memory Address of the McSPI instance used.
chNum – Channel number of the McSPI instance used.
- Returns:
Channel control register value.
-
static inline void MCSPI_writeChCtrlReg(uint32_t baseAddr, uint32_t chNum, uint32_t regVal)
This API sets Channel control register value.
See also
- Parameters:
baseAddr – Memory Address of the McSPI instance used.
chNum – Channel number of the McSPI instance used.
regVal – register value to set in channel control register.
-
static inline uint32_t MCSPI_readChConf(uint32_t baseAddr, uint32_t chNum)
This API returns Channel Config register value.
See also
- Parameters:
baseAddr – Memory Address of the McSPI instance used.
chNum – Channel number of the McSPI instance used.
- Returns:
Channel Config register value.
-
static inline void MCSPI_writeChConfReg(uint32_t baseAddr, uint32_t chNum, uint32_t regVal)
This API sets Channel Config register value.
See also
- Parameters:
baseAddr – Memory Address of the McSPI instance used.
chNum – Channel number of the McSPI instance used.
regVal – register value to set in channel Config register.
-
static inline void MCSPI_writeTxDataReg(uint32_t baseAddr, uint32_t txData, uint32_t chNum)
This API will put the data on to the McSPI Channel transmit register.
See also
- Parameters:
baseAddr – Memory Address of the McSPI instance used.
txData – 32 bit data sent by the user which is put on to the MCSPI_TX register.
chNum – Channel number of the McSPI instance used.
'chNum' can take the following values.\n MCSPI_CHANNEL_n - Channel n is used for communication.\n For chNum n can range from 0-3.\n
-
static inline void MCSPI_enableTxFIFO(uint32_t baseAddr, uint32_t chNum, uint32_t enableFlag)
This API will enable/disable the Tx FIFOs of McSPI peripheral.
See also
Note
: Enabling FIFO is restricted to only 1 channel.
- Parameters:
baseAddr – Memory Address of the McSPI instance used.
chNum – Channel number of the McSPI instance used.
enableFlag – Flag to enable/diable FIFO transmit mode.
'enableFlag' can take the following values.\n MCSPI_TX_FIFO_ENABLE - Enables the receiver FIFO of McSPI.\n MCSPI_TX_FIFO_DISABLE - Disables the receiver FIFO of McSPI.\n 'chNum' can take the following values.\n MCSPI_CHANNEL_n - Channel n is used for communication.\n For chNum n can range from 0-3.\n
-
static inline void MCSPI_enableRxFIFO(uint32_t baseAddr, uint32_t chNum, uint32_t enableFlag)
This API will enable/disable the Rx FIFOs of McSPI peripheral.
See also
Note
: Enabling FIFO is restricted to only 1 channel.
- Parameters:
baseAddr – Memory Address of the McSPI instance used.
chNum – Channel number of the McSPI instance used.
enableFlag – Flag to enable/diable FIFO receive mode.
'enableFlag' can take the following values.\n MCSPI_RX_FIFO_ENABLE - Enables the receiver FIFO of McSPI.\n MCSPI_RX_FIFO_DISABLE - Disables the receiver FIFO of McSPI.\n 'chNum' can take the following values.\n MCSPI_CHANNEL_n - Channel n is used for communication.\n For chNum n can range from 0-3.\n
-
static inline uint32_t MCSPI_readRxDataReg(uint32_t baseAddr, uint32_t chNum)
This API will return the data present in the MCSPI_RX register.
See also
- Parameters:
baseAddr – Memory Address of the McSPI instance used.
chNum – Channel number of the McSPI instance used.
'chNum' can take the following values.\n MCSPI_CHANNEL_n - Channel n is used for communication.\n For chNum n can range from 0-3.\n
- Returns:
This API will return the data received in the MCSPI_RX register.
-
static inline void MCSPI_setDataWidth(uint32_t baseAddr, uint32_t chNum, uint32_t dataWidth)
This API will set the data width in the channel config register.
See also
- Parameters:
baseAddr – Memory Address of the McSPI instance used.
chNum – Channel number of the McSPI instance used.
dataWidth – MCSPI data frame width in bits.
'chNum' can take the following values.\n MCSPI_CHANNEL_n - Channel n is used for communication.\n For chNum n can range from 0-3.\n For dataWidth valid values: 4 bits to 32 bits
Variables
-
MCSPI_Config gMcspiConfig[]
Externally defined driver configuration array.
-
uint32_t gMcspiConfigNum
Externally defined driver configuration array size.
-
struct MCSPI_Transaction
- #include <mcspi.h>
Data structure used with MCSPI_transfer()
It indicates how many MCSPI_FrameFormat frames are sent and received from the buffers pointed to txBuf and rxBuf. The args variable is an user-definable argument which gets passed to the MCSPI_CallbackFxn when the SPI driver is in MCSPI_TRANSFER_MODE_CALLBACK.
Public Members
-
uint32_t channel
[IN] Channel number (chip select) to use. Valid value from 0 to (MCSPI_MAX_NUM_CHANNELS - 1)
-
uint32_t csDisable
[IN] TRUE/FALSE to disable CS(chip select) If it is set to TRUE, CS is de-asseted automatically at the end of the transfer. If user wants to chain more transfers under one CS pulse, user needs to set it to FALSE for each transfer and for the last transfer, user needs to set to TRUE to de-assert CS
-
uint32_t dataSize
[IN] MCSPI data frame size in bits - valid values: 4 bits to 32 bits
The dataSize value determines the element types of txBuf and rxBuf. If the dataSize is from 4 to 8 bits, the driver assumes the data buffers are of type uint8_t (unsigned char). If the dataSize is from 8 to 16 bits, the driver assumes the data buffers are of type uint16_t (unsigned short). If the dataSize is greater than 16 bits, the driver assumes the data buffers are uint32_t (unsigned long).
-
uint32_t count
[IN] Number of frames for this transaction. This should in word size length and not in bytes
-
void *txBuf
[IN] void * to a buffer with data to be transmitted.
If txBuf is NULL, the driver sends MCSPI frames with all data set to the default value specified by MCSPI_ChConfig.defaultTxData.
The size of the buffer should be count * MCSPI_Transaction.dataSize in bytes rounded to nearest byte boundary. For example if MCSPI_Transaction.dataSize is 12 bits, then size of buffers should be count * 2 bytes.
-
void *rxBuf
[IN] void * to a buffer to receive data.
If rxBuf is NULL, the driver discards all MCSPI frames received.
The size of the buffer is similar to txBuf as explained above.
-
void *args
[IN] Argument to be passed to the callback function
-
uint32_t status
[OUT] MCSPI_TransferStatus code set by MCSPI_transfer()
-
uint32_t channel
-
struct MCSPI_OpenParams
- #include <mcspi.h>
MCSPI Parameters.
MCSPI Parameters are used to with the MCSPI_open() call. Default values for these parameters are set using MCSPI_OpenParams_init().
If NULL is passed for the parameters, MCSPI_open() uses default parameters.
See also
Public Members
-
uint32_t transferMode
Blocking or Callback mode. Refer MCSPI_TransferMode
-
uint32_t transferTimeout
Transfer timeout in system ticks
-
MCSPI_CallbackFxn transferCallbackFxn
Callback function pointer
-
uint32_t msMode
Master or Slave mode. Refer MCSPI_MsMode
-
int32_t mcspiDmaIndex
Index of DMA instance used by MCSPI Driver. This index will be set by SysCfg according to the DMA driver chosen. The MCSPI driver uses this index to do an MCSPI_dmaOpen inside the MCSPI_open if the DMA mode is enabled
-
uint32_t transferMode
-
struct MCSPI_ChConfig
- #include <mcspi.h>
MCSPI configuration parameters for the channel.
MCSPI channel parameters used with the MCSPI_chConfig() call. Default values for these parameters are set using MCSPI_ChConfig_init().
If NULL is passed for the parameters, MCSPI_chConfig() uses default parameters.
See also
Public Members
-
uint32_t chNum
Channel number. Refer MCSPI_ChannelId
-
uint32_t frameFormat
MCSPI frame format. Refer MCSPI_FrameFormat
-
uint32_t bitRate
MCSPI bit rate in Hz
-
uint32_t csPolarity
Polarity of the chip select signal. Refer MCSPI_CsPolarity
-
uint32_t trMode
Channel transmit/receive mode. Refer MCSPI_TrMode
-
uint32_t inputSelect
Input Select - D0 or D1. Refer MCSPI_InputSelect
-
uint32_t dpe0
Transmission enable/disable for D0. Refer MCSPI_TxEnable
-
uint32_t dpe1
Transmission enable/disable for D1. Refer MCSPI_TxEnable
-
uint32_t slvCsSelect
MCSPI slave select signal detection. Applicable for Channel 0 and in slave mode only. Refer MCSPI_SlvCsSelect
-
uint32_t startBitEnable
Start bit D/CX added before SPI transfer. Polarity is defined by start bit level (below)
-
uint32_t startBitPolarity
Start-bit polarity used when startBitEnable is TRUE Refer MCSPI_SbPolarity
-
uint32_t csIdleTime
Chip select time control. Refer MCSPI_CsIdleTime. This is applicable only in master mode
-
uint32_t defaultTxData
Default TX data to use when NULL pointer is provided for TX buffer. The actual data that is transmitted depends on the dataSize field
-
uint32_t txFifoTrigLvl
TX FIFO trigger level in bytes
-
uint32_t rxFifoTrigLvl
RX FIFO trigger level in bytes
-
uint32_t chNum
-
struct MCSPI_Attrs
- #include <mcspi.h>
MCSPI instance attributes - used during init time.
Public Members
-
uint32_t baseAddr
Peripheral base address
-
uint32_t inputClkFreq
Module input clock frequency
-
uint32_t intrNum
Peripheral interrupt number
-
uint16_t eventId
Module interrupt event ID
-
uint32_t operMode
Driver operating mode
-
uint8_t intrPriority
Interrupt priority
-
uint32_t chMode
Channel mode: Single or multi channel. Refer MCSPI_ChMode
-
uint32_t pinMode
Pin mode. Refer MCSPI_PinMode
-
uint32_t initDelay
Initial SPI delay for first transfer. Refer MCSPI_InitDelay
-
uint32_t baseAddr
-
struct MCSPI_ChObject
- #include <mcspi.h>
MCSPI channel object.
Public Members
-
MCSPI_ChConfig chCfg
Channel configuration as provided by user
-
uint32_t isOpen
Flag to indicate whether the instance is opened already
-
uint32_t csDisable
Flag to indicate disable chip select
-
uint32_t csEnable
Flag to indicate enable chip select
-
const uint8_t *curTxBufPtr
Current TX buffer pointer
-
uint8_t *curRxBufPtr
Current RX buffer pointer
-
uint32_t curTxWords
Number of words transmitted. We need seperate counters for TX/RX because when FIFO in enabled, TX writes happen in advance where as RX will happen on actual received data.
-
uint32_t curRxWords
Number of words received
-
uint8_t bufWidthShift
Width of buffer in bytes - used for accessing the TX/RX buffer. When dataWidth <= 8, bufWidth = uint8_t (1 byte - 0 shift) When dataWidth > 8 && <= 16, bufWidth = uint16_t (2 bytes - 1 shift) When dataWidth > 16 && <= 32, bufWidth = uint32_t (4 bytes - 2 shift)
-
uint32_t dataWidthBitMask
Data width mask depending on SPI word size
-
uint32_t effTxFifoDepth
Effective TX FIFO depth in words - depends on dataWidth
-
uint32_t effRxFifoDepth
Effective RX FIFO depth in words - depends on dataWidth
-
uint32_t intrMask
Interrupt mask to be used for enabling / checking interrupts.
-
MCSPI_DmaChConfig dmaChCfg
Channel Config Register Value.
-
uint32_t chConfRegVal
Channel Control Register Value.
-
uint32_t chCtrlRegVal
SYST Register Value.
-
uint32_t systRegVal
-
MCSPI_ChConfig chCfg
-
struct MCSPI_Object
- #include <mcspi.h>
MCSPI driver object.
Public Members
-
MCSPI_Handle handle
Instance handle to which this object belongs
-
MCSPI_OpenParams openPrms
Open parameter as provided by user
-
uint32_t baseAddr
Peripheral base address - CPU view
-
MCSPI_ChObject chObj[MCSPI_MAX_NUM_CHANNELS]
Channel object
-
uint32_t errorFlag
Variable to store different McSPI errors
-
uint32_t isOpen
Flag to indicate whether the instance is opened already
-
void *transferSem
Transfer Sync Sempahore - to sync between transfer completion ISR and task
-
SemaphoreP_Object transferSemObj
Transfer Sync Sempahore object
-
void *hwiHandle
Interrupt handle for master ISR
-
HwiP_Object hwiObj
Interrupt object
-
MCSPI_Transaction *currTransaction
Pointer to current transaction
-
void *mcspiDmaHandle
DMA Handle
-
MCSPI_Handle handle
-
struct MCSPI_Config
- #include <mcspi.h>
MCSPI global configuration array.
This structure needs to be defined before calling MCSPI_init() and it must not be changed by user thereafter.
The last entry of the array should be a NULL entry which demarks the end of the array.
Public Members
-
const MCSPI_Attrs *attrs
Pointer to driver specific attributes
-
MCSPI_Object *object
Pointer to driver specific data object
-
const MCSPI_Attrs *attrs
MCSPI DMA header file.
Typedefs
-
typedef void *MCSPI_DmaHandle
Handle to the MCSPI DMA Config Object returned by MCSPI_dmaOpen.
-
typedef int32_t (*MCSPI_dmaOpenFxn)(void *mcspiDmaArgs)
Driver implementation to open a specific DMA driver channel - UDMA, EDMA etc.
Typically this callback is hidden from the end application and is implemented when a new DMA driver needs to be supported.
- Param mcspiDmaArgs:
[in] DMA specific arguments, obtained from the config
- Return:
SystemP_SUCCESS on success, else failure
-
typedef int32_t (*MCSPI_dmaCloseFxn)(MCSPI_Handle handle, const MCSPI_ChConfig *chCfg)
Driver implementation to close a specific DMA driver channel - UDMA, EDMA etc.
Typically this callback is hidden from the end application and is implemented when a new DMA driver needs to be supported.
- Param handle:
[in] MCSPI DMA Object handle returned from MCSPI_dmaOpen
- Param chCfg:
[in] DMA specific arguments, obtained from the config
- Return:
SystemP_SUCCESS on success, else failure
-
typedef int32_t (*MCSPI_dmaChInitFxn)(MCSPI_Handle handle, const MCSPI_ChConfig *chCfg, const MCSPI_DmaChConfig *dmaChCfg)
Driver implementation to init a DMA channel params using a specific DMA driver - UDMA, EDMA etc.
Typically this callback is hidden from the end application and is implemented when a new DMA driver needs to be supported.
- Param handle:
[in] MCSPI_Handle returned from MCSPI_open()
- Param chCfg:
[in] Pointer to MCSPI_ChConfig. This parameter can’t be NULL
- Param dmaChCfg:
[in] Pointer to MCSPI_DmaChConfig. This parameter can’t be NULL
- Return:
SystemP_SUCCESS on success, else failure
-
typedef int32_t (*MCSPI_dmaTransferMasterFxn)(MCSPI_Object *obj, MCSPI_ChObject *chObj, const MCSPI_Attrs *attrs, MCSPI_Transaction *transaction)
Driver implementation to do a DMA transfer using a specific DMA driver - UDMA, EDMA etc.
Typically this callback is hidden from the end application and is implemented when a new DMA driver needs to be supported.
- Param obj:
[in] Pointer to MCSPI object
- Param chObj:
[in] Pointer to MCSPI_ChObject. This parameter can’t be NULL
- Param attrs:
[in] Pointer to MCSPI_Attrs. This parameter can’t be NULL
- Param transaction:
[in] Pointer to MCSPI_Transaction. This parameter can’t be NULL
- Return:
SystemP_SUCCESS on success, else failure
-
typedef int32_t (*MCSPI_dmaStopFxn)(MCSPI_Object *obj, const MCSPI_Attrs *attrs, MCSPI_ChObject *chObj, uint32_t chNum)
Driver implementation to Stop DMA using a specific DMA driver - UDMA, EDMA etc.
Typically this callback is hidden from the end application and is implemented when a new DMA driver needs to be supported.
- Param obj:
[in] Pointer to MCSPI object
- Param attrs:
[in] Pointer to MCSPI_Attrs. This parameter can’t be NULL
- Param chObj:
[in] Pointer to MCSPI_ChObject. This parameter can’t be NULL
- Param chNum:
[in] Channel number
- Return:
SystemP_SUCCESS on success, else failure
Functions
-
MCSPI_DmaHandle MCSPI_dmaOpen(int32_t dmaConfigIndex)
API to open an MCSPI DMA channel.
This API will open a DMA Channel using the appropriate DMA driver callbacks and the registered via Sysconfig
- Parameters:
dmaConfigIndex – [in] Index of the DMA Config selected for this particular MCSPI driver instance
- Returns:
Handle to the MCSPI DMA Config Object
-
int32_t MCSPI_dmaClose(MCSPI_Handle handle, const MCSPI_ChConfig *chCfg)
API to close an MCSPI DMA channel.
This API will open a DMA Channel using the appropriate DMA driver callbacks registered via Sysconfig
- Parameters:
handle – [in] MCSPI_Handle returned from MCSPI_open()
chCfg – [in] Pointer to MCSPI_ChConfig. This parameter can’t be NULL
- Returns:
SystemP_SUCCESS on success, else failure
-
int32_t MCSPI_dmaChInit(MCSPI_Handle handle, const MCSPI_ChConfig *chCfg, const MCSPI_DmaChConfig *dmaChCfg)
API to init a DMA Channel opened.
This API will open a DMA Channel using the appropriate DMA driver callbacks registered via Sysconfig
- Parameters:
handle – [in] MCSPI_Handle returned from MCSPI_open()
chCfg – [in] Pointer to MCSPI_ChConfig. This parameter can’t be NULL
dmaChCfg – [in] Pointer to MCSPI_DmaChConfig. This parameter can’t be NULL
- Returns:
SystemP_SUCCESS on success, else failure
-
int32_t MCSPI_dmaTransfer(MCSPI_Object *obj, MCSPI_ChObject *chObj, const MCSPI_Attrs *attrs, MCSPI_Transaction *transaction)
API to do a DMA transfer using a specific DMA driver - UDMA, EDMA etc.
Typically this callback is hidden from the end application and is implemented when a new DMA driver needs to be supported.
- Parameters:
obj – [in] Pointer to MCSPI object
chObj – [in] Pointer to MCSPI_ChObject. This parameter can’t be NULL
attrs – [in] Pointer to MCSPI_Attrs. This parameter can’t be NULL
transaction – [in] Pointer to MCSPI_Transaction. This parameter can’t be NULL
- Returns:
SystemP_SUCCESS on success, else failure
-
int32_t MCSPI_dmaStop(MCSPI_Object *obj, const MCSPI_Attrs *attrs, MCSPI_ChObject *chObj, uint32_t chNum)
API to Stop DMA using a specific DMA driver - UDMA, EDMA etc.
Typically this callback is hidden from the end application and is implemented when a new DMA driver needs to be supported.
- Parameters:
obj – [in] Pointer to MCSPI object
attrs – [in] Pointer to MCSPI_Attrs. This parameter can’t be NULL
chObj – [in] Pointer to MCSPI_ChObject. This parameter can’t be NULL
chNum – [in] Channel number
- Returns:
SystemP_SUCCESS on success, else failure
-
struct MCSPI_DmaFxns
- #include <mcspi_dma.h>
Driver implementation callbacks.
Public Members
-
MCSPI_dmaOpenFxn dmaOpenFxn
-
MCSPI_dmaCloseFxn dmaCloseFxn
-
MCSPI_dmaChInitFxn dmaChInitFxn
-
MCSPI_dmaTransferMasterFxn dmaTransferMasterFxn
-
MCSPI_dmaStopFxn dmaStopFxn
-
MCSPI_dmaOpenFxn dmaOpenFxn
-
struct MCSPI_DmaConfig
- #include <mcspi_dma.h>
MCSPI DMA Configuration, these are filled by SysCfg based on the DMA driver that is selected.