RTEMS 6.1-rc6
Loading...
Searching...
No Matches
Data Structures
PDM EDMA Driver

Data Structures

struct  _pdm_edma_transfer
 PDM edma transfer. More...
 
struct  _pdm_edma_handle
 PDM DMA transfer handle, users should not touch the content of the handle. More...
 

Driver version

enum  _pdm_edma_multi_channel_interleave { kPDM_EDMAMultiChannelInterleavePerChannelSample , kPDM_EDMAMultiChannelInterleavePerChannelBlock }
 pdm multi channel interleave type More...
 
typedef struct _pdm_edma_handle pdm_edma_handle_t
 PDM edma handler.
 
typedef enum _pdm_edma_multi_channel_interleave pdm_edma_multi_channel_interleave_t
 pdm multi channel interleave type
 
typedef struct _pdm_edma_transfer pdm_edma_transfer_t
 PDM edma transfer.
 
typedef void(* pdm_edma_callback_t) (PDM_Type *base, pdm_edma_handle_t *handle, status_t status, void *userData)
 PDM eDMA transfer callback function for finish and error.
 
#define FSL_PDM_EDMA_DRIVER_VERSION   (MAKE_VERSION(2, 6, 1))
 

PDM eDMA Transactional

void PDM_TransferInstallEDMATCDMemory (pdm_edma_handle_t *handle, void *tcdAddr, size_t tcdNum)
 Install EDMA descriptor memory.
 
void PDM_TransferCreateHandleEDMA (PDM_Type *base, pdm_edma_handle_t *handle, pdm_edma_callback_t callback, void *userData, edma_handle_t *dmaHandle)
 Initializes the PDM Rx eDMA handle.
 
void PDM_TransferSetMultiChannelInterleaveType (pdm_edma_handle_t *handle, pdm_edma_multi_channel_interleave_t multiChannelInterleaveType)
 Initializes the multi PDM channel interleave type.
 
void PDM_TransferSetChannelConfigEDMA (PDM_Type *base, pdm_edma_handle_t *handle, uint32_t channel, const pdm_channel_config_t *config)
 Configures the PDM channel.
 
status_t PDM_TransferReceiveEDMA (PDM_Type *base, pdm_edma_handle_t *handle, pdm_edma_transfer_t *xfer)
 Performs a non-blocking PDM receive using eDMA.
 
void PDM_TransferTerminateReceiveEDMA (PDM_Type *base, pdm_edma_handle_t *handle)
 Terminate all PDM receive.
 
void PDM_TransferAbortReceiveEDMA (PDM_Type *base, pdm_edma_handle_t *handle)
 Aborts a PDM receive using eDMA.
 
status_t PDM_TransferGetReceiveCountEDMA (PDM_Type *base, pdm_edma_handle_t *handle, size_t *count)
 Gets byte count received by PDM.
 

Detailed Description

Macro Definition Documentation

◆ FSL_PDM_EDMA_DRIVER_VERSION

#define FSL_PDM_EDMA_DRIVER_VERSION   (MAKE_VERSION(2, 6, 1))

Version 2.6.1

Enumeration Type Documentation

◆ _pdm_edma_multi_channel_interleave

pdm multi channel interleave type

Enumerator
kPDM_EDMAMultiChannelInterleavePerChannelSample 

multi channel PDM data interleave per channel sample

|CHANNEL0 | CHANNEL1 | CHANNEL0 | CHANNEL1 | CHANNEL0 | CHANNEL 1 | ....|

kPDM_EDMAMultiChannelInterleavePerChannelBlock 

multi channel PDM data interleave per channel block

|CHANNEL0 | CHANNEL0 | CHANNEL0 | ...... | CHANNEL1 | CHANNEL 1 | CHANNEL 1 | ....| CHANNEL2 | CHANNEL 2

| CHANNEL 2 | ....|

Function Documentation

◆ PDM_TransferAbortReceiveEDMA()

void PDM_TransferAbortReceiveEDMA ( PDM_Type base,
pdm_edma_handle_t handle 
)

Aborts a PDM receive using eDMA.

This function only aborts the current transfer slots, the other transfer slots' information still kept in the handler. If users want to terminate all transfer slots, just call PDM_TransferTerminateReceiveEDMA.

