RTEMS 6.1-rc4
Loading...
Searching...
No Matches
fsl_sai_edma.h
1/*
2 * Copyright (c) 2015, Freescale Semiconductor, Inc.
3 * Copyright 2016-2021 NXP
4 * All rights reserved.
5 *
6 * SPDX-License-Identifier: BSD-3-Clause
7 */
8#ifndef _FSL_SAI_EDMA_H_
9#define _FSL_SAI_EDMA_H_
10
11#include "fsl_edma.h"
12#include "fsl_sai.h"
13
20/*******************************************************************************
21 * Definitions
22 ******************************************************************************/
23
26#define FSL_SAI_EDMA_DRIVER_VERSION (MAKE_VERSION(2, 5, 0))
28
30
32typedef void (*sai_edma_callback_t)(I2S_Type *base, sai_edma_handle_t *handle, status_t status, void *userData);
33
36{
38 uint8_t nbytes;
39 uint8_t bytesPerFrame;
40 uint8_t channelMask;
41 uint8_t channelNums;
42 uint8_t channel;
43 uint8_t count;
44 uint32_t state;
46 void *userData;
47 uint8_t tcd[(SAI_XFER_QUEUE_SIZE + 1U) * sizeof(edma_tcd_t)];
50 volatile uint8_t queueUser;
51 volatile uint8_t queueDriver;
52};
53
54/*******************************************************************************
55 * APIs
56 ******************************************************************************/
57#if defined(__cplusplus)
58extern "C" {
59#endif
60
80 sai_edma_handle_t *handle,
81 sai_edma_callback_t callback,
82 void *userData,
83 edma_handle_t *txDmaHandle);
84
99 sai_edma_handle_t *handle,
100 sai_edma_callback_t callback,
101 void *userData,
102 edma_handle_t *rxDmaHandle);
103
122 sai_edma_handle_t *handle,
124 uint32_t mclkSourceClockHz,
125 uint32_t bclkSourceClockHz);
126
145 sai_edma_handle_t *handle,
147 uint32_t mclkSourceClockHz,
148 uint32_t bclkSourceClockHz);
149
171
192
213
234
253 sai_edma_handle_t *handle,
254 sai_transfer_t *xfer,
255 uint32_t loopTransferCount);
256
275 sai_edma_handle_t *handle,
276 sai_transfer_t *xfer,
277 uint32_t loopTransferCount);
278
289
300
311
322
333
344
357
360#if defined(__cplusplus)
361}
362#endif
363
367#endif
int32_t status_t
Type used for all status and error return values.
Definition: fsl_common.h:225
#define SAI_XFER_QUEUE_SIZE
SAI transfer queue size, user can refine it according to use case.
Definition: fsl_sai.h:204
status_t SAI_TransferGetSendCountEDMA(I2S_Type *base, sai_edma_handle_t *handle, size_t *count)
Gets byte count sent by SAI.
Definition: fsl_sai_edma.c:960
void SAI_TransferAbortSendEDMA(I2S_Type *base, sai_edma_handle_t *handle)
Aborts a SAI transfer using eDMA.
Definition: fsl_sai_edma.c:830
status_t SAI_TransferSendLoopEDMA(I2S_Type *base, sai_edma_handle_t *handle, sai_transfer_t *xfer, uint32_t loopTransferCount)
Performs a non-blocking SAI loop transfer using eDMA.
Definition: fsl_sai_edma.c:671
uint32_t SAI_TransferGetValidTransferSlotsEDMA(I2S_Type *base, sai_edma_handle_t *handle)
Gets valid transfer slot.
Definition: fsl_sai_edma.c:1020
void SAI_TransferAbortReceiveEDMA(I2S_Type *base, sai_edma_handle_t *handle)
Aborts a SAI receive using eDMA.
Definition: fsl_sai_edma.c:870
void SAI_TransferRxCreateHandleEDMA(I2S_Type *base, sai_edma_handle_t *handle, sai_edma_callback_t callback, void *userData, edma_handle_t *rxDmaHandle)
Initializes the SAI Rx eDMA handle.
Definition: fsl_sai_edma.c:225
void SAI_TransferTxSetConfigEDMA(I2S_Type *base, sai_edma_handle_t *handle, sai_transceiver_t *saiConfig)
Configures the SAI Tx.
Definition: fsl_sai_edma.c:322
void SAI_TransferRxSetFormatEDMA(I2S_Type *base, sai_edma_handle_t *handle, sai_transfer_format_t *format, uint32_t mclkSourceClockHz, uint32_t bclkSourceClockHz)
Configures the SAI Rx audio format.
Definition: fsl_sai_edma.c:377
void SAI_TransferTerminateSendEDMA(I2S_Type *base, sai_edma_handle_t *handle)
Terminate all SAI send.
Definition: fsl_sai_edma.c:910
void SAI_TransferTxSetFormatEDMA(I2S_Type *base, sai_edma_handle_t *handle, sai_transfer_format_t *format, uint32_t mclkSourceClockHz, uint32_t bclkSourceClockHz)
Configures the SAI Tx audio format.
Definition: fsl_sai_edma.c:270
status_t SAI_TransferSendEDMA(I2S_Type *base, sai_edma_handle_t *handle, sai_transfer_t *xfer)
Performs a non-blocking SAI transfer using DMA.
Definition: fsl_sai_edma.c:486
void SAI_TransferTerminateReceiveEDMA(I2S_Type *base, sai_edma_handle_t *handle)
Terminate all SAI receive.
Definition: fsl_sai_edma.c:935
void SAI_TransferTxCreateHandleEDMA(I2S_Type *base, sai_edma_handle_t *handle, sai_edma_callback_t callback, void *userData, edma_handle_t *txDmaHandle)
Initializes the SAI eDMA handle.
Definition: fsl_sai_edma.c:184
status_t SAI_TransferReceiveEDMA(I2S_Type *base, sai_edma_handle_t *handle, sai_transfer_t *xfer)
Performs a non-blocking SAI receive using eDMA.
Definition: fsl_sai_edma.c:580
status_t SAI_TransferReceiveLoopEDMA(I2S_Type *base, sai_edma_handle_t *handle, sai_transfer_t *xfer, uint32_t loopTransferCount)
Performs a non-blocking SAI loop transfer using eDMA.
Definition: fsl_sai_edma.c:755
status_t SAI_TransferGetReceiveCountEDMA(I2S_Type *base, sai_edma_handle_t *handle, size_t *count)
Gets byte count received by SAI.
Definition: fsl_sai_edma.c:989
void SAI_TransferRxSetConfigEDMA(I2S_Type *base, sai_edma_handle_t *handle, sai_transceiver_t *saiConfig)
Configures the SAI Rx.
Definition: fsl_sai_edma.c:429
void(* sai_edma_callback_t)(I2S_Type *base, sai_edma_handle_t *handle, status_t status, void *userData)
SAI eDMA transfer callback function for finish and error.
Definition: fsl_sai_edma.h:32
Definition: MIMXRT1052.h:23296
eDMA transfer handle structure
Definition: fsl_edma.h:244
eDMA TCD.
Definition: fsl_edma.h:205
sai transceiver configurations
Definition: fsl_sai.h:395
sai transfer format
Definition: fsl_sai.h:271
SAI transfer structure.
Definition: fsl_sai.h:415
Definition: mknod-pack_dev.c:254
SAI DMA transfer handle, users should not touch the content of the handle.
Definition: fsl_sai_edma.h:36
edma_handle_t * dmaHandle
Definition: fsl_sai_edma.h:37
uint8_t nbytes
Definition: fsl_sai_edma.h:38
uint8_t channelNums
Definition: fsl_sai_edma.h:41
uint8_t tcd[(SAI_XFER_QUEUE_SIZE+1U) *sizeof(edma_tcd_t)]
Definition: fsl_sai_edma.h:47
uint32_t state
Definition: fsl_sai_edma.h:44
uint8_t channel
Definition: fsl_sai_edma.h:42
uint8_t count
Definition: fsl_sai_edma.h:43
uint8_t bytesPerFrame
Definition: fsl_sai_edma.h:39
size_t transferSize[SAI_XFER_QUEUE_SIZE]
Definition: fsl_sai_edma.h:49
uint8_t channelMask
Definition: fsl_sai_edma.h:40
volatile uint8_t queueDriver
Definition: fsl_sai_edma.h:51
void * userData
Definition: fsl_sai_edma.h:46
sai_transfer_t saiQueue[SAI_XFER_QUEUE_SIZE]
Definition: fsl_sai_edma.h:48
volatile uint8_t queueUser
Definition: fsl_sai_edma.h:50
sai_edma_callback_t callback
Definition: fsl_sai_edma.h:45