mcbsp_drv.h File Reference

McBSP driver interface definition file. More...

#include <ti/csl/cslr_device.h>
#include <ti/csl/cslr_mcbsp.h>
#include "mcbspver.h"

Data Structures

struct  Mcbsp_srgConfig_t
 McBSP sample rate generator configuration structure. More...
struct  Mcbsp_DataConfig_t
 Mcbsp TX/RX section configuration structure. More...
struct  Mcbsp_McrSetup_t
 Mcbsp multi channel control settings. More...
struct  Mcbsp_ClkSetup_t
 Mcbsp clock settings setup structure. More...
struct  Mcbsp_HwInfo_Unpadded
 Mcbsp Hardware specific information Object. More...
struct  Mcbsp_TempBuffer_t
 Loop job buffer structure. This structure defines the format of the Loop job buffer. More...
struct  Mcbsp_ChanParams_t
 McBSP channel setup params. More...
struct  Mcbsp_Params_t
 McBSP device create params. More...
struct  Mcbsp_QueueElem_t
 McBSP queue element. More...
struct  Mcbsp_IOBuf_t
 McBSP frame object params. More...

Defines

#define Mcbsp_POLLED_RETRYCOUNT   (0xFFFFu)
#define MCBSP_CACHE_LENGTH   (128u)
#define MCBSP_MAX_CACHE_ALIGN   (128u)
#define MCBSP_COMPILE_TIME_SIZE_CHECK(postulate)
#define MCBSP_MODE_INPUT   0x0001
 McBSP Create Modes.
#define MCBSP_MODE_OUTPUT   0x0002
#define MCBSP_MODE_INOUT   (MCBSP_MODE_INPUT | MCBSP_MODE_OUTPUT)
#define MCBSP_STATUS_COMPLETED   0
 McBSP Driver Status Codes.
#define MCBSP_STATUS_PENDING   1
#define MCBSP_STATUS_FLUSHED   2
#define MCBSP_STATUS_ABORTED   3
#define MCBSP_ERR_BADIO   -1
 McBSP Driver Error Codes.
#define MCBSP_ERR_TIMEOUT   -2
#define MCBSP_ERR_NOIOBUFFERS   -3
#define MCBSP_ERR_FREE   -4
#define MCBSP_ERR_ALLOC   -5
#define MCBSP_ERR_ABORT   -6
#define MCBSP_ERR_BADMODE   -7
#define MCBSP_ERR_EOF   -8
#define MCBSP_ERR_NOTIMPL   -9
#define MCBSP_ERR_BADARGS   -10
#define MCBSP_ERR_TIMEOUTUNREC   -11
#define MCBSP_ERR_INUSE   -12
#define Mcbsp_IOBuf_Cmd_READ   0
 McBSP Driver Buffer Frame Command Codes.
#define Mcbsp_IOBuf_Cmd_WRITE   1
#define Mcbsp_IOBuf_Cmd_ABORT   2
#define Mcbsp_IOBuf_Cmd_FLUSH   3
#define MCBSP_CTRL_CHAN_RESET   0
 McBSP Driver Command Codes Reserved for Control.
#define MCBSP_CTRL_CHAN_TIMEDOUT   1
#define MCBSP_CTRL_DEVICE_RESET   2

Typedefs

typedef enum Mcbsp_DevMode_t Mcbsp_DevMode
 Mcbsp device operational mode.
typedef enum Mcbsp_OpMode_t Mcbsp_OpMode
 Mcbsp driver operational mode.
typedef enum Mcbsp_EmuMode_t Mcbsp_EmuMode
 Mcbsp Emulation mode settings.
typedef enum Mcbsp_Loopback_t Mcbsp_Loopback
 McBSP digital loopback mode selection.
typedef enum Mcbsp_Rxjust_t Mcbsp_Rxjust
 ENUM for receive data justification settings.
typedef enum Mcbsp_DxEna_t Mcbsp_DxEna
 Transmit pin mode configuration.
typedef enum Mcbsp_ClkSPol_t Mcbsp_ClkSPol
 Polarity of the CLKS pin.
typedef enum Mcbsp_SrgClk_t Mcbsp_SrgClk
 SRG clock source.
typedef enum Mcbsp_BufferFormat_t Mcbsp_BufferFormat
 Enum to specify the supported buffer formats.
typedef enum Mcbsp_Phase_t Mcbsp_Phase
 Mcbsp PHASE control enums.
typedef enum Mcbsp_WordLength_t Mcbsp_WordLength
 Mcbsp supported wordlength.
typedef enum Mcbsp_FrmSync_t Mcbsp_FrmSync
 Frame sync ignore status enum.
typedef enum Mcbsp_DataDelay_t Mcbsp_DataDelay
 Enum to select Data delay in bits.
typedef enum Mcbsp_Compand_t Mcbsp_Compand
 Enum to select the companding law.
typedef enum Mcbsp_BitReversal_t Mcbsp_BitReversal
 McBSP 32-bit reversal feature.
typedef enum Mcbsp_FsClkMode_t Mcbsp_FsClkMode
 Frame sync clock source.
typedef enum Mcbsp_TxRxClkMode_t Mcbsp_TxRxClkMode
 Clock source selection ENUM.
typedef enum Mcbsp_ClkPol_t Mcbsp_ClkPol
 Clock polarity.
typedef enum Mcbsp_FsPol_t Mcbsp_FsPol
 Frame sync polarity.
