AM275 FreeRTOS SDK  11.01.00
aasrc_transactions.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2025 Texas Instruments Incorporated
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the
14  * distribution.
15  *
16  * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
48 #ifndef AASRC_TRANSACTIONS_H_
49 #define AASRC_TRANSACTIONS_H_
50 
51 /* ========================================================================== */
52 /* Include Files */
53 /* ========================================================================== */
54 
55 /* None */
56 
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60 
61 /* ========================================================================== */
62 /* Macros & Typedefs */
63 /* ========================================================================== */
64 
75 #define AASRC_TRANSFER_STATUS_QUEUED (0U)
76 
77 #define AASRC_TRANSFER_STATUS_LOADED (1U)
78 
79 #define AASRC_TRANSFER_STATUS_STARTED (2U)
80 
81 #define AASRC_TRANSFER_STATUS_COMPLETED (3U)
82 
83 #define AASRC_TRANSFER_STATUS_CANCELLED (4U)
84 
85 #define AASRC_TRANSFER_STATUS_FAILED (5U)
86 
87 #define AASRC_TRANSFER_STATUS_ERROR (6U)
88 
89 #define AASRC_TRANSFER_STATUS_TIMEOUT (7U)
90 
103 #define AASRC_TRANSFER_MODE_INTERRUPT (0U)
104 
108 #define AASRC_TRANSFER_MODE_DMA (1U)
109 
111 /* Limits the maximum number of words for an AASRC_Transaction
112  This equals 2GB of data for 32 bit samples. */
113 #define AASRC_MAX_TXN_WORD_COUNT (1024U*1024U*512U)
114 
115 /* AASRC driver will always use 32 bit words for data read/write for aglignment,
116  but the sample size can be 16, 18, 20, 24 bits */
117 #define AASRC_WORD_SIZE_IN_BYTES (4U)
118 #define AASRC_WORD_SIZE_IN_BITS (32U)
119 /* ========================================================================== */
120 /* Structure Declarations */
121 /* ========================================================================== */
122 
127 typedef struct
128 {
132  void *buf;
135  uint32_t sampleCount;
139  int32_t status;
141  void *args;
144 
145 
154 typedef void (*AASRC_TxnCallbackFxn) (AASRC_ChHandle chHandle,
155  AASRC_Transaction *transaction);
156 
166 typedef void (*AASRC_ChErrorCallbackFxn) (AASRC_ChHandle chHandle,
167  AASRC_Transaction *transactionRx,
168  AASRC_Transaction *transactionTx);
172 typedef struct
173 {
192  /*< Flag to enable loopjob. when enabled loopjob buffer is transmitted if application fails to load buffers.*/
194 
195 /* ========================================================================== */
196 /* API Function Declarations */
197 /* ========================================================================== */
198 
212 
226 
227 /* ========================================================================== */
228 /* Local Function Definitions */
229 /* ========================================================================== */
230 
231 /* None */
232 
233 #ifdef __cplusplus
234 }
235 #endif
236 
237 #endif /* #ifndef AASRC_TRANSACTIONS_H_ */
238 
AASRC_TransferObj::cbFxn
AASRC_TxnCallbackFxn cbFxn
Definition: aasrc_transactions.h:185
QueueP_Elem
Opaque QueueP element.
Definition: QueueP.h:77
AASRC_queueTransactionTx
int32_t AASRC_queueTransactionTx(AASRC_ChHandle chHandle, AASRC_Transaction *transaction)
Function submit transactions to AASRC output queue.
AASRC_ChHandle
void * AASRC_ChHandle
AASRC channel handle which points to AASRC channnel status and configs.
Definition: aasrc_types.h:71
AASRC_Transaction::args
void * args
Definition: aasrc_transactions.h:141
AASRC_Transaction
Data structure used with transfer call.
Definition: aasrc_transactions.h:128
AASRC_ChErrorCallbackFxn
void(* AASRC_ChErrorCallbackFxn)(AASRC_ChHandle chHandle, AASRC_Transaction *transactionRx, AASRC_Transaction *transactionTx)
The definition of a channel error callback function used by the AASRC driver when used in Callback Mo...
Definition: aasrc_transactions.h:166
AASRC_Transaction::buf
void * buf
Definition: aasrc_transactions.h:132
AASRC_TransferObj
AASRC Transfer Data structure stored in Channel object.
Definition: aasrc_transactions.h:173
AASRC_Transaction::sampleCount
uint32_t sampleCount
Definition: aasrc_transactions.h:135
AASRC_Transaction::status
int32_t status
Definition: aasrc_transactions.h:139
AASRC_TransferObj::xferCurrSampleCount
uint32_t xferCurrSampleCount
Definition: aasrc_transactions.h:179
AASRC_Transaction::qElem
QueueP_Elem qElem
Definition: aasrc_transactions.h:129
AASRC_TransferObj::loopjobEnable
bool loopjobEnable
Definition: aasrc_transactions.h:191
AASRC_TransferObj::txnLoopjob
AASRC_Transaction txnLoopjob
Definition: aasrc_transactions.h:189
AASRC_TxnCallbackFxn
void(* AASRC_TxnCallbackFxn)(AASRC_ChHandle chHandle, AASRC_Transaction *transaction)
The definition of a callback function used by the AASRC driver when used in Callback Mode.
Definition: aasrc_transactions.h:154
AASRC_TransferObj::xferTotSampleCount
uint32_t xferTotSampleCount
Definition: aasrc_transactions.h:174
AASRC_queueTransactionRx
int32_t AASRC_queueTransactionRx(AASRC_ChHandle chHandle, AASRC_Transaction *transaction)
Function submit transactions to AASRC input queue.
AASRC_TransferObj::transaction
AASRC_Transaction * transaction
Definition: aasrc_transactions.h:183