Parameters
basePDM base pointer
handlePDM eDMA handle pointer.

brief Aborts a PDM receive using eDMA.

This function only aborts the current transfer slots, the other transfer slots' information still kept in the handler. If users want to terminate all transfer slots, just call PDM_TransferTerminateReceiveEDMA.

param base PDM base pointer param handle PDM eDMA handle pointer.

◆ PDM_TransferCreateHandleEDMA()

void PDM_TransferCreateHandleEDMA ( PDM_Type base,
pdm_edma_handle_t handle,
pdm_edma_callback_t  callback,
void *  userData,
edma_handle_t dmaHandle 
)

Initializes the PDM Rx eDMA handle.

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

Parameters
basePDM base pointer.
handlePDM eDMA handle pointer.
callbackPointer to user callback function.
userDataUser parameter passed to the callback function.
dmaHandleeDMA handle pointer, this handle shall be static allocated by users.

brief Initializes the PDM Rx eDMA handle.

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

param base PDM base pointer. param handle PDM eDMA handle pointer. param base PDM peripheral base address. param callback Pointer to user callback function. param userData User parameter passed to the callback function. param dmaHandle eDMA handle pointer, this handle shall be static allocated by users.

◆ PDM_TransferGetReceiveCountEDMA()

status_t PDM_TransferGetReceiveCountEDMA ( PDM_Type base,
pdm_edma_handle_t handle,
size_t *  count 
)

Gets byte count received by PDM.

Parameters
basePDM base pointer
handlePDM eDMA handle pointer.
countBytes count received by PDM.
Return values
kStatus_SuccessSucceed get the transfer count.
kStatus_NoTransferInProgressThere is no non-blocking transaction in progress.

brief Gets byte count received by PDM.

param base PDM base pointer param handle PDM eDMA handle pointer. param count Bytes count received by PDM. retval kStatus_Success Succeed get the transfer count. retval kStatus_NoTransferInProgress There is no non-blocking transaction in progress.

◆ PDM_TransferInstallEDMATCDMemory()

void PDM_TransferInstallEDMATCDMemory ( pdm_edma_handle_t handle,
void *  tcdAddr,
size_t  tcdNum 
)

Install EDMA descriptor memory.

Parameters
handlePointer to EDMA channel transfer handle.
tcdAddrEDMA head descriptor address.
tcdNumEDMA link descriptor address.

brief Install EDMA descriptor memory.

param handle Pointer to EDMA channel transfer handle. param tcdAddr EDMA head descriptor address. param tcdNum EDMA link descriptor address.

◆ PDM_TransferReceiveEDMA()

status_t PDM_TransferReceiveEDMA ( PDM_Type base,
pdm_edma_handle_t handle,
pdm_edma_transfer_t xfer 
)

Performs a non-blocking PDM receive using eDMA.

Note
This interface returns immediately after the transfer initiates. Call the PDM_GetReceiveRemainingBytes to poll the transfer status and check whether the PDM transfer is finished.
  1. Scatter gather case: This functio support dynamic scatter gather and staic scatter gather, a. for the dynamic scatter gather case: Application should call PDM_TransferReceiveEDMA function continuously to make sure new receive request is submit before the previous one finish. b. for the static scatter gather case: Application should use the link transfer feature and make sure a loop link transfer is provided, such as:
    pdm_edma_transfer_t pdmXfer[2] =
    {
    {
    .data = s_buffer,
    .dataSize = BUFFER_SIZE,
    .linkTransfer = &pdmXfer[1],
    },
    {
    .data = &s_buffer[BUFFER_SIZE],
    .dataSize = BUFFER_SIZE,
    .linkTransfer = &pdmXfer[0]
    },
    };
    PDM edma transfer.
    Definition: fsl_pdm_edma.h:51
    volatile uint8_t * data
    Definition: fsl_pdm_edma.h:52
  2. Multi channel case: This function support receive multi pdm channel data, for example, if two channel is requested,
    PDM_TransferSetChannelConfigEDMA(DEMO_PDM, &s_pdmRxHandle_0, DEMO_PDM_ENABLE_CHANNEL_0, &channelConfig);
    PDM_TransferSetChannelConfigEDMA(DEMO_PDM, &s_pdmRxHandle_0, DEMO_PDM_ENABLE_CHANNEL_1, &channelConfig);
    PDM_TransferReceiveEDMA(DEMO_PDM, &s_pdmRxHandle_0, pdmXfer);
    void PDM_TransferSetChannelConfigEDMA(PDM_Type *base, pdm_edma_handle_t *handle, uint32_t channel, const pdm_channel_config_t *config)
    Configures the PDM channel.
    Definition: fsl_pdm_edma.c:194
    status_t PDM_TransferReceiveEDMA(PDM_Type *base, pdm_edma_handle_t *handle, pdm_edma_transfer_t *xfer)
    Performs a non-blocking PDM receive using eDMA.
    Definition: fsl_pdm_edma.c:278
    The output data will be formatted as below if handle->interleaveType =

    kPDM_EDMAMultiChannelInterleavePerChannelSample :