typedef enum Mcbsp_IntMode_t Mcbsp_IntMode
 MCBSP Interrupt mode.
typedef enum Mcbsp_McmMode_t Mcbsp_McmMode
 Transmit multichannel selection mode bit.
typedef enum Mcbsp_PartitionSel_t Mcbsp_PartitionSel
 Partition A/B block channel selection bit.
typedef enum Mcbsp_PartitionMode_t Mcbsp_PartitionMode
 Multichannel partition mode selection.
typedef struct Mcbsp_srgConfig_t Mcbsp_srgConfig
 McBSP sample rate generator configuration structure.
typedef struct Mcbsp_DataConfig_t Mcbsp_DataConfig
 Mcbsp TX/RX section configuration structure.
typedef struct Mcbsp_McrSetup_t Mcbsp_McrSetup
 Mcbsp multi channel control settings.
typedef struct Mcbsp_ClkSetup_t Mcbsp_ClkSetup
 Mcbsp clock settings setup structure.
typedef struct Mcbsp_TempBuffer_t Mcbsp_TempBuffer
 Loop job buffer structure. This structure defines the format of the Loop job buffer.
typedef void(* Mcbsp_GblErrCallback )(uint32_t Arg1, uint32_t Arg2, uint32_t Arg3)
 Global error callback function protype.
typedef struct Mcbsp_ChanParams_t Mcbsp_ChanParams
 McBSP channel setup params.
typedef struct Mcbsp_Params_t Mcbsp_Params
 McBSP device create params.
typedef struct Mcbsp_QueueElem_t Mcbsp_QueueElem
 McBSP queue element.
typedef struct Mcbsp_IOBuf_t Mcbsp_IOBuf
 McBSP frame object params.
typedef void(* Mcbsp_CallbackFxn )(void *arg, Mcbsp_IOBuf *ioBuf)
 MCBSP driver callback function.
typedef enum Mcbsp_IOCTL_t Mcbsp_IOCTL
 McBSP Ioctl commands.

Enumerations

enum  Mcbsp_DevMode_t { Mcbsp_DevMode_McBSP = (0u) }
 

Mcbsp device operational mode.

More...
enum  Mcbsp_OpMode_t { Mcbsp_OpMode_POLLED = 0, Mcbsp_OpMode_INTERRUPT, Mcbsp_OpMode_DMAINTERRUPT }
 

Mcbsp driver operational mode.

More...
enum  Mcbsp_EmuMode_t { Mcbsp_EmuMode_SOFT_ABORT = (0u), Mcbsp_EmuMode_SOFT_STOP = (1u), Mcbsp_EmuMode_FREE = (2u) }
 

Mcbsp Emulation mode settings.

More...
enum  Mcbsp_Loopback_t { Mcbsp_Loopback_DISABLE = 0, Mcbsp_Loopback_ENABLE = 1 }
 

McBSP digital loopback mode selection.

More...
enum  Mcbsp_Rxjust_t { Mcbsp_RxJust_RZF = (0u), Mcbsp_RxJust_RSE = (1u), Mcbsp_RxJust_RxJUST_LZF = (2u) }
 

ENUM for receive data justification settings.

More...
enum  Mcbsp_DxEna_t { Mcbsp_DxEna_OFF = (0), Mcbsp_DxEna_ON = (1u) }
 

Transmit pin mode configuration.

More...
enum  Mcbsp_ClkSPol_t { Mcbsp_ClkSPol_RISING_EDGE = 0, Mcbsp_ClkSPol_FALLING_EDGE = 1 }
 

Polarity of the CLKS pin.

More...
enum  Mcbsp_SrgClk_t { Mcbsp_SrgClk_CLKS = (0u), Mcbsp_SrgClk_CLKCPU = (1u), Mcbsp_SrgClk_CLKR = (2u), Mcbsp_SrgClk_CLKX = (3u) }
 

SRG clock source.

More...
enum  Mcbsp_BufferFormat_t
 

Enum to specify the supported buffer formats.

More...
enum  Mcbsp_Phase_t { Mcbsp_Phase_SINGLE = (0u), Mcbsp_Phase_DUAL = (1u) }
 

Mcbsp PHASE control enums.

More...
enum  Mcbsp_WordLength_t {
  Mcbsp_WordLength_8 = 8u, Mcbsp_WordLength_12 = 12u, Mcbsp_WordLength_16 = 16u, Mcbsp_WordLength_20 = 20u,
  Mcbsp_WordLength_24 = 24u, Mcbsp_WordLength_32 = 32u
}
 

Mcbsp supported wordlength.

More...
enum  Mcbsp_FrmSync_t { Mcbsp_FrmSync_DETECT = (0u), Mcbsp_FrmSync_IGNORE = (1u) }
 

Frame sync ignore status enum.

More...
enum  Mcbsp_DataDelay_t { Mcbsp_DataDelay_0_BIT = (0u), Mcbsp_DataDelay_1_BIT = (1u), Mcbsp_DataDelay_2_BIT = (2u) }
 

Enum to select Data delay in bits.

More...
enum  Mcbsp_Compand_t { Mcbsp_Compand_OFF_MSB_FIRST = (0u), Mcbsp_Compand_OFF_LSB_FIRST = (1u), Mcbsp_Compand_MULAW = (2u), Mcbsp_Compand_ALAW = (3u) }
 

Enum to select the companding law.

More...
enum  Mcbsp_BitReversal_t { Mcbsp_BitReversal_DISABLE = (0u), Mcbsp_BitReversal_ENABLE = (1u) }
 

