AM62Px MCU+ SDK  10.01.00
mcasp/v1/mcasp.h File Reference

Introduction

MCASP Driver API/interface file.

Go to the source code of this 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_Object
 MCASP driver object. More...
 
struct  MCASP_Attrs
 MCASP instance attributes - used during init time. More...
 
struct  MCASP_Config
 

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   0
 
#define MCASP_DIR_IN   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

Enumeration for serializer status

#define MCASP_SERIALIZER_STATUS_FREE   (0U)
 
#define MCASP_SERIALIZER_STATUS_XMT   (1U)
 
#define MCASP_SERIALIZER_STATUS_RCV   (2U)
 
MCASP Channel Mode

Enumeration for 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)
 

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)
 

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_TransactionMCASP_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_TransactionMCASP_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...
 

Variables

MCASP_Config gMcaspConfig []
 Externally defined driver configuration array. More...
 
uint32_t gMcaspConfigNum
 Externally defined driver configuration array size. More...