|CHANNEL0 | CHANNEL1 | CHANNEL0 | CHANNEL1 | CHANNEL0 | CHANNEL 1 | ....|

The output data will be formatted as below if handle->interleaveType = kPDM_EDMAMultiChannelInterleavePerChannelBlock

:

|CHANNEL3 | CHANNEL3 | CHANNEL3 | .... | CHANNEL4 | CHANNEL 4 | CHANNEL4 |....| CHANNEL5 | CHANNEL 5 | CHANNEL5

|....|

Note: the dataSize of xfer is the total data size, while application using kPDM_EDMAMultiChannelInterleavePerChannelBlock, the buffer size for each PDM channel is channelSize = dataSize / channelNums, then there are limitation for this feature,

  1. 3 DMIC array: the dataSize shall be 4 * (channelSize) The addtional buffer is mandantory for edma modulo feature.
  2. The kPDM_EDMAMultiChannelInterleavePerChannelBlock feature support below dmic array only, 2 DMIC array: CHANNEL3, CHANNEL4 3 DMIC array: CHANNEL3, CHANNEL4, CHANNEL5 4 DMIC array: CHANNEL3, CHANNEL4, CHANNEL5, CHANNEL6 Any other combinations is not support, that is to SAY, THE FEATURE SUPPORT RECEIVE START FROM CHANNEL3 ONLY AND 4 MAXIMUM DMIC CHANNELS.
Parameters
basePDM base pointer
handlePDM eDMA handle pointer.
xferPointer to DMA transfer structure.
Return values
kStatus_SuccessStart a PDM eDMA receive successfully.
kStatus_InvalidArgumentThe input argument is invalid.
kStatus_RxBusyPDM is busy receiving data.

brief Performs a non-blocking PDM receive using eDMA.

note This interface returns immediately after the transfer initiates. Call the PDM_GetReceiveRemainingBytes to poll the transfer status and check whether the PDM transfer is finished.

  1. Scatter gather case: This functio support dynamic scatter gather and staic scatter gather, a. for the dynamic scatter gather case: Application should call PDM_TransferReceiveEDMA function continuously to make sure new receive request is submit before the previous one finish. b. for the static scatter gather case: Application should use the link transfer feature and make sure a loop link transfer is provided, such as: code pdm_edma_transfer_t pdmXfer[2] = { { .data = s_buffer, .dataSize = BUFFER_SIZE, .linkTransfer = &pdmXfer[1], },

    { .data = &s_buffer[BUFFER_SIZE], .dataSize = BUFFER_SIZE, .linkTransfer = &pdmXfer[0] }, }; endcode

  2. Multi channel case: This function support receive multi pdm channel data, for example, if two channel is requested, code PDM_TransferSetChannelConfigEDMA(DEMO_PDM, &s_pdmRxHandle_0, DEMO_PDM_ENABLE_CHANNEL_0, &channelConfig); PDM_TransferSetChannelConfigEDMA(DEMO_PDM, &s_pdmRxHandle_0, DEMO_PDM_ENABLE_CHANNEL_1, &channelConfig); PDM_TransferReceiveEDMA(DEMO_PDM, &s_pdmRxHandle_0, pdmXfer); endcode The output data will be formatted as below if handle->interleaveType =

    kPDM_EDMAMultiChannelInterleavePerChannelSample :

