AM273x MCU+ SDK  08.02.00
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

  • Blocking Polled mode operation
  • Transmit and Receive in TDM mode
  • Internal Loopback mode

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.

There is a limited support for the SysConfig currently for Mcasp driver.

  • Only the insatnce used can be selected currently.
  • Note: Until register configurations are supported through SysConfig, user needs to use hardcoded McASP register configurations defined in <mcasp_loopback\am273x-evm\c66ss0_nortos\ti-c6000\generated\ti_drivers_config.c> For e.g. changing slot count, clock dividers, etc, this structure has to be modified manually by referring the register descriptions in the device TRM.

Features NOT Supported

  • Interrupt/DMA mode
  • Transmit in DIT mode

Usage Overview

API Sequence

To use the MCASP driver to send data over the MCASP interface, the application calls the following APIs:

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;
gMcaspHandle = MCASP_open(CONFIG_MCASP0, &mcaspParams);
DebugP_assert(gMcaspHandle != NULL);

Instance Close Example

MCASP_close(gMcaspHandle);

Loopback Transfer Example

MCASP_Transaction loopTxn = {0};
uint8_t mcaspTxBuffer[APP_MCASP_MSGSIZE];
uint8_t mcaspRxBuffer[APP_MCASP_MSGSIZE];
loopTxn.txBuf = (void*) &mcaspTxBuffer[0];
loopTxn.rxBuf = (void*) &mcaspRxBuffer[0];
loopTxn.count = APP_MCASP_MSGSIZE/4;
loopTxn.timeout = 0xFFFFFF;
MCASP_transfer(gMcaspHandle, &loopTxn);

API

APIs for MCASP

MCASP_close
void MCASP_close(MCASP_Handle handle)
Function to close a MCASP peripheral specified by the MCASP handle.
MCASP_Transaction::rxBuf
void * rxBuf
Definition: mcasp/v0/mcasp.h:275
MCASP_Transaction::txBuf
void * txBuf
Definition: mcasp/v0/mcasp.h:272
MCASP_open
MCASP_Handle MCASP_open(uint32_t index, const MCASP_OpenParams *openParams)
This function opens a given MCASP peripheral.
MCASP_transfer
int32_t MCASP_transfer(MCASP_Handle handle, MCASP_Transaction *txn)
Generic transfer function using McASP.
MCASP_Transaction
Data structure used with transfer call.
Definition: mcasp/v0/mcasp.h:271
MCASP_OpenParams
MCASP Parameters.
Definition: mcasp/v0/mcasp.h:394
MCASP_Transaction::count
uint32_t count
Definition: mcasp/v0/mcasp.h:278
mcasp.h
MCASP_OpenParams::edmaInst
uint32_t edmaInst
Definition: mcasp/v0/mcasp.h:395
MCASP_openParamsInit
static void MCASP_openParamsInit(MCASP_OpenParams *openPrms)
Function to initialize the MCASP_OpenParams struct to its defaults.
Definition: mcasp/v0/mcasp.h:622
MCASP_Transaction::timeout
uint32_t timeout
Definition: mcasp/v0/mcasp.h:282
DebugP_assert
#define DebugP_assert(expression)
Function to call for assert check.
Definition: DebugP.h:159