MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages

Overview

Data Structures

struct  spdif_edma_transfer_t
 SPDIF transfer structure. More...
 
struct  spdif_edma_handle_t
 SPDIF DMA transfer handle, users should not touch the content of the handle. More...
 

Typedefs

typedef void(* spdif_edma_callback_t )(SPDIF_Type *base, spdif_edma_handle_t *handle, status_t status, void *userData)
 SPDIF eDMA transfer callback function for finish and error.
 

eDMA Transactional

void SPDIF_TransferTxCreateHandleEDMA (SPDIF_Type *base, spdif_edma_handle_t *handle, spdif_edma_callback_t callback, void *userData, edma_handle_t *dmaLeftHandle, edma_handle_t *dmaRightHandle)
 Initializes the SPDIF eDMA handle. More...
 
void SPDIF_TransferRxCreateHandleEDMA (SPDIF_Type *base, spdif_edma_handle_t *handle, spdif_edma_callback_t callback, void *userData, edma_handle_t *dmaLeftHandle, edma_handle_t *dmaRightHandle)
 Initializes the SPDIF Rx eDMA handle. More...
 
status_t SPDIF_TransferSendEDMA (SPDIF_Type *base, spdif_edma_handle_t *handle, spdif_edma_transfer_t *xfer)
 Performs a non-blocking SPDIF transfer using DMA. More...
 
status_t SPDIF_TransferReceiveEDMA (SPDIF_Type *base, spdif_edma_handle_t *handle, spdif_edma_transfer_t *xfer)
 Performs a non-blocking SPDIF receive using eDMA. More...
 
void SPDIF_TransferAbortSendEDMA (SPDIF_Type *base, spdif_edma_handle_t *handle)
 Aborts a SPDIF transfer using eDMA. More...
 
void SPDIF_TransferAbortReceiveEDMA (SPDIF_Type *base, spdif_edma_handle_t *handle)
 Aborts a SPDIF receive using eDMA. More...
 
status_t SPDIF_TransferGetSendCountEDMA (SPDIF_Type *base, spdif_edma_handle_t *handle, size_t *count)
 Gets byte count sent by SPDIF. More...
 
status_t SPDIF_TransferGetReceiveCountEDMA (SPDIF_Type *base, spdif_edma_handle_t *handle, size_t *count)
 Gets byte count received by SPDIF. More...
 

Data Structure Documentation

struct spdif_edma_transfer_t

Data Fields

uint8_t * leftData
 Data start address to transfer. More...
 
uint8_t * rightData
 Data start address to transfer. More...
 
size_t dataSize
 Transfer size. More...
 

Field Documentation

uint8_t* spdif_edma_transfer_t::leftData
uint8_t* spdif_edma_transfer_t::rightData
size_t spdif_edma_transfer_t::dataSize
struct _spdif_edma_handle

Data Fields

edma_handle_tdmaLeftHandle
 DMA handler for SPDIF left channel.
 
edma_handle_tdmaRightHandle
 DMA handler for SPDIF right channel.
 
uint8_t nbytes
 eDMA minor byte transfer count initially configured. More...
 
uint8_t count
 The transfer data count in a DMA request.
 
uint32_t state
 Internal state for SPDIF eDMA transfer.
 
spdif_edma_callback_t callback
 Callback for users while transfer finish or error occurs.
 
void * userData
 User callback parameter.
 
edma_tcd_t leftTcd [SPDIF_XFER_QUEUE_SIZE+1U]
 TCD pool for eDMA transfer. More...
 
edma_tcd_t rightTcd [SPDIF_XFER_QUEUE_SIZE+1U]
 TCD pool for eDMA transfer. More...
 
spdif_edma_transfer_t spdifQueue [SPDIF_XFER_QUEUE_SIZE]
 Transfer queue storing queued transfer. More...
 
size_t transferSize [SPDIF_XFER_QUEUE_SIZE]
 Data bytes need to transfer, left and right are the same, so use one.
 
volatile uint8_t queueUser
 Index for user to queue transfer. More...
 
volatile uint8_t queueDriver
 Index for driver to get the transfer data and size.
 

Field Documentation

uint8_t spdif_edma_handle_t::nbytes
edma_tcd_t spdif_edma_handle_t::leftTcd[SPDIF_XFER_QUEUE_SIZE+1U]
edma_tcd_t spdif_edma_handle_t::rightTcd[SPDIF_XFER_QUEUE_SIZE+1U]
spdif_edma_transfer_t spdif_edma_handle_t::spdifQueue[SPDIF_XFER_QUEUE_SIZE]
volatile uint8_t spdif_edma_handle_t::queueUser