|CHANNEL0 | CHANNEL1 | CHANNEL0 | CHANNEL1 | CHANNEL0 | CHANNEL 1 | ....|

The output data will be formatted as below if handle->interleaveType = kPDM_EDMAMultiChannelInterleavePerChannelBlock

:

|CHANNEL3 | CHANNEL3 | CHANNEL3 | .... | CHANNEL4 | CHANNEL 4 | CHANNEL4 |....| CHANNEL5 | CHANNEL 5 | CHANNEL5

|....|

Note: the dataSize of xfer is the total data size, while application using kPDM_EDMAMultiChannelInterleavePerChannelBlock, the buffer size for each PDM channel is channelSize = dataSize / channelNums, there are limitation for this feature,

  1. For 3 DMIC array: the dataSize shall be 4 * (channelSize) The addtional buffer is mandantory for edma modulo feature.
  2. The kPDM_EDMAMultiChannelInterleavePerChannelBlock feature support below dmic array only, 2 DMIC array: CHANNEL3, CHANNEL4 3 DMIC array: CHANNEL3, CHANNEL4, CHANNEL5 4 DMIC array: CHANNEL3, CHANNEL4, CHANNEL5, CHANNEL6 Any other combinations is not support, that is to SAY, THE FEATURE SUPPORT RECEIVE START FROM CHANNEL3 ONLY AND 4 MAXIMUM DMIC CHANNELS.

param base PDM base pointer param handle PDM eDMA handle pointer. param xfer Pointer to DMA transfer structure. retval kStatus_Success Start a PDM eDMA receive successfully. retval kStatus_InvalidArgument The input argument is invalid. retval kStatus_RxBusy PDM is busy receiving data.

◆ PDM_TransferSetChannelConfigEDMA()

void PDM_TransferSetChannelConfigEDMA ( PDM_Type base,
pdm_edma_handle_t handle,
uint32_t  channel,
const pdm_channel_config_t config 
)

Configures the PDM channel.

Parameters
basePDM base pointer.
handlePDM eDMA handle pointer.
channelchannel index.
configpdm channel configurations.

brief Configures the PDM channel.

param base PDM base pointer. param handle PDM eDMA handle pointer. param channel channel index. param pdmConfig pdm channel configurations.

◆ PDM_TransferSetMultiChannelInterleaveType()

void PDM_TransferSetMultiChannelInterleaveType ( pdm_edma_handle_t handle,
pdm_edma_multi_channel_interleave_t  multiChannelInterleaveType 
)

Initializes the multi PDM channel interleave type.

This function initializes the PDM DMA handle member interleaveType, it shall be called only when application would like to use type kPDM_EDMAMultiChannelInterleavePerChannelBlock, since the default interleaveType is kPDM_EDMAMultiChannelInterleavePerChannelSample always

Parameters
handlePDM eDMA handle pointer.
multiChannelInterleaveTypeMulti channel interleave type.

brief Initializes the multi PDM channel interleave type.

This function initializes the PDM DMA handle member interleaveType, it shall be called only when application would like to use type kPDM_EDMAMultiChannelInterleavePerChannelBlock, since the default interleaveType is kPDM_EDMAMultiChannelInterleavePerChannelSample always

param handle PDM eDMA handle pointer. param multiChannelInterleaveType Multi channel interleave type.

◆ PDM_TransferTerminateReceiveEDMA()

void PDM_TransferTerminateReceiveEDMA ( PDM_Type base,
pdm_edma_handle_t handle 
)

Terminate all PDM receive.

This function will clear all transfer slots buffered in the pdm queue. If users only want to abort the current transfer slot, please call PDM_TransferAbortReceiveEDMA.

Parameters
basePDM base pointer.
handlePDM eDMA handle pointer.

brief Terminate all PDM receive.

This function will clear all transfer slots buffered in the pdm queue. If users only want to abort the current transfer slot, please call PDM_TransferAbortReceiveEDMA.

param base PDM base pointer. param handle PDM eDMA handle pointer.