McBSP 32-bit reversal feature.

More...
enum  Mcbsp_FsClkMode_t { Mcbsp_FsClkMode_EXTERNAL = (0u), Mcbsp_FsClkMode_INTERNAL = (1u), Mcbsp_FsClkMode_DXR_XSR = (2u) }
 

Frame sync clock source.

More...
enum  Mcbsp_TxRxClkMode_t { Mcbsp_TxRxClkMode_EXTERNAL = (0u), Mcbsp_TxRxClkMode_INTERNAL = (1u) }
 

Clock source selection ENUM.

More...
enum  Mcbsp_ClkPol_t { Mcbsp_ClkPol_RISING_EDGE = (0u), Mcbsp_ClkPol_FALLING_EDGE = (1u), Mcbsp_ClkPol_SRG_RISING_EDGE = (0u), Mcbsp_ClkPol_SRG_FALLING_EDGE = (1u) }
 

Clock polarity.

More...
enum  Mcbsp_FsPol_t { Mcbsp_FsPol_ACTIVE_HIGH = (0u), Mcbsp_FsPol_ACTIVE_LOW = (1u) }
 

Frame sync polarity.

More...
enum  Mcbsp_IntMode_t { Mcbsp_IntMode_ON_READY = (0u), Mcbsp_IntMode_ON_EOB = (1u), Mcbsp_IntMode_ON_FSYNC = (2u), Mcbsp_IntMode_ON_SYNCERR = (3u) }
 

MCBSP Interrupt mode.

More...
enum  Mcbsp_McmMode_t { Mcbsp_McmMode_ALL_CHAN_ENABLED_UNMASKED = (0u), Mcbsp_McmMode_ALL_CHAN_DISABLED_UNMASKED = (1u), Mcbsp_McmMode_ALL_CHAN_ENABLED_MASKED = (2u), Mcbsp_McmMode_ALL_CHAN_DISABLED_MASKED = (3u) }
 

Transmit multichannel selection mode bit.

More...
enum  Mcbsp_PartitionSel_t {
  Mcbsp_PartitionMode_CHAN_0_15 = (0u), Mcbsp_PartitionMode_CHAN_16_31 = (0u), Mcbsp_PartitionMode_CHAN_32_47 = (1u), Mcbsp_PartitionMode_CHAN_48_63 = (1u),
  Mcbsp_PartitionMode_CHAN_64_79 = (2u), Mcbsp_PartitionMode_CHAN_80_95 = (2u), Mcbsp_PartitionMode_CHAN_96_111 = (3u), Mcbsp_PartitionMode_CHAN_112_127 = (3u)
}
 

Partition A/B block channel selection bit.

More...
enum  Mcbsp_PartitionMode_t { Mcbsp_PartitionMode_2 = (0u), Mcbsp_PartitionMode_8 = (1u) }
 

Multichannel partition mode selection.

More...
enum  Mcbsp_IOCTL_t {
  Mcbsp_IOCTL_START = 128, Mcbsp_IOCTL_SAMPLE_RATE_CHANGE, Mcbsp_IOCTL_STOP, Mcbsp_IOCTL_SRGR_START,
  Mcbsp_IOCTL_SRGR_STOP, Mcbsp_IOCTL_FSGR_START, Mcbsp_IOCTL_FSGR_STOP, Mcbsp_IOCTL_SET_TIMEOUT,
  Mcbsp_IOCTL_MUTE_ON, Mcbsp_IOCTL_MUTE_OFF, Mcbsp_IOCTL_PAUSE, Mcbsp_IOCTL_RESUME,
  Mcbsp_IOCTL_CHAN_RESET, Mcbsp_IOCTL_DEVICE_RESET, Mcbsp_IOCTL_SET_CLKMODE, Mcbsp_IOCTL_SET_FRMSYNCMODE,
  Mcbsp_IOCTL_CONFIG_SRGR, Mcbsp_IOCTL_SET_BCLK_POL, Mcbsp_IOCTL_SET_FRMSYNC_POL, Mcbsp_IOCTL_MODIFY_LOOPJOB,
  Mcbsp_IOCTL_SYNCERR_INT_ENABLE, Mcbsp_IOCTL_LOOPBACK, Mcbsp_IOCTL_CANCEL_PENDING_IO
}
 

McBSP Ioctl commands.

More...

Functions

int32_t mcbspInit (void)
int32_t mcbspBindDev (void **devp, int32_t devid, void *devParams)
 Allocates and configures the McBSP instance specified by devid.
int32_t mcbspUnBindDev (void *devp)
 Closes the McBSP device instance from use. This API is called by the application when it no longer requires the device instance. Note that all the channels have to be closed for the device instance to be deleted sucessfully.
int32_t mcbspCreateChan (void **chanp, void *devp, int32_t mode, void *chanParams, Mcbsp_CallbackFxn cbFxn, void *cbArg)
 Creates a communication channel in specified mode to communicate data between the application and the McBSP device instance. This function sets the required hardware configurations for the data transactions. It returns configured channel handle to application which will be used in all further transactions with the channel.
int32_t mcbspDeleteChan (void *chanp)
 frees a channel and all it's associated resources.
int32_t mcbspSubmitChan (void *chanp, Mcbsp_IOBuf *const ioBuf)
 Submit a I/O buffer to a channel for processing.
int32_t mcbspControlChan (void *chanp, Mcbsp_IOCTL cmd, void *arg)
 Implements the IOCTLS for McBSP driver.
