RTEMS 6.1-rc1
fsl_asrc_edma.h
1/*
2 * Copyright 2019-2020 NXP
3 * All rights reserved.
4 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7#ifndef _FSL_ASRC_P2P_EDMA_H_
8#define _FSL_ASRC_P2P_EDMA_H_
9
10#include "fsl_edma.h"
11#include "fsl_asrc.h"
12
18/*******************************************************************************
19 * Definitions
20 ******************************************************************************/
21
24#define FSL_ASRC_EDMA_DRIVER_VERSION (MAKE_VERSION(2, 1, 0))
27#define ASRC_XFER_IN_QUEUE_SIZE 4U
28#define ASRC_XFER_OUT_QUEUE_SIZE (ASRC_XFER_QUEUE_SIZE * 2U)
29
31
33typedef void (*asrc_edma_callback_t)(ASRC_Type *base, asrc_edma_handle_t *handle, status_t status, void *userData);
34
36typedef void (*asrc_start_peripheral_t)(bool start);
39{
40 uint8_t watermark;
41 uint8_t channel;
44
47{
50 uint8_t tcd[(ASRC_XFER_IN_QUEUE_SIZE + 1U) * sizeof(edma_tcd_t)];
52 uint32_t sampleWidth;
53 uint32_t fifoThreshold;
56 volatile uint8_t queueUser;
57 volatile uint8_t queueDriver;
58 uint32_t state;
62
65{
68 uint8_t tcd[(ASRC_XFER_OUT_QUEUE_SIZE + 1U) * sizeof(edma_tcd_t)];
70 uint32_t sampleWidth;
71 uint32_t fifoThreshold;
72 uint32_t *asrcQueue[ASRC_XFER_OUT_QUEUE_SIZE];
73 size_t transferSize[ASRC_XFER_OUT_QUEUE_SIZE];
74 volatile uint8_t queueUser;
75 volatile uint8_t queueDriver;
76 uint32_t state;
79
82{
86 void *userData;
88};
89
90/*******************************************************************************
91 * APIs
92 ******************************************************************************/
93#if defined(__cplusplus)
94extern "C" {
95#endif
96
117 asrc_edma_handle_t *handle,
118 asrc_channel_pair_t channelPair,
119 asrc_edma_callback_t callback,
120 edma_handle_t *inDmaHandle,
121 const asrc_p2p_edma_config_t *periphConfig,
122 void *userData);
123
139 asrc_edma_handle_t *handle,
140 asrc_channel_pair_t channelPair,
141 asrc_edma_callback_t callback,
142 edma_handle_t *outDmaHandle,
143 const asrc_p2p_edma_config_t *periphConfig,
144 void *userData);
145
157 asrc_edma_handle_t *handle,
158 asrc_channel_pair_config_t *asrcConfig,
159 uint32_t inSampleRate,
160 uint32_t outSampleRate);
161
176 ASRC_Type *base, asrc_edma_handle_t *handle, uint32_t inSampleRate, uint32_t outSampleRate, uint32_t inSamplesize);
177
191
202
213
224
235
238#if defined(__cplusplus)
239}
240#endif
241
245#endif
enum _asrc_channel_pair asrc_channel_pair_t
ASRC channel pair mask.
struct _asrc_in_edma_handle asrc_in_edma_handle_t
void ASRC_TransferOutCreateHandleEDMA(ASRC_Type *base, asrc_edma_handle_t *handle, asrc_channel_pair_t channelPair, asrc_edma_callback_t callback, edma_handle_t *outDmaHandle, const asrc_p2p_edma_config_t *periphConfig, void *userData)
Initializes the ASRC OUT eDMA handle.
Definition: fsl_asrc_edma.c:164
void ASRC_TransferInTerminalEDMA(ASRC_Type *base, asrc_edma_handle_t *handle)
Terminate In ASRC Convert.
Definition: fsl_asrc_edma.c:424
struct _asrc_out_edma_handle asrc_out_edma_handle_t
void(* asrc_edma_callback_t)(ASRC_Type *base, asrc_edma_handle_t *handle, status_t status, void *userData)
ASRC eDMA transfer callback function for finish and error.
Definition: fsl_asrc_edma.h:33
void ASRC_TransferInCreateHandleEDMA(ASRC_Type *base, asrc_edma_handle_t *handle, asrc_channel_pair_t channelPair, asrc_edma_callback_t callback, edma_handle_t *inDmaHandle, const asrc_p2p_edma_config_t *periphConfig, void *userData)
Initializes the ASRC IN eDMA handle.
Definition: fsl_asrc_edma.c:117
void(* asrc_start_peripheral_t)(bool start)
ASRC trigger peripheral function pointer.
Definition: fsl_asrc_edma.h:36
void ASRC_TransferOutAbortEDMA(ASRC_Type *base, asrc_edma_handle_t *handle)
Aborts a ASRC OUT transfer using eDMA.
Definition: fsl_asrc_edma.c:400
void ASRC_TransferInAbortEDMA(ASRC_Type *base, asrc_edma_handle_t *handle)
Aborts a ASRC IN transfer using eDMA.
Definition: fsl_asrc_edma.c:376
status_t ASRC_TransferSetChannelPairConfigEDMA(ASRC_Type *base, asrc_edma_handle_t *handle, asrc_channel_pair_config_t *asrcConfig, uint32_t inSampleRate, uint32_t outSampleRate)
Configures the ASRC P2P channel pair.
Definition: fsl_asrc_edma.c:207
#define ASRC_XFER_IN_QUEUE_SIZE
ASRC IN edma QUEUE size.
Definition: fsl_asrc_edma.h:27
void ASRC_TransferOutTerminalEDMA(ASRC_Type *base, asrc_edma_handle_t *handle)
Terminate Out ASRC Convert.
Definition: fsl_asrc_edma.c:453
struct _asrc_p2p_edma_config asrc_p2p_edma_config_t
destination peripheral configuration
status_t ASRC_TransferEDMA(ASRC_Type *base, asrc_edma_handle_t *handle, asrc_transfer_t *xfer)
Performs a non-blocking ASRC m2m convert using EDMA.
Definition: fsl_asrc_edma.c:350
uint32_t ASRC_GetOutSamplesSizeEDMA(ASRC_Type *base, asrc_edma_handle_t *handle, uint32_t inSampleRate, uint32_t outSampleRate, uint32_t inSamplesize)
Get output sample buffer size can be transferred by edma.
Definition: fsl_asrc_edma.c:241
int32_t status_t
Type used for all status and error return values.
Definition: fsl_common.h:225
Definition: MIMXRT1166_cm4.h:9338
asrc channel pair configuation
Definition: fsl_asrc.h:274
ASRC DMA transfer handle.
Definition: fsl_asrc_edma.h:82
asrc_channel_pair_t channelPair
Definition: fsl_asrc_edma.h:85
void * userData
Definition: fsl_asrc_edma.h:86
asrc_in_edma_handle_t in
Definition: fsl_asrc_edma.h:83
asrc_edma_callback_t callback
Definition: fsl_asrc_edma.h:87
asrc_out_edma_handle_t out
Definition: fsl_asrc_edma.h:84
Definition: fsl_asrc_edma.h:47
uint32_t sampleWidth
Definition: fsl_asrc_edma.h:52
const asrc_p2p_edma_config_t * peripheralConfig
Definition: fsl_asrc_edma.h:60
volatile uint8_t queueDriver
Definition: fsl_asrc_edma.h:57
uint32_t * asrcQueue[ASRC_XFER_IN_QUEUE_SIZE]
Definition: fsl_asrc_edma.h:54
uint32_t state
Definition: fsl_asrc_edma.h:58
edma_handle_t * inDmaHandle
Definition: fsl_asrc_edma.h:48
size_t transferSize[ASRC_XFER_IN_QUEUE_SIZE]
Definition: fsl_asrc_edma.h:55
uint32_t fifoThreshold
Definition: fsl_asrc_edma.h:53
volatile uint8_t queueUser
Definition: fsl_asrc_edma.h:56
uint8_t tcd[(ASRC_XFER_IN_QUEUE_SIZE+1U) *sizeof(edma_tcd_t)]
Definition: fsl_asrc_edma.h:50
Definition: fsl_asrc_edma.h:65
uint32_t * asrcQueue[ASRC_XFER_OUT_QUEUE_SIZE]
Definition: fsl_asrc_edma.h:72
edma_handle_t * outDmaHandle
Definition: fsl_asrc_edma.h:66
uint32_t state
Definition: fsl_asrc_edma.h:76
volatile uint8_t queueUser
Definition: fsl_asrc_edma.h:74
uint32_t fifoThreshold
Definition: fsl_asrc_edma.h:71
volatile uint8_t queueDriver
Definition: fsl_asrc_edma.h:75
uint8_t tcd[(ASRC_XFER_OUT_QUEUE_SIZE+1U) *sizeof(edma_tcd_t)]
Definition: fsl_asrc_edma.h:68
size_t transferSize[ASRC_XFER_OUT_QUEUE_SIZE]
Definition: fsl_asrc_edma.h:73
const asrc_p2p_edma_config_t * peripheralConfig
Definition: fsl_asrc_edma.h:77
uint32_t sampleWidth
Definition: fsl_asrc_edma.h:70
destination peripheral configuration
Definition: fsl_asrc_edma.h:39
uint8_t channel
Definition: fsl_asrc_edma.h:41
uint8_t watermark
Definition: fsl_asrc_edma.h:40
asrc_start_peripheral_t startPeripheral
Definition: fsl_asrc_edma.h:42
SAI transfer structure.
Definition: fsl_asrc.h:302
eDMA transfer handle structure
Definition: fsl_edma.h:244
eDMA TCD.
Definition: fsl_edma.h:205