Kinetis SDK v.2.0 API Reference Manual  Rev. 0
Freescale Semiconductor, Inc.
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
FlexIO eDMA I2S Driver

Overview

Files

file  fsl_flexio_i2s_edma.h
 

Data Structures

struct  flexio_i2s_edma_handle_t
 FlexIO I2S DMA transfer handle, users should not touch the content of the handle. More...
 

Typedefs

typedef void(* flexio_i2s_edma_callback_t )(FLEXIO_I2S_Type *base, flexio_i2s_edma_handle_t *handle, status_t status, void *userData)
 FlexIO I2S eDMA transfer callback function for finish and error.
 

eDMA Transactional

void FLEXIO_I2S_TransferTxCreateHandleEDMA (FLEXIO_I2S_Type *base, flexio_i2s_edma_handle_t *handle, flexio_i2s_edma_callback_t callback, void *userData, edma_handle_t *dmaHandle)
 Initializes the FlexIO I2S eDMA handle. More...
 
void FLEXIO_I2S_TransferRxCreateHandleEDMA (FLEXIO_I2S_Type *base, flexio_i2s_edma_handle_t *handle, flexio_i2s_edma_callback_t callback, void *userData, edma_handle_t *dmaHandle)
 Initializes the FlexIO I2S Rx eDMA handle. More...
 
void FLEXIO_I2S_TransferSetFormatEDMA (FLEXIO_I2S_Type *base, flexio_i2s_edma_handle_t *handle, flexio_i2s_format_t *format, uint32_t srcClock_Hz)
 Configures the FlexIO I2S Tx audio format. More...
 
status_t FLEXIO_I2S_TransferSendEDMA (FLEXIO_I2S_Type *base, flexio_i2s_edma_handle_t *handle, flexio_i2s_transfer_t *xfer)
 Performs a non-blocking FlexIO I2S transfer using DMA. More...
 
status_t FLEXIO_I2S_TransferReceiveEDMA (FLEXIO_I2S_Type *base, flexio_i2s_edma_handle_t *handle, flexio_i2s_transfer_t *xfer)
 Performs a non-blocking FlexIO I2S receive using eDMA. More...
 
void FLEXIO_I2S_TransferAbortSendEDMA (FLEXIO_I2S_Type *base, flexio_i2s_edma_handle_t *handle)
 Aborts a FlexIO I2S transfer using eDMA. More...
 
void FLEXIO_I2S_TransferAbortReceiveEDMA (FLEXIO_I2S_Type *base, flexio_i2s_edma_handle_t *handle)
 Aborts a FlexIO I2S receive using eDMA. More...
 
status_t FLEXIO_I2S_TransferGetSendCountEDMA (FLEXIO_I2S_Type *base, flexio_i2s_edma_handle_t *handle, size_t *count)
 Gets the remaining bytes to be sent. More...
 
status_t FLEXIO_I2S_TransferGetReceiveCountEDMA (FLEXIO_I2S_Type *base, flexio_i2s_edma_handle_t *handle, size_t *count)
 Get the remaining bytes to be received. More...
 

Data Structure Documentation

struct _flexio_i2s_edma_handle

Data Fields

edma_handle_tdmaHandle
 DMA handler for FlexIO I2S send.
 
uint8_t bytesPerFrame
 Bytes in a frame.
 
uint32_t state
 Internal state for FlexIO I2S eDMA transfer.
 
flexio_i2s_edma_callback_t callback
 Callback for users while transfer finish or error occurred.
 
void * userData
 User callback parameter.
 
edma_tcd_t tcd [FLEXIO_I2S_XFER_QUEUE_SIZE+1U]
 TCD pool for eDMA transfer. More...
 
flexio_i2s_transfer_t queue [FLEXIO_I2S_XFER_QUEUE_SIZE]
 Transfer queue storing queued transfer. More...
 
size_t transferSize [FLEXIO_I2S_XFER_QUEUE_SIZE]
 Data bytes need to transfer.
 
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

edma_tcd_t flexio_i2s_edma_handle_t::tcd[FLEXIO_I2S_XFER_QUEUE_SIZE+1U]
flexio_i2s_transfer_t flexio_i2s_edma_handle_t::queue[FLEXIO_I2S_XFER_QUEUE_SIZE]
volatile uint8_t flexio_i2s_edma_handle_t::queueUser

Function Documentation

void FLEXIO_I2S_TransferTxCreateHandleEDMA ( FLEXIO_I2S_Type base,
flexio_i2s_edma_handle_t *  handle,
flexio_i2s_edma_callback_t  callback,
void *  userData,
edma_handle_t dmaHandle 
)

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