void mcbspGblXmtIsr (void *hChan)
 McBSP Tx ISR function.
void mcbspGblRcvIsr (void *hChan)
 McBSP Rx ISR function.

Detailed Description

McBSP driver interface definition file.

This file contains the interfaces, data types and symbolic definitions that are needed by the application to utilize the services of the McBSP device driver.

(C) Copyright 2012, Texas Instruments, Inc


Define Documentation

#define MCBSP_CACHE_LENGTH   (128u)

Defines the Maximum length of cache line that is possible.

#define MCBSP_COMPILE_TIME_SIZE_CHECK ( postulate   ) 
Value:
do {                                                                       \
       typedef struct {                                                       \
         uint8_t McbspNegativeSizeIfPostulateFalse[((int)(postulate))*2 - 1]; \
       } McbspPostulateCheck_t;                                               \
   }                                                                          \
   while (0)

This macro generates compiler error if postulate is false, so allows 0 overhead compile time size check. This "works" when the expression contains sizeof() which otherwise doesn't work with preprocessor.

#define MCBSP_CTRL_CHAN_RESET   0

McBSP Driver Command Codes Reserved for Control.

Mcbsp driver command codes reserved for control.

Reset channel only

#define MCBSP_CTRL_CHAN_TIMEDOUT   1

Channel timeout occured

#define MCBSP_CTRL_DEVICE_RESET   2

Reset entire device

#define MCBSP_ERR_ABORT   -6

I/O was aborted before completed

#define MCBSP_ERR_ALLOC   -5

Unable to allocate resource

#define MCBSP_ERR_BADARGS   -10

Invalid arguments specified

#define MCBSP_ERR_BADIO   -1

McBSP Driver Error Codes.

Mcbsp driver error codes.

Generic failure condition

#define MCBSP_ERR_BADMODE   -7

Invalid device mode

#define MCBSP_ERR_EOF   -8

End-of-File was encountered

#define MCBSP_ERR_FREE   -4

Unable to free resources

#define MCBSP_ERR_INUSE   -12

Device already in use

#define MCBSP_ERR_NOIOBUFFERS   -3

No buffers available for I/O

#define MCBSP_ERR_NOTIMPL   -9

Operation not implemented or supported

#define MCBSP_ERR_TIMEOUT   -2

Timeout occurred

#define MCBSP_ERR_TIMEOUTUNREC   -11

Unrecoverable timeout occurred

#define Mcbsp_IOBuf_Cmd_ABORT   2

Abort command

#define Mcbsp_IOBuf_Cmd_FLUSH   3

Flush command

#define Mcbsp_IOBuf_Cmd_READ   0

McBSP Driver Buffer Frame Command Codes.

Mcbsp driver frame command codes.

Read command

#define Mcbsp_IOBuf_Cmd_WRITE   1

Write command

#define MCBSP_MAX_CACHE_ALIGN   (128u)

Defines the Maximum cache line size for alignment.

#define MCBSP_MODE_INOUT   (MCBSP_MODE_INPUT | MCBSP_MODE_OUTPUT)

Defines the mode as input and output.

#define MCBSP_MODE_INPUT   0x0001

McBSP Create Modes.

Mcbsp driver create functions take a mode parameter.

Defines the mode as input.

#define MCBSP_MODE_OUTPUT   0x0002

Defines the mode as output.

#define Mcbsp_POLLED_RETRYCOUNT   (0xFFFFu)

This macro specifies the default retry count to be used by the Mcbsp driver when polling for any hardware bit to be set or reset.

Note:
This default value used by the driver can be changed by an IOCTL "Mcbsp_Ioctl_SET_TIMEOUT".
#define MCBSP_STATUS_ABORTED   3

Defines the status as request aborted. Non-completed read or write requests return w/ MCBSP_STATUS_ABORTED.

#define MCBSP_STATUS_COMPLETED   0

McBSP Driver Status Codes.

Mcbsp driver status codes.

Defines the status as completed successfully.

#define MCBSP_STATUS_FLUSHED   2

Defines the status as request flushed. Queued writes will be completed w/ MCBSP_STATUS_COMPLETED. Queued read requests return w/ MCBSP_STATUS_FLUSHED.

#define MCBSP_STATUS_PENDING   1

Defines the status as queued and pending.


Typedef Documentation

McBSP 32-bit reversal feature.

This ENUM allows the user to select the option of BIT reversal. McBSP 32-bit reversal feature

Enum to specify the supported buffer formats.

Interleaved and non-interleaved is standard format, this enumeration captures the standard and custom data formats. Mcbsp supported buffer formats

typedef void(* Mcbsp_CallbackFxn)(void *arg, Mcbsp_IOBuf *ioBuf)

MCBSP driver callback function.

This is the driver's callback function. The driver will call a function of this type whenever an I/O operation is over.

McBSP channel setup params.

This structure holds configuration to be used for creating a channel of the Mcbsp. These parameters need to be specified during the creation of the channel. Mcbsp Channel setup parameters

Clock polarity.

Use this symbol to set XMT or RCV clock polarity as rising or falling edge Clock polarity

Mcbsp clock settings setup structure.

This structure contains the information required to configure the clocks for the Mcbsp.Both the frame sync settings and the bit clock settings can be configured in this structure. Mcbsp clock settings setup structure

Polarity of the CLKS pin.

Enum to Set the polarity of the CLKS pin used to generate Frame Sync and bit clock Polarity of the CLKS pin

