![]() |
![]() |
Header file conataining the driver internal definitions and data structures. More...
#include <ti/csl/cslr_mcbsp.h>#include <ti/sdo/edma3/drv/edma3_drv.h>#include <ti/drv/mcbsp/mcbsp_drv.h>Data Structures | |
| struct | Mcbsp_ChannelObj_t |
| Mcbsp channel Object. More... | |
| struct | Mcbsp_Object_Unpadded |
| Mcbsp instance Object. More... | |
Defines | |
| #define | Mcbsp_MAXLINKCNT (2u) |
| #define | Mcbsp_TXEVENTQUE (1u) |
| #define | Mcbsp_RXEVENTQUE (2u) |
| #define | Mcbsp_CNT_MAX_VAL (0xFFFFu) |
| #define | Mcbsp_STATUS_INVALID (0xFFFF) |
| #define | Mcbsp_STATUS_VALID (0x1) |
| #define | Mcbsp_MAX_IOBUF_SIZE (32768u) |
| #define | Mcbsp_FRAME_LENGTH (127u) |
Typedefs | |
| typedef enum Mcbsp_DriverState_t | Mcbsp_DriverState |
| Mcbsp driver state. | |
| typedef enum Mcbsp_SpcrCtrl_t | Mcbsp_SpcrCtrl |
| Mcbsp SPCR control enums. | |
| typedef struct Mcbsp_ChannelObj_t | Mcbsp_ChannelObj |
| Mcbsp channel Object. | |
Enumerations | |
| enum | Mcbsp_DriverState_t |
Mcbsp driver state. More... | |
| enum | Mcbsp_SpcrCtrl_t { Mcbsp_SpcrCtrl_RX_ENABLE = (1u), Mcbsp_SpcrCtrl_TX_ENABLE = (2u), Mcbsp_SpcrCtrl_RX_DISABLE = (4u), Mcbsp_SpcrCtrl_TX_DISABLE = (8u), Mcbsp_SpcrCtrl_FSYNC_ENABLE = (16u), Mcbsp_SpcrCtrl_SRG_ENABLE = (32u), Mcbsp_SpcrCtrl_FSYNC_DISABLE = (64u), Mcbsp_SpcrCtrl_SRG_DISABLE = (128u) } |
Mcbsp SPCR control enums. More... | |
Functions | |
| int32_t | Mcbsp_localResetCtrl (Mcbsp_Object_Unpadded *instHandle, uint32_t selectMask) |
| McBSP SPCR configuration function. | |
| void | Mcbsp_localCompleteCurrentIo (Mcbsp_ChannelObj *chanHandle) |
| This function completes the current pending request and then invokes the application registered callback. | |
| void | Mcbsp_localEdmaCallback (uint32_t tcc, EDMA3_RM_TccStatus status, void *data) |
| This calls the registered application callback for the current receive request and processes the next request in queue. This is a mcbsp edma callback function called in edma context. | |
| void | Mcbsp_localAbortReset (Mcbsp_ChannelObj *chanHandle) |
| Abort the queued up requests. | |
| void | Mcbsp_localGetNextIndex (uint32_t *index) |
| This function toggles the index of the edma params. | |
| int32_t | Mcbsp_localSetupEdmaDuringOpen (Mcbsp_ChannelObj *chanHandle) |
| Function to intialize and set up the edma for transfer. | |
| int32_t | Mcbsp_localSubmitIoctl (Mcbsp_ChannelObj *chanHandle, Mcbsp_IOCTL cmd, void *arg, void *param) |
| Implements the IOCTLS for McBSP driver. | |
| int32_t | Mcbsp_localUpdtDtPktToLnkPrms (Mcbsp_ChannelObj *chanHandle, Mcbsp_IOBuf *const ioBuf) |
| This function updates the link param set accordingly with data or loopjobbuffer. This uses properly maintained index to identify to what param set the info has to be updated. | |
| int32_t | Mcbsp_localEdmaChanPaRAMsetup (Mcbsp_ChannelObj *chanHandle) |
| setup the EDMA channel for the specific channel requested. | |
| int32_t | Mcbsp_localEdmaProcessPkt (Mcbsp_ChannelObj *chanHandle, Mcbsp_IOBuf *ioBuf) |
| Process the buffer and update the EDMA paramset. | |
| void | Mcbsp_localCancelAndAbortAllIo (Mcbsp_ChannelObj *chanHandle) |
| This is going to complete the current request and abort all other reqest. | |
| int32_t | Mcbsp_localGetIndicesSyncType (Mcbsp_ChannelObj *chanHandle, volatile int16_t *bIndex, volatile int16_t *cIndex, volatile uint16_t *aCnt, volatile uint16_t *bCnt, volatile uint16_t *cCnt, EDMA3_DRV_SyncType *syncType, Bool forLoopJobBuf) |
| Mcbsp_localGetIndicesSyncType. | |
| int32_t | Mcbsp_localConfigureSrgr (Mcbsp_Object_Unpadded *instHandle, Mcbsp_ChannelObj *chanHandle) |
| This function configures the sample rate generator and frame sync properties. | |
| int32_t | Mcbsp_localConfigureRcvChannel (Mcbsp_Object_Unpadded *instHandle, Mcbsp_ChanParams *params) |
| This function configures the receives section of the mcbsp. | |
| int32_t | Mcbsp_localConfigureXmtChannel (Mcbsp_Object_Unpadded *instHandle, Mcbsp_ChanParams *params) |
| This function configures the transmit section of the mcbsp sync properties. | |
| void | Mcbsp_localLoadPktToEdma (Mcbsp_ChannelObj *chanHandle, Mcbsp_IOBuf *ioBuf) |
| This function loads the buffers to the actual EDMA paramset. | |
| int32_t | Mcbsp_localModifySampleRate (Mcbsp_ChannelObj *chanHandle, void *arg) |
| Function to modify the sample rate generator configuration. | |
| void | Mcbsp_TxFifo (int32_t arg0, int32_t arg1) |
| This function waits for the FIFO to be emptied(if enabled) and the TX empty bit to be set so that the TX section could be disabled when there is no data present. | |
Header file conataining the driver internal definitions and data structures.
(C) Copyright 2012, Texas Instruments, Inc
| #define Mcbsp_CNT_MAX_VAL (0xFFFFu) |
Max possible value of aCnt, bCnt and cCnt
| #define Mcbsp_FRAME_LENGTH (127u) |
No of frames Max supported by the mcbsp
| #define Mcbsp_MAX_IOBUF_SIZE (32768u) |
Maximum sixe of the I/O buffer programmable
| #define Mcbsp_MAXLINKCNT (2u) |
Maximum number of EDMA jobs linked at a time (Must be 2).
| #define Mcbsp_RXEVENTQUE (2u) |
Receive EDMA channel event queue number
| #define Mcbsp_STATUS_INVALID (0xFFFF) |
Generic invalidate status
| #define Mcbsp_STATUS_VALID (0x1) |
Generic validate status
| #define Mcbsp_TXEVENTQUE (1u) |
Transmit EDMA channel event queue number
| typedef struct Mcbsp_ChannelObj_t Mcbsp_ChannelObj |
Mcbsp channel Object.
This structure maintains the current channel state. It also holds information on DMA channel being used and holds the application callback function to be called in case of an interrupt.
This structure is initialized by mdCreateChan and a pointer to this is passed down to all other channel related functions. Lifetime of the data structure is from its creation by mdCreateChan till it is invalidated by mdDeleteChan.each instance object will have two channel object one for TX and one for the RX channel. Mcbsp channel Object
| typedef enum Mcbsp_DriverState_t Mcbsp_DriverState |
Mcbsp driver state.
Mcbsp driver state enums used to track the driver and channel state. Mcbsp driver and channel states
| typedef enum Mcbsp_SpcrCtrl_t Mcbsp_SpcrCtrl |
Mcbsp SPCR control enums.
These enums are used to control the settings of the SPCR register. Mcbsp SPCR control enums
| enum Mcbsp_DriverState_t |
Mcbsp driver state.
Mcbsp driver state enums used to track the driver and channel state.
| enum Mcbsp_SpcrCtrl_t |
Mcbsp SPCR control enums.
These enums are used to control the settings of the SPCR register.
| void Mcbsp_localAbortReset | ( | Mcbsp_ChannelObj * | chanHandle | ) |
Abort the queued up requests.
This commands aborts all the pending IO requests and returns them to the application. The current state of the IO request will be set to ABORTED.
| chanHandle | [IN] Handle to the channel whose requests are to be aborted |
| void Mcbsp_localCancelAndAbortAllIo | ( | Mcbsp_ChannelObj * | chanHandle | ) |
This is going to complete the current request and abort all other reqest.
| chanHandle | [IN] Channel handle |
chanHandle is a valid non null pointer
Not implemented
| void Mcbsp_localCompleteCurrentIo | ( | Mcbsp_ChannelObj * | chanHandle | ) |
This function completes the current pending request and then invokes the application registered callback.
| chanHandle | [IN] Handle to the channel |
chanHandle is a valid non null pointer
Not implemented
| int32_t Mcbsp_localConfigureRcvChannel | ( | Mcbsp_Object_Unpadded * | instHandle, | |
| Mcbsp_ChanParams * | params | |||
| ) |
This function configures the receives section of the mcbsp.
| instHandle | [IN] pointer to the instance object. | |
| params | [IN] User supplied channel parameters |
| int32_t Mcbsp_localConfigureSrgr | ( | Mcbsp_Object_Unpadded * | instHandle, | |
| Mcbsp_ChannelObj * | chanHandle | |||
| ) |
This function configures the sample rate generator and frame sync properties.
| instHandle | [IN] pointer to the instance object. | |
| chanHandle | [IN] Handle to the channel. |
| int32_t Mcbsp_localConfigureXmtChannel | ( | Mcbsp_Object_Unpadded * | instHandle, | |
| Mcbsp_ChanParams * | params | |||
| ) |
This function configures the transmit section of the mcbsp sync properties.
| instHandle | [IN] pointer to the instance object. | |
| params | [IN] User supplied channel parameters |
| void Mcbsp_localEdmaCallback | ( | uint32_t | tcc, | |
| EDMA3_RM_TccStatus | edmaStatus, | |||
| void * | data | |||
| ) |
This calls the registered application callback for the current receive request and processes the next request in queue. This is a mcbsp edma callback function called in edma context.
| tcc | [IN] tcc number of EDMA | |
| edmaStatus | [IN] status of EDMA transaction | |
| data | [IN] paramaters sent to EDMA ISR (chan handler) |
tcc should be a valid value status should be a valid value data should be a non NULL and valid pointer
Not implemented
| int32_t Mcbsp_localEdmaChanPaRAMsetup | ( | Mcbsp_ChannelObj * | chanHandle | ) |
setup the EDMA channel for the specific channel requested.
This function configures the McBSP synchonized EDMA channel PaRAM entries it also configures the various other parameters like source and destination address / modes
| chanHandle | [IN] Channel handle |
| int32_t Mcbsp_localEdmaProcessPkt | ( | Mcbsp_ChannelObj * | chanHandle, | |
| Mcbsp_IOBuf * | ioBuf | |||
| ) |
Process the buffer and update the EDMA paramset.
For the transmit operation, the eDMA channel's destination port is tied to the MCBSP DAT port. In case of receive, the eDMA channel's source port is tied to the MCBSP DAT port. The source address for transmit eDMA channel and the destination address for the receive eDMA channel are set here.
| chanHandle | [IN] Pointer to channel | |
| ioBuf | [IN] Pointer to request to be processed |
| int32_t Mcbsp_localGetIndicesSyncType | ( | Mcbsp_ChannelObj * | chanHandle, | |
| volatile int16_t * | bIndex, | |||
| volatile int16_t * | cIndex, | |||
| volatile uint16_t * | aCnt, | |||
| volatile uint16_t * | bCnt, | |||
| volatile uint16_t * | cCnt, | |||
| EDMA3_DRV_SyncType * | syncType, | |||
| Bool | forLoopJobBuf | |||
| ) |
Mcbsp_localGetIndicesSyncType.
This function computes the parameters requied to configure EDMA 3 based on the buffer format seleted while creating the driver.
Entry Criteria : This function expects channel variables such as no of slots length of buffers is updated.
| chanHandle | [IN] Pointer to channel handle | |
| bIndex | [IN] Pointer to stores computed bIndex | |
| cIndex | [IN] Pointer to stores computed cIndex | |
| aCnt | [IN] Pointer to stores computed aCnt | |
| bCnt | [IN] Pointer to stores computed bCnt | |
| cCnt | [IN] Pointer to stores computed cCnt | |
| syncType | [IN] Pointer to stores computed mode of EDMA | |
| forLoopJobBuf | [IN] To calucalate above for loopJob or data |
CAUTION: This function could be called with pointer pointing to EDMA 3 paramset pointer (avoiding couple of variables). Care should be take to ensure that data types used in EDMA 3 paramset is consistent with EDMA 3 defined data types.
| void Mcbsp_localGetNextIndex | ( | uint32_t * | index | ) |
This function toggles the index of the edma params.
| index | [IN] pointer to current index |
index is a valid non null pointer
Not implemented
| void Mcbsp_localLoadPktToEdma | ( | Mcbsp_ChannelObj * | chanHandle, | |
| Mcbsp_IOBuf * | ioBuf | |||
| ) |
This function loads the buffers to the actual EDMA paramset.
| chanHandle | [IN] Handle to channel. | |
| ioBuf | [IN] pointer to the ioBuf |
Not implemented
Not implemented
| int32_t Mcbsp_localModifySampleRate | ( | Mcbsp_ChannelObj * | chanHandle, | |
| void * | arg | |||
| ) |
Function to modify the sample rate generator configuration.
| chanHandle | [IN] Handle to the channel | |
| arg | [IN] pointer to the srg config setup |
| int32_t Mcbsp_localResetCtrl | ( | Mcbsp_Object_Unpadded * | instHandle, | |
| uint32_t | selectMask | |||
| ) |
McBSP SPCR configuration function.
This Function is used to set/reset specific bit of SPCR as specified in the given mask.
| instHandle | [IN] pointer to the mcbsp instance object. | |
| selectMask | [IN] the SPCR control mask |
MCBSP_ERR_BADARGS if not successful
| int32_t Mcbsp_localSetupEdmaDuringOpen | ( | Mcbsp_ChannelObj * | chanHandle | ) |
Function to intialize and set up the edma for transfer.
This function does the following 1) Requests the EDMA channel from the edma driver. 2) Requests the link channels for linking (exclusive for tx & rx) 3) set up the param set of main xfer channel (for loopjob transfers) 4) set up the param sets of all link channel (for loopjob transfers) 5) link the last link channel to itself (this channel will be linked to main xfer channel later and to supply the loopjob xfer information infinely this is done so; other link channels are setup here just for completion sake
| chanHandle | [IN] Handle to the channel for which the edma is setup |
| int32_t Mcbsp_localSubmitIoctl | ( | Mcbsp_ChannelObj * | chanHandle, | |
| Mcbsp_IOCTL | cmd, | |||
| void * | arg, | |||
| void * | param | |||
| ) |
Implements the IOCTLS for McBSP driver.
This function implements the McBSP device specific control operations including Start/Stop, Pause/Resume, Channel and Device Reset, Mute-ON/OFF, McBSP sample rate generator configuration etc.
| chanHandle | [IN] Handle to channel | |
| cmd | [IN] Control command number | |
| arg | [IN] Arguments for control command | |
| param | [IN] user defined data structure |
| int32_t Mcbsp_localUpdtDtPktToLnkPrms | ( | Mcbsp_ChannelObj * | chanHandle, | |
| Mcbsp_IOBuf *const | ioBuf | |||
| ) |
This function updates the link param set accordingly with data or loopjobbuffer. This uses properly maintained index to identify to what param set the info has to be updated.
| chanHandle | [IN] Handle to the mcbsp channel | |
| ioBuf | [IN] Pointer to I/O buffer |
chanHandle should be non NULL and valid pointer ioBuf should be non NULL and valid pointer
Not implemented
| void Mcbsp_TxFifo | ( | int32_t | arg0, | |
| int32_t | arg1 | |||
| ) |
This function waits for the FIFO to be emptied(if enabled) and the TX empty bit to be set so that the TX section could be disabled when there is no data present.
| arg0 | [IN] Handle to the TX channel | |
| arg1 | [IN] unused |
arg0 is a valid non null pointer
Not implemented