Function Documentation

void SPDIF_TransferTxCreateHandleEDMA ( SPDIF_Type *  base,
spdif_edma_handle_t *  handle,
spdif_edma_callback_t  callback,
void *  userData,
edma_handle_t dmaLeftHandle,
edma_handle_t dmaRightHandle 
)

This function initializes the SPDIF master DMA handle, which can be used for other SPDIF master transactional APIs. Usually, for a specified SPDIF instance, call this API once to get the initialized handle.

Parameters
baseSPDIF base pointer.
handleSPDIF eDMA handle pointer.
baseSPDIF peripheral base address.
callbackPointer to user callback function.
userDataUser parameter passed to the callback function.
dmaLeftHandleeDMA handle pointer for left channel, this handle shall be static allocated by users.
dmaRightHandleeDMA handle pointer for right channel, this handle shall be static allocated by users.
void SPDIF_TransferRxCreateHandleEDMA ( SPDIF_Type *  base,
spdif_edma_handle_t *  handle,
spdif_edma_callback_t  callback,
void *  userData,
edma_handle_t dmaLeftHandle,
edma_handle_t dmaRightHandle 
)

This function initializes the SPDIF slave DMA handle, which can be used for other SPDIF master transactional APIs. Usually, for a specified SPDIF instance, call this API once to get the initialized handle.

Parameters
baseSPDIF base pointer.
handleSPDIF eDMA handle pointer.
baseSPDIF peripheral base address.
callbackPointer to user callback function.
userDataUser parameter passed to the callback function.
dmaLeftHandleeDMA handle pointer for left channel, this handle shall be static allocated by users.
dmaRightHandleeDMA handle pointer for right channel, this handle shall be static allocated by users.
status_t SPDIF_TransferSendEDMA ( SPDIF_Type *  base,
spdif_edma_handle_t *  handle,
spdif_edma_transfer_t xfer 
)
Note
This interface returns immediately after the transfer initiates. Call SPDIF_GetTransferStatus to poll the transfer status and check whether the SPDIF transfer is finished.
Parameters
baseSPDIF base pointer.
handleSPDIF eDMA handle pointer.
xferPointer to the DMA transfer structure.
Return values
kStatus_SuccessStart a SPDIF eDMA send successfully.
kStatus_InvalidArgumentThe input argument is invalid.
kStatus_TxBusySPDIF is busy sending data.
status_t SPDIF_TransferReceiveEDMA ( SPDIF_Type *  base,
spdif_edma_handle_t *  handle,
spdif_edma_transfer_t xfer 
)
Note
This interface returns immediately after the transfer initiates. Call the SPDIF_GetReceiveRemainingBytes to poll the transfer status and check whether the SPDIF transfer is finished.
Parameters
baseSPDIF base pointer
handleSPDIF eDMA handle pointer.
xferPointer to DMA transfer structure.
Return values
kStatus_SuccessStart a SPDIF eDMA receive successfully.
kStatus_InvalidArgumentThe input argument is invalid.
kStatus_RxBusySPDIF is busy receiving data.
void SPDIF_TransferAbortSendEDMA ( SPDIF_Type *  base,
spdif_edma_handle_t *  handle 
)
Parameters
baseSPDIF base pointer.
handleSPDIF eDMA handle pointer.
void SPDIF_TransferAbortReceiveEDMA ( SPDIF_Type *  base,
spdif_edma_handle_t *  handle 
)
Parameters
baseSPDIF base pointer
handleSPDIF eDMA handle pointer.
status_t SPDIF_TransferGetSendCountEDMA ( SPDIF_Type *  base,
spdif_edma_handle_t *  handle,
size_t *  count 
)
Parameters
baseSPDIF base pointer.
handleSPDIF eDMA handle pointer.
countBytes count sent by SPDIF.
Return values
kStatus_SuccessSucceed get the transfer count.
kStatus_NoTransferInProgressThere is no non-blocking transaction in progress.
status_t SPDIF_TransferGetReceiveCountEDMA ( SPDIF_Type *  base,
spdif_edma_handle_t *  handle,
size_t *  count 
)
Parameters
baseSPDIF base pointer
handleSPDIF eDMA handle pointer.
countBytes count received by SPDIF.
Return values
kStatus_SuccessSucceed get the transfer count.
kStatus_NoTransferInProgressThere is no non-blocking transaction in progress.