Enum to select the companding law.

Use this Enum to select the appropriate companding rule applicable. Enum to select the companding law

Mcbsp TX/RX section configuration structure.

This strcuture specifies the configuration for the McBSP data stream including the whether it is single phase or dual phase, number of frames,the word length in each phase and data delay etc. Mcbsp TX/RX section configuration structure.

Enum to select Data delay in bits.

Use this Enum to set XMT/RCV Data Delay (in bits) Enum to select Data delay in bits

Mcbsp device operational mode.

This enum is used to define the operational mode of the mcbsp device like normal mcbsp device. Mcbsp device operational mode.

typedef enum Mcbsp_DxEna_t Mcbsp_DxEna

Transmit pin mode configuration.

DX pin settings used for setting the pin in high impedance mode. DX pin High impedance enable/disable option

Mcbsp Emulation mode settings.

Use this symbol to set the Emulation Mode to Free mode or any other mode.

Note:
The SOFT mode settings are applicable only is the FREE mode is disabled.Hence if the soft mode is selected (both enable or disable) the driver will internally disable the FREE mode. Mcbsp emulation modes

Frame sync ignore status enum.

Note:
Use this symbol to detect or ignore frame synchronisation Frame sync detection options ENUMERATION

Frame sync clock source.

Use this ENUM to set the frame sync clock source as internal or external Frame sync clock source

typedef enum Mcbsp_FsPol_t Mcbsp_FsPol

Frame sync polarity.

Use this symbol to set frame sync polarity as active-high or active-low Frame sync polarity

typedef void(* Mcbsp_GblErrCallback)(uint32_t Arg1, uint32_t Arg2, uint32_t Arg3)

Global error callback function protype.

This is the global error callback function for the McBSP driver. This function is called directly called from ISR context in case of error.

Note:
Since this function is called from an ISR context,care should be taken that this function conforms to ISR coding guidelines.

MCBSP Interrupt mode.

Use this symbol to set Interrupt mode (i.e. source of interrupt generation).This symbol is used on both RCV and XMT for RINT and XINT generation mode. MCBSP Interrupt mode

typedef struct Mcbsp_IOBuf_t Mcbsp_IOBuf

McBSP frame object params.

Mcbsp_IOBuf structures are managed by the driver. MCBSP buffers are the basis for all I/O operations. 'cmd' field contains the command id for the driver. 'status' is filled in by the driver and contains the status of the commmand. Mcbsp frame object params

typedef enum Mcbsp_IOCTL_t Mcbsp_IOCTL

McBSP Ioctl commands.

List of all the ioctl commands supported by the Mcbsp driver. McBSP Ioctl commands list

McBSP digital loopback mode selection.

Enum to select the enable/disable of Loopback mode of the mcbsp. McBSP digital loopback mode selection

Transmit multichannel selection mode bit.

MCM determines whether all channels or only selected channels are enabled and unmasked for transmission/reception. Transmit multichannel selection mode bit.

Mcbsp multi channel control settings.

structure to configure the multi channel settings for the mcbsp.used when the multi channel configuration is to be enabled. Mcbsp multi channel control settings

Mcbsp driver operational mode.

Enumeration of the different modes of operation available for the Mcbsp device driver.(Mcbsp driver supports only EDMA mode). Mcbsp driver operational mode

typedef struct Mcbsp_Params_t Mcbsp_Params

McBSP device create params.

This structure holds the configuration to be used for the creation of the Mcbsp device instance.This configuration need to be supplied during the creation of the device instance. McBSP device setup params

Multichannel partition mode selection.

Multichannel mode allows selection of either an 2 partition mode or 8 partition mode.This enum allows the user to select the required partition mode of choice. Multichannel partition mode selction

Partition A/B block channel selection bit.

Partition A/B block selection bit.

typedef enum Mcbsp_Phase_t Mcbsp_Phase

Mcbsp PHASE control enums.

Note:
These enums are used to control the Phase settings of the MCBSP. Mcbsp frame phase selection ENUMERATION

McBSP queue element.

Doubly linked list for queue elements. Required for Mcbsp_IOBuf structure.

ENUM for receive data justification settings.

Use this symbol for setting up RCV sign-extension and justification mode Enumeration for the Receive data justification

SRG clock source.

Use this symbol to select input clock source for Sample Rate Generator SRG clock source selection

McBSP sample rate generator configuration structure.

Configurations for the Sample rate generator to generate the BCLK and Frame Sync signals are specified using this structure. McBSP sample rate generator configuration structure

Loop job buffer structure. This structure defines the format of the Loop job buffer.

Note:
Loop job buffer is a buffer used by the mcbsp in edma mode. The Mcbsp uses this buffer when no iobufs are present and the mcbsp is also not stopped. In this condition the Mcbsp utilises the loop job buffer to transmit a known pattern of data from the loopjob buffer or receives the data in to a loop job buffer loop job buffer format.

Clock source selection ENUM.

Use this symbol to set the clock source as internal or external Clock source selection ENUM

Mcbsp supported wordlength.

Enumerated constant for wordlength supported by the MCBSP device Mcbsp supported wordlength.


Enumeration Type Documentation

McBSP 32-bit reversal feature.

This ENUM allows the user to select the option of BIT reversal.

Enumerator:
Mcbsp_BitReversal_DISABLE 

32-bit reversal disabled

Mcbsp_BitReversal_ENABLE 

