This module contains APIs to program and use the MCASP module. The APIs can be used by other drivers to get access to MCASP and also by application to initiate data transfer operation.
Files | |
file | mcasp/v1/mcasp.h |
MCASP Driver API/interface file. | |
Data Structures | |
struct | MCASP_Transaction |
Data structure used with transfer call. More... | |
struct | MCASP_ClockConfig |
Hardware setup data clock structure. More... | |
struct | MCASP_GlobalConfig |
Hardware setup global structure. More... | |
struct | MCASP_FifoConfig |
Hardware fifo setup structure. More... | |
struct | MCASP_DataConfig |
Hardware setup data structure. More... | |
struct | MCASP_HwConfig |
Hardware setup structure. More... | |
struct | MCASP_DmaChConfig |
struct | MCASP_OpenParams |
MCASP Parameters. More... | |
struct | MCASP_HwIntConfig |
McASP Interrupt structures. More... | |
struct | MCASP_TransferObj |
McASP Transfer Data structure stored in driver object. More... | |
struct | MCASP_DmaIcnt |
struct | MCASP_Object |
MCASP driver object. More... | |
struct | MCASP_Attrs |
MCASP instance attributes - used during init time. More... | |
struct | MCASP_Config |
Functions | |
void | MCASP_init (void) |
This function initializes the MCASP module. More... | |
void | MCASP_deinit (void) |
This function de-initializes the MCASP module. More... | |
static void | MCASP_openParamsInit (MCASP_OpenParams *openPrms) |
Function to initialize the MCASP_OpenParams struct to its defaults. More... | |
MCASP_Handle | MCASP_open (uint32_t index, const MCASP_OpenParams *openParams) |
This function opens a given MCASP peripheral. More... | |
void | MCASP_close (MCASP_Handle handle) |
Function to close a MCASP peripheral specified by the MCASP handle. More... | |
MCASP_Handle | MCASP_getHandle (uint32_t index) |
This function returns the handle of an open MCASP Instance from the instance index. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
int32_t | MCASP_startTransferTx (MCASP_Handle handle) |
Function to start McASP transmission. More... | |
int32_t | MCASP_startTransferRx (MCASP_Handle handle) |
Function to start McASP reception. More... | |
int32_t | MCASP_stopTransferTx (MCASP_Handle handle) |
Function to stop McASP transmission. More... | |
int32_t | MCASP_stopTransferRx (MCASP_Handle handle) |
Function to stop McASP reception. More... | |
int32_t | MCASP_setTxTxnCount (MCASP_Handle handle, uint32_t txnCount) |
Function to set the Tx transaction count. More... | |
int32_t | MCASP_setRxTxnCount (MCASP_Handle handle, uint32_t txnCount) |
Function to set the Rx transaction count. More... | |
Typedefs | |
typedef void * | MCASP_Handle |
A handle that is returned from a MCASP_open() call. More... | |
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. More... | |
typedef void(* | MCASP_RxCallbackFxn) (MCASP_Handle handle, MCASP_Transaction *transaction) |
Macros | |
#define | MCASP_GBLCTL_TIMEOUT (30000U) |
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. More... | |
#define | MCASP_DATA_TIMEOUT (30000U) |
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. More... | |
#define | MCASP_RESET ((uint32_t) 0x00U) |
McASP macros for enable/reset. More... | |
#define | MCASP_ENABLE ((uint32_t) 0x01U) |
#define | MCASP_DISABLE ((uint32_t) 0x00U) |
#define | MCASP_REG_OFFSET ((uint32_t)0x4U) |
#define | MCASP_DIR_OUT (uint32_t) 0 |
#define | MCASP_DIR_IN (uint32_t) 1 |
#define | MCASP_TRPD_INVALID_PTR (0xFFFFFFFF) |
Transfer Status Code | |
Status codes that are set by the MCASP driver | |
#define | MCASP_TRANSFER_STATUS_COMPLETED (0U) |
I/O completed successfully. More... | |
#define | MCASP_TRANSFER_STATUS_STARTED (1U) |
I/O queued and pending. More... | |
#define | MCASP_TRANSFER_STATUS_CANCELLED (2U) |
I/O cancelled. Returned by incomplete read or write requests. More... | |
#define | MCASP_TRANSFER_STATUS_FAILED (3U) |
Generic failure condition. More... | |
#define | MCASP_TRANSFER_STATUS_TIMEOUT (4U) |
I/O timeout occurred. More... | |
McASP Transfer Mode | |
#define | MCASP_TRANSFER_MODE_POLLING (0U) |
MCASP read/write APIs blocks execution. This mode can only be used when called within a Task context. More... | |
#define | MCASP_TRANSFER_MODE_INTERRUPT (1U) |
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. More... | |
#define | MCASP_TRANSFER_MODE_DMA (2U) |
MCASP read/write APIs does not block code execution and will use DMA for transfers. More... | |
McASP Operating Mode | |
OPerating Modes that are supported by the MCASP driver | |
#define | MCASP_OPMODE_MASTER (0U) |
I/O completed successfully. More... | |
#define | MCASP_OPMODE_SLAVE (1U) |
I/O queued and pending. More... | |
MCASP Channel Direction | |
the channel modes supported by Mcasp | |
#define | MCASP_CHANNEL_INPUT (0x0001U) |
MCASP Channel will receive data. More... | |
#define | MCASP_CHANNEL_OUTPUT (0x0002U) |
MCASP Channel will transmit data. More... | |
#define | MCASP_CHANNEL_INOUT (MCASP_CHANNEL_INPUT | MCASP_CHANNEL_OUTPUT) |
McASP channel transmits & recieves data. More... | |
MCASP Driver State | |
Mcasp driver state enums used to track the driver state | |
#define | MCASP_DRIVER_STATE_DELETED (0U) |
#define | MCASP_DRIVER_STATE_CREATED (1U) |
#define | MCASP_DRIVER_STATE_INITIALIZED (2U) |
#define | MCASP_DRIVER_STATE_OPENED (3U) |
#define | MCASP_DRIVER_STATE_CLOSED (4U) |
#define | MCASP_DRIVER_STATE_DEINITIALIZED (5U) |
#define | MCASP_DRIVER_STATE_POWERED_DOWN (6U) |
#define | MCASP_DRIVER_STATE_PWRM_SUSPEND (7U) |
MCASP Serializer Status | |
#define | MCASP_SERIALIZER_STATUS_FREE (0U) |
#define | MCASP_SERIALIZER_STATUS_XMT (1U) |
#define | MCASP_SERIALIZER_STATUS_RCV (2U) |
MCASP Channel Mode | |
#define | MCASP_CHANNEL_MODE_FREE (0U) |
#define | MCASP_CHANNEL_MODE_XMT_DIT (1U) |
#define | MCASP_CHANNEL_MODE_XMT_TDM (2U) |
#define | MCASP_CHANNEL_MODE_RCV (3U) |
MCASP Word Select | |
Enumerated constant for selecting MSB/LSB word in the slot bits | |
#define | MCASP_WORD_SELECT_LSW (0U) |
#define | MCASP_WORD_SELECT_MSW (1U) |
Enumerated constants to specify the supported buffer formats. | |
Interleaved and non-interleaved is standard format, this enumeration captures the standard and custom data formats. | |
#define | MCASP_AUDBUFF_FORMAT_1SER_MULTISLOT_NON_INTERLEAVED (0U) |
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. More... | |
#define | MCASP_AUDBUFF_FORMAT_1SER_MULTISLOT_INTERLEAVED (1U) |
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. More... | |
#define | MCASP_AUDBUFF_FORMAT_MULTISER_MULTISLOT_SEMI_INTERLEAVED_1 (2U) |
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. More... | |
#define | MCASP_AUDBUFF_FORMAT_MULTISER_MULTISLOT_SEMI_INTERLEAVED_2 (3U) |
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. More... | |
Transmit State for McASP transfer | |
Enumeration for McASP transmit state | |
#define | MCASP_TRANSMIT_STATE_TX_RESET (0U) |
#define | MCASP_TRANSMIT_STATE_TX_FLUSH (1U) |
#define | MCASP_TRANSMIT_STATE_LOAD_INIT_BUFFER (2U) |
#define | MCASP_TRANSMIT_STATE_RELEASE_FROM_RESET (3U) |
#define | MCASP_TRANSMIT_STATE_WAIT_EVENT (4U) |
#define | MCASP_TRANSMIT_STATE_PROCESS_EVENT (5U) |
#define | MCASP_TRANSMIT_STATE_LOAD_ACTIVE_BUFFER (6U) |
#define | MCASP_TRANSMIT_STATE_DONE (7U) |
#define | MCASP_TRANSMIT_STATE_SPIN_IDLE (8U) |
#define | MCASP_TRANSMIT_STATE_ERROR (9U) |
#define | MCASP_TRANSMIT_STATE_EXIT (10U) |
Receive State for McASP transfer | |
Enumeration for McASP receive state | |
#define | MCASP_RECEIVE_STATE_RX_RESET (0U) |
#define | MCASP_RECEIVE_STATE_RX_FLUSH (1U) |
#define | MCASP_RECEIVE_STATE_RELEASE_FROM_RESET (2U) |
#define | MCASP_RECEIVE_STATE_WAIT_EVENT (3U) |
#define | MCASP_RECEIVE_STATE_PROCESS_EVENT (4U) |
#define | MCASP_RECEIVE_STATE_DONE (5U) |
#define | MCASP_RECEIVE_STATE_SPIN_IDLE (6U) |
#define | MCASP_RECEIVE_STATE_ERROR (7U) |
#define | MCASP_RECEIVE_STATE_EXIT (8U) |
#define MCASP_GBLCTL_TIMEOUT (30000U) |
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.
#define MCASP_DATA_TIMEOUT (30000U) |
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.
#define MCASP_RESET ((uint32_t) 0x00U) |
McASP macros for enable/reset.
#define MCASP_ENABLE ((uint32_t) 0x01U) |
#define MCASP_DISABLE ((uint32_t) 0x00U) |
#define MCASP_REG_OFFSET ((uint32_t)0x4U) |
#define MCASP_TRANSFER_STATUS_COMPLETED (0U) |
I/O completed successfully.
#define MCASP_TRANSFER_STATUS_STARTED (1U) |
I/O queued and pending.
#define MCASP_TRANSFER_STATUS_CANCELLED (2U) |
I/O cancelled. Returned by incomplete read or write requests.
#define MCASP_TRANSFER_STATUS_FAILED (3U) |
Generic failure condition.
#define MCASP_TRANSFER_STATUS_TIMEOUT (4U) |
I/O timeout occurred.
#define MCASP_TRANSFER_MODE_POLLING (0U) |
MCASP read/write APIs blocks execution. This mode can only be used when called within a Task context.
#define MCASP_TRANSFER_MODE_INTERRUPT (1U) |
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.
#define MCASP_TRANSFER_MODE_DMA (2U) |
MCASP read/write APIs does not block code execution and will use DMA for transfers.
#define MCASP_OPMODE_MASTER (0U) |
I/O completed successfully.
#define MCASP_OPMODE_SLAVE (1U) |
I/O queued and pending.
#define MCASP_CHANNEL_INPUT (0x0001U) |
MCASP Channel will receive data.
#define MCASP_CHANNEL_OUTPUT (0x0002U) |
MCASP Channel will transmit data.
#define MCASP_CHANNEL_INOUT (MCASP_CHANNEL_INPUT | MCASP_CHANNEL_OUTPUT) |
McASP channel transmits & recieves data.
#define MCASP_DRIVER_STATE_DELETED (0U) |
#define MCASP_DRIVER_STATE_CREATED (1U) |
#define MCASP_DRIVER_STATE_INITIALIZED (2U) |
#define MCASP_DRIVER_STATE_OPENED (3U) |
#define MCASP_DRIVER_STATE_CLOSED (4U) |
#define MCASP_DRIVER_STATE_DEINITIALIZED (5U) |
#define MCASP_DRIVER_STATE_POWERED_DOWN (6U) |
#define MCASP_DRIVER_STATE_PWRM_SUSPEND (7U) |
#define MCASP_SERIALIZER_STATUS_FREE (0U) |
#define MCASP_SERIALIZER_STATUS_XMT (1U) |
#define MCASP_SERIALIZER_STATUS_RCV (2U) |
#define MCASP_CHANNEL_MODE_FREE (0U) |
#define MCASP_CHANNEL_MODE_XMT_DIT (1U) |
#define MCASP_CHANNEL_MODE_XMT_TDM (2U) |
#define MCASP_CHANNEL_MODE_RCV (3U) |
#define MCASP_WORD_SELECT_LSW (0U) |
#define MCASP_WORD_SELECT_MSW (1U) |
#define MCASP_AUDBUFF_FORMAT_1SER_MULTISLOT_NON_INTERLEAVED (0U) |
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.
#define MCASP_AUDBUFF_FORMAT_1SER_MULTISLOT_INTERLEAVED (1U) |
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.
#define MCASP_AUDBUFF_FORMAT_MULTISER_MULTISLOT_SEMI_INTERLEAVED_1 (2U) |
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.
#define MCASP_AUDBUFF_FORMAT_MULTISER_MULTISLOT_SEMI_INTERLEAVED_2 (3U) |
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.
#define MCASP_TRANSMIT_STATE_TX_RESET (0U) |
#define MCASP_TRANSMIT_STATE_TX_FLUSH (1U) |
#define MCASP_TRANSMIT_STATE_LOAD_INIT_BUFFER (2U) |
#define MCASP_TRANSMIT_STATE_RELEASE_FROM_RESET (3U) |
#define MCASP_TRANSMIT_STATE_WAIT_EVENT (4U) |
#define MCASP_TRANSMIT_STATE_PROCESS_EVENT (5U) |
#define MCASP_TRANSMIT_STATE_LOAD_ACTIVE_BUFFER (6U) |
#define MCASP_TRANSMIT_STATE_DONE (7U) |
#define MCASP_TRANSMIT_STATE_SPIN_IDLE (8U) |
#define MCASP_TRANSMIT_STATE_ERROR (9U) |
#define MCASP_TRANSMIT_STATE_EXIT (10U) |
#define MCASP_RECEIVE_STATE_RX_RESET (0U) |
#define MCASP_RECEIVE_STATE_RX_FLUSH (1U) |
#define MCASP_RECEIVE_STATE_RELEASE_FROM_RESET (2U) |
#define MCASP_RECEIVE_STATE_WAIT_EVENT (3U) |
#define MCASP_RECEIVE_STATE_PROCESS_EVENT (4U) |
#define MCASP_RECEIVE_STATE_DONE (5U) |
#define MCASP_RECEIVE_STATE_SPIN_IDLE (6U) |
#define MCASP_RECEIVE_STATE_ERROR (7U) |
#define MCASP_RECEIVE_STATE_EXIT (8U) |
#define MCASP_DIR_OUT (uint32_t) 0 |
#define MCASP_DIR_IN (uint32_t) 1 |
#define MCASP_TRPD_INVALID_PTR (0xFFFFFFFF) |
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.
handle | MCASP_Handle |
transaction* | Pointer to a MCASP_Transaction |
typedef void(* MCASP_RxCallbackFxn) (MCASP_Handle handle, MCASP_Transaction *transaction) |
void MCASP_init | ( | void | ) |
This function initializes the MCASP module.
void MCASP_deinit | ( | void | ) |
This function de-initializes the MCASP module.
|
inlinestatic |
Function to initialize the MCASP_OpenParams struct to its defaults.
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.
index | Index of config to use in the MCASP_Config array |
openParams | Pointer to parameters to open the driver with |
void MCASP_close | ( | MCASP_Handle | handle | ) |
Function to close a MCASP peripheral specified by the MCASP handle.
handle | MCASP_Handle returned from MCASP_open() |
MCASP_Handle MCASP_getHandle | ( | uint32_t | index | ) |
This function returns the handle of an open MCASP Instance from the instance index.
index | Index of config to use in the MCASP_Config array |
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.
handle | MCASP_Handle |
txn* | Pointer to a MCASP_Transaction |
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.
handle | MCASP_Handle |
txn* | Pointer to a MCASP_Transaction |
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.
handle | MCASP_Handle |
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.
handle | MCASP_Handle |
int32_t MCASP_startTransferTx | ( | MCASP_Handle | handle | ) |
Function to start McASP transmission.
handle | MCASP_Handle |
int32_t MCASP_startTransferRx | ( | MCASP_Handle | handle | ) |
Function to start McASP reception.
handle | MCASP_Handle |
int32_t MCASP_stopTransferTx | ( | MCASP_Handle | handle | ) |
Function to stop McASP transmission.
handle | MCASP_Handle |
Caution: This API is blocking. Hence cannot be called from ISR context!!
int32_t MCASP_stopTransferRx | ( | MCASP_Handle | handle | ) |
Function to stop McASP reception.
handle | MCASP_Handle |
Caution: This API is blocking. Hence cannot be called from ISR context!!
int32_t MCASP_setTxTxnCount | ( | MCASP_Handle | handle, |
uint32_t | txnCount | ||
) |
Function to set the Tx transaction count.
handle | MCASP_Handle |
txnCount | 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.
int32_t MCASP_setRxTxnCount | ( | MCASP_Handle | handle, |
uint32_t | txnCount | ||
) |
Function to set the Rx transaction count.
handle | MCASP_Handle |
txnCount | 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.
|
extern |
Externally defined driver configuration array.
|
extern |
Externally defined driver configuration array size.