Parameters
baseFlexIO I2S peripheral base address.
handleFlexIO I2S eDMA handle pointer.
callbackFlexIO I2S eDMA callback function called while finished a block.
userDataUser parameter for callback.
dmaHandleeDMA handle for FlexIO I2S. This handle shall be a static value allocated by users.
void FLEXIO_I2S_TransferRxCreateHandleEDMA ( FLEXIO_I2S_Type base,
flexio_i2s_edma_handle_t *  handle,
flexio_i2s_edma_callback_t  callback,
void *  userData,
edma_handle_t dmaHandle 
)

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

Parameters
baseFlexIO I2S peripheral base address.
handleFlexIO I2S eDMA handle pointer.
callbackFlexIO I2S eDMA callback function called while finished a block.
userDataUser parameter for callback.
dmaHandleeDMA handle for FlexIO I2S. This handle shall be a static value allocated by users.
void FLEXIO_I2S_TransferSetFormatEDMA ( FLEXIO_I2S_Type base,
flexio_i2s_edma_handle_t *  handle,
flexio_i2s_format_t format,
uint32_t  srcClock_Hz 
)

Audio format can be changed in run-time of FlexIO I2S. This function configures the sample rate and audio data format to be transferred. This function also sets eDMA parameter according to format.

Parameters
baseFlexIO I2S peripheral base address.
handleFlexIO I2S eDMA handle pointer
formatPointer to FlexIO I2S audio data format structure.
srcClock_HzFlexIO I2S clock source frequency in Hz, it should be 0 while in slave mode.
Return values
kStatus_SuccessAudio format set successfully.
kStatus_InvalidArgumentThe input arguments is invalid.
status_t FLEXIO_I2S_TransferSendEDMA ( FLEXIO_I2S_Type base,
flexio_i2s_edma_handle_t *  handle,
flexio_i2s_transfer_t xfer 
)
Note
This interface returned immediately after transfer initiates, users should call FLEXIO_I2S_GetTransferStatus to poll the transfer status to check whether FlexIO I2S transfer finished.
Parameters
baseFlexIO I2S peripheral base address.
handleFlexIO I2S DMA handle pointer.
xferPointer to DMA transfer structure.
Return values
kStatus_SuccessStart a FlexIO I2S eDMA send successfully.
kStatus_InvalidArgumentThe input arguments is invalid.
kStatus_TxBusyFlexIO I2S is busy sending data.
status_t FLEXIO_I2S_TransferReceiveEDMA ( FLEXIO_I2S_Type base,
flexio_i2s_edma_handle_t *  handle,
flexio_i2s_transfer_t xfer 
)
Note
This interface returned immediately after transfer initiates, users should call FLEXIO_I2S_GetReceiveRemainingBytes to poll the transfer status to check whether FlexIO I2S transfer finished.
Parameters
baseFlexIO I2S peripheral base address.
handleFlexIO I2S DMA handle pointer.
xferPointer to DMA transfer structure.
Return values
kStatus_SuccessStart a FlexIO I2S eDMA receive successfully.
kStatus_InvalidArgumentThe input arguments is invalid.
kStatus_RxBusyFlexIO I2S is busy receiving data.
void FLEXIO_I2S_TransferAbortSendEDMA ( FLEXIO_I2S_Type base,
flexio_i2s_edma_handle_t *  handle 
)
Parameters
baseFlexIO I2S peripheral base address.
handleFlexIO I2S DMA handle pointer.
void FLEXIO_I2S_TransferAbortReceiveEDMA ( FLEXIO_I2S_Type base,
flexio_i2s_edma_handle_t *  handle 
)
Parameters
baseFlexIO I2S peripheral base address.
handleFlexIO I2S DMA handle pointer.
status_t FLEXIO_I2S_TransferGetSendCountEDMA ( FLEXIO_I2S_Type base,
flexio_i2s_edma_handle_t *  handle,
size_t *  count 
)
Parameters
baseFlexIO I2S peripheral base address.
handleFlexIO I2S DMA handle pointer.
countBytes sent.
Return values
kStatus_SuccessSucceed get the transfer count.
kStatus_NoTransferInProgressThere is not a non-blocking transaction currently in progress.
status_t FLEXIO_I2S_TransferGetReceiveCountEDMA ( FLEXIO_I2S_Type base,
flexio_i2s_edma_handle_t *  handle,
size_t *  count 
)
Parameters
baseFlexIO I2S peripheral base address.
handleFlexIO I2S DMA handle pointer.
countBytes received.
Return values
kStatus_SuccessSucceed get the transfer count.
kStatus_NoTransferInProgressThere is not a non-blocking transaction currently in progress.