32-bit reversal enabled. 32-bit data is received LSB first. Word * length should be set for 32-bit operation; else operation undefined

Enum to specify the supported buffer formats.

Interleaved and non-interleaved is standard format, this enumeration captures the standard and custom data formats.

Clock polarity.

Use this symbol to set XMT or RCV clock polarity as rising or falling edge

Enumerator:
Mcbsp_ClkPol_RISING_EDGE 

Data sampled on rising edge of the bit Clock

Mcbsp_ClkPol_FALLING_EDGE 

Data sampled on falling edge of the bit Clock

Mcbsp_ClkPol_SRG_RISING_EDGE 

SRG clock polarity is rising edge

Mcbsp_ClkPol_SRG_FALLING_EDGE 

SRG clock polarity Is falling edge

Polarity of the CLKS pin.

Enum to Set the polarity of the CLKS pin used to generate Frame Sync and bit clock

Enumerator:
Mcbsp_ClkSPol_RISING_EDGE 

Rising edge of CLKS generates CLKG and FSG.

Mcbsp_ClkSPol_FALLING_EDGE 

Falling edge of CLKS generates CLKG and FSG.

Enum to select the companding law.

Use this Enum to select the appropriate companding rule applicable.

Enumerator:
Mcbsp_Compand_OFF_MSB_FIRST 

No companding, data transfer starts with MSB first.

Mcbsp_Compand_OFF_LSB_FIRST 

No companding, 8-bit data transfer starts with LSB first.

Mcbsp_Compand_MULAW 

mu-law comapanding enable for channel

Mcbsp_Compand_ALAW 

A-law comapanding enable for channel

Enum to select Data delay in bits.

Use this Enum to set XMT/RCV Data Delay (in bits)

Enumerator:
Mcbsp_DataDelay_0_BIT 

sets XMT/RCV Data Delay to 0 bits

Mcbsp_DataDelay_1_BIT 

sets XMT/RCV Data Delay to 1 bits

Mcbsp_DataDelay_2_BIT 

sets XMT/RCV Data Delay to 2 bits

Mcbsp device operational mode.

This enum is used to define the operational mode of the mcbsp device like normal mcbsp device.

Enumerator:
Mcbsp_DevMode_McBSP 

Option to operate in normal McBSP mode

Transmit pin mode configuration.

DX pin settings used for setting the pin in high impedance mode.

Enumerator:
Mcbsp_DxEna_OFF 

DX enabler is OFF

Mcbsp_DxEna_ON 

DX enabler is ON

Mcbsp Emulation mode settings.

Use this symbol to set the Emulation Mode to Free mode or any other mode.

Note:
The SOFT mode settings are applicable only is the FREE mode is disabled.Hence if the soft mode is selected (both enable or disable) the driver will internally disable the FREE mode.
Enumerator:
Mcbsp_EmuMode_SOFT_ABORT 

SOFT mode is disabled.

Mcbsp_EmuMode_SOFT_STOP 

SOFT mode is enabled

Mcbsp_EmuMode_FREE 

FREE mode is enabled

Frame sync ignore status enum.

Note:
Use this symbol to detect or ignore frame synchronisation
Enumerator:
Mcbsp_FrmSync_DETECT 

detect frame synchronisation

Mcbsp_FrmSync_IGNORE 

ignore frame synchronisation

Frame sync clock source.

Use this ENUM to set the frame sync clock source as internal or external

Enumerator:
Mcbsp_FsClkMode_EXTERNAL 

frame sync clock source as internal

Mcbsp_FsClkMode_INTERNAL 

frame sync clock source as external

Mcbsp_FsClkMode_DXR_XSR 

frame sync is generated on DXR_XSR copy

Frame sync polarity.

Use this symbol to set frame sync polarity as active-high or active-low

Enumerator:
Mcbsp_FsPol_ACTIVE_HIGH 

frame sync polarity is active-high

Mcbsp_FsPol_ACTIVE_LOW 

frame sync polarity is active-low

MCBSP Interrupt mode.

Use this symbol to set Interrupt mode (i.e. source of interrupt generation).This symbol is used on both RCV and XMT for RINT and XINT generation mode.

Enumerator:
Mcbsp_IntMode_ON_READY 

Interrupt generated on RRDY of RCV or XRDY of XMT

Mcbsp_IntMode_ON_EOB 

Interrupt generated on end of 16-channel block transfer in * multichannel mode

Mcbsp_IntMode_ON_FSYNC 

Interrupt generated on frame sync

Mcbsp_IntMode_ON_SYNCERR 

Interrupt generated on synchronisation error

McBSP Ioctl commands.

List of all the ioctl commands supported by the Mcbsp driver.

Enumerator:
Mcbsp_IOCTL_START 

Starts the data transfer

Mcbsp_IOCTL_SAMPLE_RATE_CHANGE 

Command to chnage the sample rate

Mcbsp_IOCTL_STOP 

Stops the data transfer

Mcbsp_IOCTL_SRGR_START 

Start the McBSP SRG

Mcbsp_IOCTL_SRGR_STOP 

Stop the McBSP SRG

Mcbsp_IOCTL_FSGR_START 

Start the McBSP FSG

Mcbsp_IOCTL_FSGR_STOP 

Stop the McBSP FSG

Mcbsp_IOCTL_SET_TIMEOUT 

Modify the timeout value in the driver

Mcbsp_IOCTL_MUTE_ON 

Mute ON the transfer

Mcbsp_IOCTL_MUTE_OFF 

