MCASP
The Multi Channel Audio Seiral Peripheral (MCASP) driver is a generic, full-duplex driver that transmits and receives data using the MCASP interface. This is specially designed to transmit and receive the digital audio data.
Features Supported
Interrupt mode operation
DMA mode operation
Internal Loopback
Transmit and Receive in TDM format with multi-serializer, multi-slot support.
SysConfig support for driver parameter configuration and initialization.
Different audio buffer formats for application
SysConfig Features
Attention
The instances for McASP needs to be selected the same for serializers for the instance. Syscfg will automatically assign different instances for all and user will be required to assign same instance and choose to ignore the warning.
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.
Features NOT Supported
Transmit in DIT mode
Burst Mode
Usage Overview
Key Careabouts in Driver Usage
Note
The changes pulled in for the driver starting release 10.0 requires some changes in the Driver usage from application
All transactions submitted from the applications must be of the same size.
The TX and RX can be of seperate size.
The Loopjob buffer size can be configured from the sysconfig.
Application can provide an external buffer for loopjob buffer from Sysconfig
This enables application to provide the transaction buffer itself as loopjob
#MCASP_stopTransferRx() and #MCASP_stopTransferTx() are blocking calls that should not be called from an ISR context.
API Sequence
To use the MCASP driver to send data over the MCASP interface, the application calls the following APIs:
#MCASP_init(): Initialize the MCASP driver.
#MCASP_open(): Open an instance of the MCASP driver
#MCASP_submitRx(): Submit buffers to MCASP driver for reception
#MCASP_submitTx(): Submit buffers to MCASP driver for transmission
#MCASP_startTransferRx(): Start MCASP receive.
#MCASP_startTransferTx(): Start MCASP transmit.
#MCASP_stopTransferRx(): Stop MCASP receive.
#MCASP_stopTransferTx(): Stop MCASP transmit.
#MCASP_withdrawRx(): withdraw buffers submitted to driver for reception
#MCASP_withdrawTx(): withdraw buffers submitted to driver for transmission
#MCASP_close(): De-initialize the MCASP instance.
#MCASP_deinit(): De-Initialize the MCASP driver.
MCASP migration guide 11.02 to 12.00
Note
This section highlights key features that have changed or got added from 11.02 to 12.00 SDK.
Note
Different Audio Buffer Formats feature was added.
Note
For multi-serializer RX/TX, you should select multi-serializer audio buffer formats only.
Supported Application Audio Buffer Formats
The McASP driver provides various buffer formats for sending the data to/from the audio device. The differences between these formats arise from the way the audio samples are collected from various serializers and their timeslots and arranged in the system’s memory. This way the application can choose to run audio processing algorithms over the data without the need for re-arranging those data every frame. This section provides an overview of the various formats . In the explanatory diagrams in each section, McASP controller recieves samples in frame intervals denoted by t1,t2..tn. The McASP driver collects these and arranges those samples in the memory in various formats in to the host’s System memory. We have chosen 32 bit samples and 32-bit word addresses throughout for simplicity.
1-Serializer Multi-Slot Interleaved: This is applicable if multiple slots are used with one serializer. The samples from the different timeslots are stored interleaved in the memory as below. Different timeslots’ samples are denoted by different colors and are labelled t1,t2..tn according to the time they arrive at the serializer.
1-Serializer Multi-Slot Interleaved Buffer Format
1-Serializer Multi-Slot NonInterleaved: This is applicable if multiple slots are used with one serializer. The samples from the different timeslots are grouped together on the basis of the timeslot and stored in the memory as shown below. Different timeslots’ samples are denoted by different colors and are labelled t1,t2..tn according to the time they arrive at the serializer.
1-Serializer Multi-Slot NonInterleaved Buffer Format
Multi-Serializer Multi-Slot Interleaved Type1: This is applicable if multiple serializers are used and each serializer containing multiple timeslots. The samples are stored in the memory interleaved based on serializer and timeslots as shown below. In this example, there are 3 serializers and 2 timeslots per serializers whose samples are noted by Ln (left) and Rn (right). Different serializers’ samples are denoted by different colors.
Multi-Serializer Multi-Slot Interleaved Type1 Buffer Format
Multi-Serializer Multi-Slot Interleaved Type2: This is applicable if multiple serializers are used and each serializer containing multiple timeslots. The samples are grouped based on the serializer and within one serializer, the timeslots are interleaved as shown below. In this example, there are 3 serializers and 2 timeslots per serializers whose samples are noted by Ln (left) and Rn (right).Different serializers’ samples are denoted by different colors.
Multi-Serializer Multi-Slot Interleaved Type2 Buffer Format
Multi-Serializer Multi-Slot NonInterleaved: This is applicable if multiple serializers are used and each serializer containing multiple timeslots. The samples are grouped based on the serializer and slot within one serializer, the timeslots are interleaved as shown below. In this example, there are 3 serializers and 2 timeslots per serializers whose samples are noted by Ln (left) and Rn (right).Different serializers’ samples are denoted by different colors.
Multi-Serializer Multi-Slot NonInterleaved Buffer Format
Loopjob Configuration
Mcasp driver allows loopjob enabled/disabled configuration to handle delayed application buffer submission at run time. Loopjob is a default buffer that gets transmitted / received into if the application fails to submit the buffers in time. When loopjob is disabled the last 2 application buffers will be re programmed and re used. The application callback corresponding to the re programmed buffers is not called.
Loopjob buffer is programmed in sys config. Sys config will define a uint8_t array and initialize it to 0.
Application can access the buffer and optionally initialize the data.
If the loopjob buffer is programmed, after sending the full loopjob buffer next submitted buffer is programmed.
Buffer Queuing
The application buffers need to be programmed before starting the transfer.
If the loopjob is enabled application can start without queuing any buffers, Driver will work with the loopjob buffers till application queues the actual buffers.
If loopjob is disabled at least 2 buffers should be queued before starting the mcasp transfer. New buffer will be programmed in the interrupt callback corresponding to current transfer. the application is expected to submit the new buffer before that else the same buffer is re programmed, so it is recommended to start the transfer with at least 3 buffers queued.
Example Usage
Include the below file to access the APIs
#include <drivers/mcasp.h>
Instance Open Example
MCASP_OpenParams mcaspParams;
MCASP_openParamsInit(&mcaspParams); /* Initialize mcasp parameters */
mcaspParams.edmaInst = 0;
mcaspParams.edmaInst = CONFIG_EDMA0,
mcaspParams.transferMode = MCASP_TRANSFER_MODE_DMA,
mcaspParams.txCallbackFxn = mcasp_loopback_txcb,
mcaspParams.rxCallbackFxn = mcasp_loopback_rxcb,
gMcaspHandle = MCASP_open(CONFIG_MCASP0, &mcaspParams);
DebugP_assert(gMcaspHandle != NULL);
Instance Close Example
MCASP_close(gMcaspHandle);
Start McASP Transfer Example
MCASP_Transaction txnTx[APP_MCASP_MSG_COUNT] = {0};
MCASP_Transaction txnRx[APP_MCASP_MSG_COUNT] = {0};
uint8_t mcaspTxBuffer[APP_MCASP_MSG_COUNT][APP_MCASP_MSGSIZE];
uint8_t mcaspRxBuffer[APP_MCASP_MSG_COUNT][APP_MCASP_MSGSIZE];
uint32_t i;
for (i = 0U; i < APP_MCASP_MSG_COUNT; i++)
{
txnTx[i].buf = (void*) &mcaspTxBuffer[i][0];
txnTx[i].count = APP_MCASP_MSGSIZE/4;
txnTx[i].timeout = 0xFFFFFF;
MCASP_submitTx(gMcaspHandle, &txnTx[i]);
}
for (i = 0U; i < APP_MCASP_MSG_COUNT; i++)
{
txnRx[i].buf = (void*) &mcaspRxBuffer[i][0];
txnRx[i].count = APP_MCASP_MSGSIZE/4;
txnRx[i].timeout = 0xFFFFFF;
MCASP_submitRx(gMcaspHandle, &txnRx[i]);
}
MCASP_startTransferRx(gMcaspHandle);
MCASP_startTransferTx(gMcaspHandle);
Stop McASP Transfer Example
MCASP_stopTransferTx(gMcaspHandle);
MCASP_stopTransferRx(gMcaspHandle);
/* withdraw the buffers submitted to driver. */
{
MCASP_Transaction *transaction;
do {
transaction = MCASP_withdrawRx(gMcaspHandle);
}while (transaction != NULL);
do {
transaction = MCASP_withdrawTx(gMcaspHandle);
}while (transaction != NULL);
}
MCASP Callback Functions
void mcasp_loopback_txcb (MCASP_Handle handle,
MCASP_Transaction *transaction)
{
/* Sample Tx callback function. Submit the same buffer again to driver. */
MCASP_submitTx(handle, transaction);
}
void mcasp_loopback_rxcb (MCASP_Handle handle,
MCASP_Transaction *transaction)
{
/* Sample Rx callback function. Submit the same buffer again to driver. */
MCASP_submitRx(handle, transaction);
}
SysConfig migration guide 11.01 to 11.02
Note
This section highlights key features that have changed or got added from 11.01 to 11.02 SDK
AUX clock selection
This version of SDK (11.02) gives the configurability to choose between different sources of AUXCLK
MCASP AUX Clock Selection
The specific option for AUXCLK will vary from device to device. View long description in Syscfg view for more details on the AUXCLK options to select from.
The frequency for the configurable AUX clock options can be choosen at a global level as this will be applicable across all instances of MCASP.
MCASP AUX Clock Frequency
Some option in the AUX clock selections might expect the aux clock to be supplied externally to the SoC. Refer the TRM of the specific device to check if the clock is supplied externally or generated interally.
When using an internally generated auxiliary clock source, not all frequency values are achievable due to hardware limitations. If the user-specified frequency cannot be generated, the system will throw a runtime error.
Clock Divider Configurability
This version of SDK (11.02) gives configurability of the High Clock Divider (HCLK Divider), and the BCLK divider.
MCASP Clock Divider Configuration
The “Re-Calculate” button can be used to calculate the divider values that would result in the closest FSYNC value required.
The “Apply” button needs to be pressed to view the frequencies for any change in the Sysconfig GUI that have resulted in a change of frequencies.
Press the “Apply” button to update the frequency information displayed in the Syscfg GUI for all configuration parameters that affect frequency settings.
User have to ensure all the frequencies that is displayed is as expected in the system after pressing “Apply”.
User can adjust the Divider values and press the “Apply” button to achieve any specific clock frequencies.
API Reference
MCASP Driver API/interface file.
Transfer Status Code
Status codes that are set by the MCASP driver
-
MCASP_TRANSFER_STATUS_COMPLETED
I/O completed successfully.
-
MCASP_TRANSFER_STATUS_STARTED
I/O queued and pending.
-
MCASP_TRANSFER_STATUS_CANCELLED
I/O cancelled. Returned by incomplete read or write requests.
-
MCASP_TRANSFER_STATUS_FAILED
Generic failure condition.
-
MCASP_TRANSFER_STATUS_TIMEOUT
I/O timeout occurred.
McASP Transfer Mode
-
MCASP_TRANSFER_MODE_POLLING
MCASP read/write APIs blocks execution. This mode can only be used when called within a Task context.
-
MCASP_TRANSFER_MODE_INTERRUPT
MCASP read/write APIs does not block code execution and will call a MCASP_TxCallbackFxn or MCASP_RxCallbackFxn. This mode can be used in a Task, Swi, or Hwi context.
-
MCASP_TRANSFER_MODE_DMA
MCASP read/write APIs does not block code execution and will use DMA for transfers.
McASP Operating Mode
OPerating Modes that are supported by the MCASP driver
-
MCASP_OPMODE_MASTER
I/O completed successfully.
-
MCASP_OPMODE_SLAVE
I/O queued and pending.
MCASP Channel Direction
the channel modes supported by Mcasp
-
MCASP_CHANNEL_INPUT
MCASP Channel will receive data.
-
MCASP_CHANNEL_OUTPUT
MCASP Channel will transmit data.
-
MCASP_CHANNEL_INOUT
McASP channel transmits & recieves data.
MCASP Driver State
Mcasp driver state enums used to track the driver state
-
MCASP_DRIVER_STATE_DELETED
-
MCASP_DRIVER_STATE_CREATED
-
MCASP_DRIVER_STATE_INITIALIZED
-
MCASP_DRIVER_STATE_OPENED
-
MCASP_DRIVER_STATE_CLOSED
-
MCASP_DRIVER_STATE_DEINITIALIZED
-
MCASP_DRIVER_STATE_POWERED_DOWN
-
MCASP_DRIVER_STATE_PWRM_SUSPEND
MCASP Serializer Status
Enumeration for serializer status
-
MCASP_SERIALIZER_STATUS_FREE
-
MCASP_SERIALIZER_STATUS_XMT
-
MCASP_SERIALIZER_STATUS_RCV
MCASP Channel Mode
Enumeration for channel mode
-
MCASP_CHANNEL_MODE_FREE
-
MCASP_CHANNEL_MODE_XMT_DIT
-
MCASP_CHANNEL_MODE_XMT_TDM
-
MCASP_CHANNEL_MODE_RCV
MCASP Word Select
Enumerated constant for selecting MSB/LSB word in the slot bits
-
MCASP_WORD_SELECT_LSW
-
MCASP_WORD_SELECT_MSW
Enumerated constants to specify the supported buffer formats.
Interleaved and non-interleaved is standard format, this enumeration captures the standard and custom data formats.
-
MCASP_AUDBUFF_FORMAT_1SER_MULTISLOT_NON_INTERLEAVED
This is used for transfer of data on a single serializer with multiple slots.please note that the slot data is not interleaved in this format. TDM with single serializer and slots > 1 uses this format.
-
MCASP_AUDBUFF_FORMAT_1SER_MULTISLOT_INTERLEAVED
This is used for transfer of data on a single serializer with multiple slots.please note that the slot data is interleaved in this format. TDM with single serializer and slots > 1 uses this format.
-
MCASP_AUDBUFF_FORMAT_MULTISER_MULTISLOT_SEMI_INTERLEAVED_1
This is used for transfer of data with multiple serializers and also multiple slots enabled.please note that the serializer data is interleaved in this format. The slot data is also interleaved Refer to the user guide to view the sample data format.
-
MCASP_AUDBUFF_FORMAT_MULTISER_MULTISLOT_SEMI_INTERLEAVED_2
This is used for transfer of data with multiple serializers and also multiple slots enabled.please note that the serializer data is NOT interleaved in this format. The slot data is interleaved. Refer to the user guide to view the sample data format.
-
MCASP_AUDBUFF_FORMAT_MULTISER_MULTISLOT_NON_INTERLEAVED
This is used for transfer of data with multiple serializers and also multiple slots enabled.please note that niether serializer data nor slot data is interleaved in this format. Refer to the user guide to view the sample data format.
Transmit State for McASP transfer
Enumeration for McASP transmit state
-
MCASP_TRANSMIT_STATE_TX_RESET
-
MCASP_TRANSMIT_STATE_TX_FLUSH
-
MCASP_TRANSMIT_STATE_LOAD_INIT_BUFFER
-
MCASP_TRANSMIT_STATE_RELEASE_FROM_RESET
-
MCASP_TRANSMIT_STATE_WAIT_EVENT
-
MCASP_TRANSMIT_STATE_PROCESS_EVENT
-
MCASP_TRANSMIT_STATE_LOAD_ACTIVE_BUFFER
-
MCASP_TRANSMIT_STATE_DONE
-
MCASP_TRANSMIT_STATE_SPIN_IDLE
-
MCASP_TRANSMIT_STATE_ERROR
-
MCASP_TRANSMIT_STATE_EXIT
Receive State for McASP transfer
Enumeration for McASP receive state
-
MCASP_RECEIVE_STATE_RX_RESET
-
MCASP_RECEIVE_STATE_RX_FLUSH
-
MCASP_RECEIVE_STATE_RELEASE_FROM_RESET
-
MCASP_RECEIVE_STATE_WAIT_EVENT
-
MCASP_RECEIVE_STATE_PROCESS_EVENT
-
MCASP_RECEIVE_STATE_DONE
-
MCASP_RECEIVE_STATE_SPIN_IDLE
-
MCASP_RECEIVE_STATE_ERROR
-
MCASP_RECEIVE_STATE_EXIT
Defines
-
MCASP_GBLCTL_TIMEOUT
The time to try (in Msec) before the GBLCTL register setting timeouts if the setting/resetting is done in a context other than a task this will be used as a retry count rather than the MSec timeout.
-
MCASP_DATA_TIMEOUT
The time to try (in Msec) to check the XDTATA/RDATA flags in status register. if the setting/resetting is done in a context other than a task this will be used as a retry count rather than the MSec timeout.
-
MCASP_RESET
McASP macros for enable/reset.
-
MCASP_ENABLE
-
MCASP_DISABLE
-
MCASP_REG_OFFSET
-
MCASP_DIR_OUT
-
MCASP_DIR_IN
-
MCASP_TRPD_INVALID_PTR
Typedefs
-
typedef void *MCASP_Handle
A handle that is returned from a MCASP_open() call.
-
typedef void (*MCASP_TxCallbackFxn)(MCASP_Handle handle, MCASP_Transaction *transaction)
The definition of a callback function used by the MCASP driver when used in Callback Mode.
- Param handle:
MCASP_Handle
- Param transaction*:
Pointer to a MCASP_Transaction
-
typedef void (*MCASP_RxCallbackFxn)(MCASP_Handle handle, MCASP_Transaction *transaction)
Functions
-
void MCASP_init(void)
This function initializes the MCASP module.
-
void MCASP_deinit(void)
This function de-initializes the MCASP module.
-
static inline void MCASP_openParamsInit(MCASP_OpenParams *openPrms)
Function to initialize the MCASP_OpenParams struct to its defaults.
- Parameters:
openPrms – Pointer to MCASP_OpenParams structure for initialization
-
MCASP_Handle MCASP_open(uint32_t index, const MCASP_OpenParams *openParams)
This function opens a given MCASP peripheral.
See also
See also
- Parameters:
index – Index of config to use in the MCASP_Config array
openParams – Pointer to parameters to open the driver with
- Pre:
MCASP controller has been initialized using MCASP_init()
- Returns:
A MCASP_Handle on success or a NULL on an error or if it has been opened already
-
void MCASP_close(MCASP_Handle handle)
Function to close a MCASP peripheral specified by the MCASP handle.
See also
- Parameters:
handle – MCASP_Handle returned from MCASP_open()
- Pre:
MCASP_open() has to be called first
-
MCASP_Handle MCASP_getHandle(uint32_t index)
This function returns the handle of an open MCASP Instance from the instance index.
See also
See also
- Parameters:
index – Index of config to use in the MCASP_Config array
- Pre:
MCASP controller has been opened using MCASP_open()
- Returns:
A MCASP_Handle if it has been opened already or NULL otherwise
-
int32_t MCASP_submitTx(MCASP_Handle handle, MCASP_Transaction *txn)
Function to submit the buffer to McASP driver for transmission. Transaction object is held by the driver till it is returned in the callback function. It is recommended not to allocate the transaction object in stack to avoid corruption.
- Parameters:
handle – MCASP_Handle
txn* – Pointer to a MCASP_Transaction
- Returns:
Success/Failure for configuration
-
int32_t MCASP_submitRx(MCASP_Handle handle, MCASP_Transaction *txn)
Function to submit the buffer to McASP driver for reception. Transaction object is held by the driver till it is returned in the callback function. It is recommended not to allocate the transaction object in stack to avoid corruption.
- Parameters:
handle – MCASP_Handle
txn* – Pointer to a MCASP_Transaction
- Returns:
Success/Failure for configuration
-
MCASP_Transaction *MCASP_withdrawTx(MCASP_Handle handle)
Function to withdraw the buffer submitted to McASP driver for transmission. This should be called after the MCASP_stopTransferTx. These buffers are not transmitted.
- Parameters:
handle – MCASP_Handle
- Returns:
Pointer to a MCASP_Transaction. NULL if no more buffers are there with driver.
-
MCASP_Transaction *MCASP_withdrawRx(MCASP_Handle handle)
Function to withdraw the buffer submitted to McASP driver for reception. This should be called after the MCASP_stopTransferRx. These buffers are not transmitted.
- Parameters:
handle – MCASP_Handle
- Returns:
Pointer to a MCASP_Transaction. NULL if no more buffers are there with driver.
-
int32_t MCASP_startTransferTx(MCASP_Handle handle)
Function to start McASP transmission.
- Parameters:
handle – MCASP_Handle
- Returns:
Success/Failure for configuration
-
int32_t MCASP_startTransferRx(MCASP_Handle handle)
Function to start McASP reception.
- Parameters:
handle – MCASP_Handle
- Returns:
Success/Failure for configuration
-
int32_t MCASP_stopTransferTx(MCASP_Handle handle)
Function to stop McASP transmission.
Caution: This API is blocking. Hence cannot be called from ISR context!!
- Parameters:
handle – MCASP_Handle
- Returns:
Success/Failure for configuration
-
int32_t MCASP_stopTransferRx(MCASP_Handle handle)
Function to stop McASP reception.
Caution: This API is blocking. Hence cannot be called from ISR context!!
- Parameters:
handle – MCASP_Handle
- Returns:
Success/Failure for configuration
-
int32_t MCASP_setTxTxnCount(MCASP_Handle handle, uint32_t txnCount)
Function to set the Tx transaction count.
Caution: This API should be called before MCASP_startTransferTx. User needs to ensure the transaction count is matching with the loopjob size.
- Parameters:
handle – MCASP_Handle
txnCount – Tx transaction count
- Returns:
Success/Failure for configuration
-
int32_t MCASP_setRxTxnCount(MCASP_Handle handle, uint32_t txnCount)
Function to set the Rx transaction count.
Caution: This API should be called before MCASP_startTransferRx. User needs to ensure the transaction count is matching with the loopjob size.
- Parameters:
handle – MCASP_Handle
txnCount – Rx transaction count
- Returns:
Success/Failure for configuration
-
int32_t MCASP_getTxQueueStatus(MCASP_Handle handle, MCASP_QueueStatus *qStatus)
Function to get current Tx queue status.
Returns information about pending Tx transactions including number of buffers and total samples awaiting transmission. Used for presentation time calculation.
See also
- Parameters:
handle – MCASP_Handle
qStatus – Pointer to MCASP_QueueStatus to receive queue information
- Returns:
Success (0) or error code if handle or pointer is invalid
-
int32_t MCASP_getTxPresentationTime(MCASP_Handle handle, MCASP_PresentationTime *pTime)
Compute the TX presentation time offset.
Returns the time in microseconds until the first sample currently queued will reach the TDM TX pins. This accounts for all bytes sitting in the software queues (reqQueue + curentQueue) plus any bytes already handed to the DMA but not yet transmitted.
See also
- Parameters:
handle – MCASP_Handle returned by MCASP_open
pTime – Pointer to MCASP_PresentationTime; on success receives:
offsetUs— microseconds of audio data pendingsamplesRemaining— 32-bit word count pending in software queues
- Returns:
SystemP_SUCCESS, or SystemP_FAILURE if any argument is NULL or the DMA statistics query fails
Variables
-
MCASP_Config gMcaspConfig[]
Externally defined driver configuration array.
-
uint32_t gMcaspConfigNum
Externally defined driver configuration array size.
-
struct MCASP_Transaction
- #include <mcasp.h>
Data structure used with transfer call.
Public Members
-
QueueP_Elem qElem
[IN] This should be the first parameter. this is the queue element used by driver.
-
void *buf
[IN] void * to a buffer with data to be transferred . This parameter can’t be NULL
-
uint32_t count
[IN/OUT] Number of bytes for this transaction. This is input incase of read/write call and on API return this represents number of bytes actually read by the API
-
uint32_t timeout
[IN] Timeout for this transaction in units of system ticks
-
int32_t status
[OUT] MCASP_TransferStatus code
-
void *args
[IN] Argument to be passed to the callback function
-
QueueP_Elem qElem
-
struct MCASP_QueueStatus
- #include <mcasp.h>
Queue status structure for MCASP presentation time tracking.
This structure contains information about pending transactions in the MCASP queue, used for calculating presentation time and latency.
-
struct MCASP_PresentationTime
- #include <mcasp.h>
Presentation time structure for MCASP timing calculations.
This structure contains timing information for when samples will be transmitted on the TDM pins, used for accurate audio synchronization.
-
struct MCASP_ClockConfig
- #include <mcasp.h>
Hardware setup data clock structure.
-
struct MCASP_GlobalConfig
- #include <mcasp.h>
Hardware setup global structure.
Public Members
-
uint32_t pfunc
Pin function register
-
uint32_t pdir
Pin direction register
-
uint32_t gblCtl
Global control register - GBLCTL
-
uint32_t ditCtl
whether McASP operates in DIT mode
-
uint32_t dlbCtl
Digital loopback mode setup
-
uint32_t amute
Mute control register - AMUTE
-
uint32_t serSetup[16u]
Setup serializer control register
-
uint32_t pfunc
-
struct MCASP_FifoConfig
- #include <mcasp.h>
Hardware fifo setup structure.
-
struct MCASP_DataConfig
- #include <mcasp.h>
Hardware setup data structure.
Public Members
-
uint32_t mask
To mask or not to mask - R/XMASK
-
uint32_t fmt
Format details as per - R/XFMT
-
uint32_t frSyncCtl
Configure the rcv/xmt frame sync
-
uint32_t tdm
Specifies which TDM slots are active
-
uint32_t intCtl
Controls generation of interrupts
-
uint32_t stat
Status register (controls writable fields of STAT register)-R/XSTAT
-
uint32_t evtCtl
Event control register - R/XEVTCTL
-
MCASP_ClockConfig clk
Clock settings for rcv/xmt
-
MCASP_FifoConfig fifoCfg
Clock settings for rcv/xmt
-
uint32_t mask
-
struct MCASP_HwConfig
- #include <mcasp.h>
Hardware setup structure.
Public Members
-
MCASP_GlobalConfig gbl
Value to be loaded in module setup regs
-
MCASP_DataConfig rx
Receiver settings
-
MCASP_DataConfig tx
Transmitter settings
-
MCASP_GlobalConfig gbl
-
struct MCASP_DmaChConfig
- #include <mcasp.h>
Public Members
-
void *txChHandle
UDMA channel tx handle
-
void *rxChHandle
UDMA channel rx handle
-
void *cqTxEvtHandle
UDMA cq tx event handle
-
void *cqRxEvtHandle
UDMA cq rx event handle
-
void *txTrpdMem
UDMA TX TRPD memory pointers
-
void *rxTrpdMem
UDMA RX TRPD memory pointers
-
uint32_t trpdMemSize
Size of TR PD memory
-
void *txRingMem
UDMA TX Ring memory pointers
-
void *rxRingMem
UDMA RX Ring memory pointers
-
void *txCbParams
UDMA TX callback params
-
void *rxCbParams
UDMA RX callback params
-
uint32_t rxEvtNum
UDMA Event number used for Rx
-
uint32_t txEvtNum
UDMA Event number used for Tx
-
uint32_t isOpen
Flag to indicate whether the DMA instance is opened already
-
void *txChHandle
-
struct MCASP_OpenParams
- #include <mcasp.h>
MCASP Parameters.
MCASP Parameters are used to with the MCASP_open() call. Default values for these parameters are set using MCASP_openParamsInit().
If NULL is passed for the parameters, MCASP_open() uses default parameters.
See also
Public Members
-
uint32_t transferMode
Polling, Blocking or Callback mode.
-
uint8_t txBufferFormat
Audio buffer format for app tx buffer
-
uint8_t rxBufferFormat
Audio buffer format for app rx buffer
-
uint8_t txSerUsedCount
Number of allocated transmit serializers
-
uint8_t rxSerUsedCount
Number of allocated receive serializers
-
uint8_t *txSerUsedArray
POinter to the array of allocated transmit serializer indices
-
uint8_t *rxSerUsedArray
POinter to the array of allocated receive serializer indices
-
uint8_t txSlotCount
Number of slots for trasnmit operation
-
uint8_t rxSlotCount
Number of slots for receive operation
-
MCASP_TxCallbackFxn txCallbackFxn
Read callback function pointer
-
MCASP_RxCallbackFxn rxCallbackFxn
Write callback function pointer
-
uint32_t txLoopjobEnable
Flag to enable loopjob for transmit
-
uint8_t *txLoopjobBuf
Loopjob buffer address for transmit
-
uint32_t txLoopjobBufLength
Loopjob buffer length for transmit
-
uint32_t rxLoopjobEnable
Flag to enable loopjob for receive
-
uint8_t *rxLoopjobBuf
Loopjob buffer address for receive
-
uint32_t rxLoopjobBufLength
Loopjob buffer length for receive
-
MCASP_DmaChConfig *dmaChCfg
DMA channel config
-
void *mcaspDmaDrvObj
BCDMA Handle
-
uint8_t skipDriverOpen
Flag to indicate if driver open should be skipped
-
uint32_t transferMode
-
struct MCASP_HwIntConfig
- #include <mcasp.h>
McASP Interrupt structures.
-
struct MCASP_TransferObj
- #include <mcasp.h>
McASP Transfer Data structure stored in driver object.
Public Members
-
uint32_t inProgress
Flag to indicate if the transfer is ongoing
-
uint32_t state
MCASP Transfer State
-
int32_t status
MCASP_Transfer Status
-
uint32_t count
MCASP Transfer count
-
uint8_t slotCount
number of slots in transaction
-
uint8_t slotIndex
current slot index in ongoing transfer
-
uint8_t frameCount
number of frames in transaction
-
uint8_t frameIndex
current frame index in ongoing transfer
-
uint8_t serCount
Number of allocated serializers
-
uint8_t *serArray
Pointer to the array of allocated serializer indices
-
uint8_t bufferFormat
Audio buffer format for app buffer
-
MCASP_Transaction *transaction
Pointer to current transaction struct
-
MCASP_TxCallbackFxn cbFxn
callback function provided by the app to be called by DMA or Host Audio buffer format for app buffer
-
MCASP_Transaction txnLoopjob
transaction struct object for loopjob buffer
-
uint32_t loopjobEnable
Flag to enable loopjob. when enabled loopjob buffer is transmitted if application fails to load buffers. If disabled minimum of 2 buffers need to be submitted before start and atleast one buffer should be queued before each ISR call.
-
uint32_t inProgress
-
struct MCASP_DmaIcnt
- #include <mcasp.h>
Public Members
-
uint8_t initDone
Flag to indicate if the ICNT is initialized
-
uint32_t txnByteCnt
Byte count for the TR
-
uint16_t icnt0
ICNT0 value for the TR
-
uint16_t icnt1
ICNT1 value for the TR
-
uint16_t icnt2
ICNT2 value for the TR
-
uint16_t icnt3
ICNT3 value for the TR
-
int32_t dim1
Signed dimension for loop level 1
-
int32_t dim2
Signed dimension for loop level 2
-
int32_t dim3
Signed dimension for loop level 3
-
uint8_t initDone
-
struct MCASP_Object
- #include <mcasp.h>
MCASP driver object.
Public Members
-
MCASP_Handle handle
Instance handle
-
uint16_t instNum
Instance number in port
-
uint32_t drvState
stores the current state of the driver
-
uint32_t transferMode
Polling, Blocking or Callback mode.
-
void *mcaspDmaHandle
BCDMA Handle
-
void *mcaspPktDmaHandle
PKTDMA Handle
-
MCASP_DmaChConfig *dmaChCfg
DMA Channel configuration
-
MCASP_TransferObj XmtObj
Holds transmit channel to the McASP.
-
MCASP_TransferObj RcvObj
Holds receive channel to the McASP.
-
uint32_t isOpen
Flag to indicate if the instance is already open
-
uint32_t isTxStarted
Flag to indicate if the Tx is started
-
uint32_t isRxStarted
Flag to indicate if the Rx is started
-
SemaphoreP_Object lockObj
Driver lock object
-
SemaphoreP_Object transferSemObj
Transfer Sync Semaphore object
-
HwiP_Object hwiObjTx
Transmit Interrupt object
-
HwiP_Object hwiObjRx
Receive Interrupt object number of slots used by the mcasp
-
QueueP_Object reqQueueObjTx
-
QueueP_Object curentQueueObjTx
-
QueueP_Object reqQueueObjRx
-
QueueP_Object curentQueueObjRx
Queue Obj to store the application buffers
-
QueueP_Handle reqQueueHandleTx
-
QueueP_Handle curentQueueHandleTx
-
QueueP_Handle reqQueueHandleRx
-
QueueP_Handle curentQueueHandleRx
Queue handle used for storing the application buffers
-
QueueP_Object completedQueueObjRx
Queue object to store completed Rx transactions
-
QueueP_Handle completedQueueHandleRx
Queue handle used for storing completed Rx transactions
-
uint32_t lastPlayed
Last played ring element index
-
uint32_t lastFilled
Last filled ring element index int TX
-
uint32_t lastReceived
Last received ring element index
-
uint32_t lastRecQueued
Last receive txn queued index
-
uint8_t txFifoEnable
Flag to indicate Tx fifo enable
-
uint8_t rxFifoEnable
Flag to indicate Rx fifo enable
-
MCASP_DmaIcnt txDmaIcnt
DMA Icnt values for Tx
-
MCASP_DmaIcnt rxDmaIcnt
DMA Icnt values for Rx
-
uint32_t txSampleRate
sample rate for Tx (samples/sec)
-
uint32_t rxSampleRate
sample rate for Rx (samples/sec)
-
void *txDmaChHandle
UDMA TX channel handle
-
void *rxDmaChHandle
UDMA RX channel handle
-
MCASP_Handle handle
-
struct MCASP_Attrs
- #include <mcasp.h>
MCASP instance attributes - used during init time.
Public Members
-
uint32_t instNum
MCASP instance number
-
uintptr_t baseAddr
Peripheral base address
-
uintptr_t dataBaseAddr
Peripheral data port base address
-
uint8_t isSynchronous
Tx and Rx is operating in synchronous mode
-
uint16_t numOfSerializers
Number of serializers
-
uint16_t serStatus[16]
Holds status information for both the serializers
-
MCASP_HwConfig hwCfg
Register information for initialising the Mcasp hardware.
-
MCASP_HwIntConfig intCfgTx
Transmit interrupt configuration
-
MCASP_HwIntConfig intCfgRx
Receive interrupt configuration
-
uint32_t txSlotSize
slot size for transmission
-
uint32_t rxSlotSize
slot size for reception
-
uint8_t txFifoWaterLevel
FIFO waterlevel for TX
-
uint8_t rxFifoWaterLevel
FIFO waterlevel for RX
-
uint32_t txFsRate
TX frame sync frequency in Hz
-
uint32_t rxFsRate
RX frame sync frequency in Hz
-
uint32_t instNum
-
struct MCASP_Config
- #include <mcasp.h>
Public Members
-
const MCASP_Attrs *attrs
Pointer to driver specific hardware attributes
-
MCASP_Object *object
Pointer to driver specific data object
-
const MCASP_Attrs *attrs