Take out of Muted state

Mcbsp_IOCTL_PAUSE 

Pause the playback operation

Mcbsp_IOCTL_RESUME 

Resume the playback operation

Mcbsp_IOCTL_CHAN_RESET 

Reset an I/O channel

Mcbsp_IOCTL_DEVICE_RESET 

Reset both input and output channel

Mcbsp_IOCTL_SET_CLKMODE 

Set Bit clock mode for the McBSP

Mcbsp_IOCTL_SET_FRMSYNCMODE 

Set Frame Sync mode for the McBSP

Mcbsp_IOCTL_CONFIG_SRGR 

configure Sample Rate Generator

Mcbsp_IOCTL_SET_BCLK_POL 

Set the CLKR or CLKX clock polarity

Mcbsp_IOCTL_SET_FRMSYNC_POL 

Set the FSR and FSX polarity

Mcbsp_IOCTL_MODIFY_LOOPJOB 

Enable/disable the loopjob

Mcbsp_IOCTL_SYNCERR_INT_ENABLE 

Enable/disable the sync error

Mcbsp_IOCTL_LOOPBACK 

enable/disable the loop back mode

Mcbsp_IOCTL_CANCEL_PENDING_IO 

Cancel all the current pending IO in the driver

McBSP digital loopback mode selection.

Enum to select the enable/disable of Loopback mode of the mcbsp.

Enumerator:
Mcbsp_Loopback_DISABLE 

loopback mode off

Mcbsp_Loopback_ENABLE 

loopback mode on

Transmit multichannel selection mode bit.

MCM determines whether all channels or only selected channels are enabled and unmasked for transmission/reception.

Enumerator:
Mcbsp_McmMode_ALL_CHAN_ENABLED_UNMASKED 

All the 128 channels are enabled

Mcbsp_McmMode_ALL_CHAN_DISABLED_UNMASKED 

All channels are disabled unless selected by enable mask

Mcbsp_McmMode_ALL_CHAN_ENABLED_MASKED 

All channels are enabled but masked unless selected by Enable mask

Mcbsp_McmMode_ALL_CHAN_DISABLED_MASKED 

Symmetric transmission and reception

Mcbsp driver operational mode.

Enumeration of the different modes of operation available for the Mcbsp device driver.(Mcbsp driver supports only EDMA mode).

Enumerator:
Mcbsp_OpMode_POLLED 

Polled Mode

Mcbsp_OpMode_INTERRUPT 

Interrupt Mode

Mcbsp_OpMode_DMAINTERRUPT 

DMA Mode

Multichannel partition mode selection.

Multichannel mode allows selection of either an 2 partition mode or 8 partition mode.This enum allows the user to select the required partition mode of choice.

Enumerator:
Mcbsp_PartitionMode_2 

2-partition mode. Only partitions A and B are used.

Mcbsp_PartitionMode_8 

8-partition mode. All partitions (A through H) are used

Partition A/B block channel selection bit.

Enumerator:
Mcbsp_PartitionMode_CHAN_0_15 

Select the channel 0-15 in block A

Mcbsp_PartitionMode_CHAN_16_31 

Select the channel 16-31 in block B

Mcbsp_PartitionMode_CHAN_32_47 

Select the channel 32-47 in block A

Mcbsp_PartitionMode_CHAN_48_63 

Select the channel 48-63 in block B

Mcbsp_PartitionMode_CHAN_64_79 

Select the channel 64-79 in block A

Mcbsp_PartitionMode_CHAN_80_95 

Select the channel 80-95 in block B

Mcbsp_PartitionMode_CHAN_96_111 

Select the channel 96-111 in block A

Mcbsp_PartitionMode_CHAN_112_127 

Select the channel 112-127 in block B

Mcbsp PHASE control enums.

Note:
These enums are used to control the Phase settings of the MCBSP.
Enumerator:
Mcbsp_Phase_SINGLE 

Single phase for frame

Mcbsp_Phase_DUAL 

Dual phase for frame

ENUM for receive data justification settings.

Use this symbol for setting up RCV sign-extension and justification mode

Enumerator:
Mcbsp_RxJust_RZF 

RCV setting - right justify, fill MSBs with zeros

Mcbsp_RxJust_RSE 

RCV setting - right justify, sign-extend the data into MSBs

Mcbsp_RxJust_RxJUST_LZF 

RCV setting - left justify, fill LSBs with zeros

SRG clock source.

Use this symbol to select input clock source for Sample Rate Generator

Enumerator:
Mcbsp_SrgClk_CLKS 

input clock source for Sample Rate Generator is CLKS pin

Mcbsp_SrgClk_CLKCPU 

input clock source for Sample Rate Generator is CPU

Mcbsp_SrgClk_CLKR 

input clock source for Sample Rate Generator is BCLKR pin

Mcbsp_SrgClk_CLKX 

input clock source for Sample Rate Generator is BCLKX pin

Clock source selection ENUM.

Use this symbol to set the clock source as internal or external

Enumerator:
Mcbsp_TxRxClkMode_EXTERNAL 

clock source as internal

Mcbsp_TxRxClkMode_INTERNAL 

clock source as external

Mcbsp supported wordlength.

Enumerated constant for wordlength supported by the MCBSP device

Enumerator:
Mcbsp_WordLength_8 

Word length of 8 bits

Mcbsp_WordLength_12 

Word length of 12 bits

Mcbsp_WordLength_16 

Word length of 16 bits

Mcbsp_WordLength_20 

Word length of 20 bits

Mcbsp_WordLength_24 

Word length of 24 bits

Mcbsp_WordLength_32 

Word length of 32 bits


Function Documentation

int32_t mcbspBindDev ( void **  devp,
int32_t  devid,
void *  devParams 
)

Allocates and configures the McBSP instance specified by devid.

Acquires the Handle of the McBSP and configure the McBSP by default for the following things. o Data output for audio playback o Data input for audio recording o Configure the McBSP in DSP/TDM data format mode of the audio codec. o Configure the McBSP to receive the Frame Sync and bit clock externally for both receiver and transmitter. o McBSP can also be configured to generate Frame Sync and bit clock internally by enabling sample rate generator and frame sync generator blocks respectively depending on the fields set in the device parameter structure which shall be passed to mcbspBindDev() function as one of the parameter.

Parameters:
devp [OUT] pointer to hold allocated instance object ptr
devid [IN] instance number of the mcbsp
devParams [IN] user supplied data params.
Returns:
MCBSP_STATUS_COMPLETED if successful

MCBSP_ERR_BADARGS if not successful MCBSP_ERR_ALLOC

devp should be non NULL and valid pointer, devId should be < CSL_MCBSP_PER_CNT devParams should be non NULL and valid pointer,

Not implemented

int32_t mcbspControlChan ( void *  chanp,
Mcbsp_IOCTL  cmd,
void *  arg 
)

Implements the IOCTLS for McBSP driver.

ControlChan() implements recieved IOCTL commands from the application and executes them accordingly.

Parameters:
chanp [IN] Pointer to channel
cmd [IN] specific IOCTL command
arg [IN] arguments required for specific commands
Returns:
MCBSP_STATUS_COMPLETED, if command is executed correctly MCBSP_STATUS_ABORTED, if command returns error during execution MCBSP_ERR_NOTIMPL, if command is not supported MCBSP_ERR_BADARGS if args are not correct
int32_t mcbspCreateChan ( void **  chanp,
void *  devp,
int32_t  mode,
void *  chanParams,
Mcbsp_CallbackFxn  cbFxn,
void *  cbArg 
)

Creates a communication channel in specified mode to communicate data between the application and the McBSP device instance. This function sets the required hardware configurations for the data transactions. It returns configured channel handle to application which will be used in all further transactions with the channel.

Pre-requisites: 1. Valid chanParams structure This takes much information pertaining to mcbsp channel configuration such as how many slots are used for this channel what are their communication parameters, clock settings etc. 2. Valid device pointer

Parameters:
chanp [IN] Channel Handler
devp [IN] Device pointer
mode [IN] channel mode -> input or output
chanParams [IN] channel parameters from user
cbFxn [IN] callback function pointer
cbArg [IN] callback function Arguments
Returns:
MCBSP_STATUS_COMPLETED if successful MCBSP_ERR_BADIO if not successful MCBSP_ERR_ALLOC " MCBSP_ERR_BADARGS if passed invalid chanParams structure
int32_t mcbspDeleteChan ( void *  chanp  ) 

frees a channel and all it's associated resources.

Frees the EDMA resources including EDMA master channel and link PaRAM entries held by the channel.it also unregisters all the interrupt handlers.

Parameters:
chanp [IN] Handle to the channel
Returns:
MCBSP_STATUS_COMPLETED if successful MCBSP_STATUS_ABORTED if not successful

chanp should be non NULL and valid pointer,

Not implemented

void mcbspGblRcvIsr ( void *  hChan  ) 

McBSP Rx ISR function.

This Function is the interrupt service routine for the Mcbsp RX event.

Parameters:
hChan [IN] Handle to the channel
Returns:
None
void mcbspGblXmtIsr ( void *  hChan  ) 

McBSP Tx ISR function.

This Function is the interrupt service routine for the Mcbsp TX event.

Parameters:
hChan [IN] Handle to the channel
Returns:
None
int32_t mcbspInit ( void   ) 

Description
This is the MCBSP Driver Initialization API which needs to be invoked by the users to initialize the MCBSP peripheral. This call is *mandatory* and should be called before calling any of the other driver API's.

This should only be called *ONCE* for the device.

Return values:
MCBSP_STATUS_COMPLETED if successful
MCBSP_ERR_BADARGS if not successful MCBSP_ERR_ALLOC
int32_t mcbspSubmitChan ( void *  chanp,
Mcbsp_IOBuf *const   ioBuf 
)

Submit a I/O buffer to a channel for processing.

The application calls this function to cause the driver to process the Mcbsp_IOBuf for read/write/flush/abort operations.

Parameters:
chanp [IN] Pointer to channel
ioBuf [IN] Pointer to buffer to be submitted
Returns:
MCBSP_STATUS_COMPLETED, if buffer is fully processed MCBSP_STATUS_ABORTED, if buffer is aborted MCBSP_STATUS_PENDING, if buffer is not fully processed MCBSP_ERR_BADIO in case of an error in processing
int32_t mcbspUnBindDev ( void *  devp  ) 

Closes the McBSP device instance from use. This API is called by the application when it no longer requires the device instance. Note that all the channels have to be closed for the device instance to be deleted sucessfully.

Parameters:
devp [IN] Handle to the device created.
Returns:
MCBSP_STATUS_COMPLETED if successful MCBSP_STATUS_ABORTED if not successful

devp should be non NULL and valid pointer,

Not implemented


Copyright 2012, Texas Instruments Incorporated