AM275 FreeRTOS SDK  11.01.00
aasrc/v0/aasrc.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 
50 #ifndef AASRC_H_
51 #define AASRC_H_
52 
53 /* ========================================================================== */
54 /* Include Files */
55 /* ========================================================================== */
56 
57 #include <stdint.h>
58 #include <stddef.h>
59 #include <stdbool.h>
60 #include <string.h>
61 #include <kernel/dpl/HwiP.h>
62 #include <kernel/dpl/SemaphoreP.h>
63 #include <kernel/dpl/QueueP.h>
65 #include <kernel/dpl/SystemP.h>
66 #include <kernel/dpl/CacheP.h>
67 #include <drivers/hw_include/csl_types.h>
68 #include "aasrc_types.h"
69 #include "soc/am275x/aasrc_soc.h"
70 #include "aasrc_priv.h"
71 #include "aasrc_clocking.h"
72 #include "aasrc_transactions.h"
73 #include "aasrc_ch.h"
74 #include "aasrc_dma.h"
75 #include "aasrc_intr.h"
76 
77 #ifdef __cplusplus
78 extern "C" {
79 #endif
80 
81 /* ========================================================================== */
82 /* Macros & Typedefs */
83 /* ========================================================================== */
84 
85 /* None */
86 
87 /* ========================================================================== */
88 /* Structure Definitions */
89 /* ========================================================================== */
90 
101 typedef struct
102 {
103  uint32_t transferMode;
115 
119 typedef struct
120 {
121  /*
122  * SOC configuration
123  */
124  uint32_t instNum;
126  uintptr_t baseAddr;
130  uintptr_t groupDataBaseAddr;
132  /*
133  * Driver configuration
134  */
135  AASRC_HwIntCfg intCfg[AASRC_PROCESSOR_INTERRUPT_COUNT];
137 } AASRC_Attrs;
138 
142 typedef struct
143 {
144  /*
145  * User parameters
146  */
149  uint32_t transferMode;
158  AASRC_ChObj chObj[AASRC_MAX_NUM_ASRC_CHANNELS];
162  /*
163  * State variables
164  */
165  bool isOpen;
167  HwiP_Object hwiObj[AASRC_PROCESSOR_INTERRUPT_COUNT];
169 } AASRC_Object;
170 
180 typedef struct
181 {
186 } AASRC_Config;
187 
189 extern AASRC_Config gAasrcConfig[];
190 
192 extern uint8_t gAasrcInstNum;
194 extern uint8_t gAasrcConfigChNum[];
196 extern uint8_t gAasrcRxClkZoneNum[];
198 extern uint8_t gAasrcTxClkZoneNum[];
199 
200 /* ========================================================================== */
201 /* API Function Declarations */
202 /* ========================================================================== */
203 
207 void AASRC_init(void);
208 
212 void AASRC_deinit(void);
213 
220 static inline void AASRC_OpenParamsInit(AASRC_Object *drvObj);
221 
236 AASRC_Handle AASRC_open(uint8_t instNum, const AASRC_OpenParams *openParams);
237 
247 void AASRC_close(AASRC_Handle drvHandle);
248 
263 
274 
275 /* ========================================================================== */
276 /* Static Function Definitions */
277 /* ========================================================================== */
278 
279 static inline void AASRC_OpenParamsInit(AASRC_Object *drvObj)
280 {
281  /* Set with default values */
282 
283  if (drvObj != NULL)
284  {
286 
287  drvObj->rxClkZoneCfg[0U].clkZoneDiv = 64U;
288  drvObj->rxClkZoneCfg[0U].isClkZoneDivEnable = 1U;
289  drvObj->rxClkZoneCfg[0U].syncPin = 0U;
290  drvObj->rxClkZoneCfg[0U].overrideClkSettle = 0U;
292 
293  drvObj->txClkZoneCfg[0U].clkZoneDiv = 64U;
294  drvObj->txClkZoneCfg[0U].isClkZoneDivEnable = 1U;
295  drvObj->txClkZoneCfg[0U].syncPin = 0U;
296  drvObj->txClkZoneCfg[0U].overrideClkSettle = 0U;
298  drvObj->isDataAlignmentDisabled = 0U;
299  }
300 }
301 
302 
303 /* None */
304 
305 #ifdef __cplusplus
306 }
307 #endif
308 
309 #endif /* #ifndef AASRC_H_ */
310 
AASRC_OpenParams::transferMode
uint32_t transferMode
Definition: aasrc/v0/aasrc.h:103
AASRC_OpenParams::dmaDrvObj
AASRC_DmaHandle dmaDrvObj
Definition: aasrc/v0/aasrc.h:112
AASRC_OpenParams
AASRC Parameters.
Definition: aasrc/v0/aasrc.h:102
aasrc_ch.h
AASRC channel related parameters and API.
aasrc_clocking.h
AASRC clocking related parameters and API.
AASRC_Object::transferMode
uint32_t transferMode
Definition: aasrc/v0/aasrc.h:149
AASRC_Object::rxClkZoneCfg
AASRC_ClockZoneConfig rxClkZoneCfg[AASRC_INPUT_CLOCK_ZONE_COUNT]
Definition: aasrc/v0/aasrc.h:151
index
uint16_t index
Definition: tisci_rm_proxy.h:3
SystemP.h
aasrc_transactions.h
AASRC transactions, transfer objects and parameters.
AASRC_Config::attrs
const AASRC_Attrs * attrs
Definition: aasrc/v0/aasrc.h:182
gAasrcRxClkZoneNum
uint8_t gAasrcRxClkZoneNum[]
Externally defined Rx Clockzone configuration array size
AASRC_Object::drvHandle
AASRC_Handle drvHandle
Definition: aasrc/v0/aasrc.h:147
AASRC_TXSYNC_INVALID_CLOCK
#define AASRC_TXSYNC_INVALID_CLOCK
Definition: aasrc_soc.h:141
AASRC_deinit
void AASRC_deinit(void)
This function de-initializes the AASRC module.
AASRC_getHandle
AASRC_Handle AASRC_getHandle(uint32_t index)
This function returns the handle of an open AASRC Instance from the instance index.
AASRC_ClockZoneConfig::clkZoneDiv
uint32_t clkZoneDiv
Definition: aasrc_ch.h:302
gAasrcConfigChNum
uint8_t gAasrcConfigChNum[]
Externally defined channel configuration array size
AASRC_Attrs::baseAddr
uintptr_t baseAddr
Definition: aasrc/v0/aasrc.h:126
SemaphoreP.h
AASRC_ChObj
AASRC Channel object.
Definition: aasrc_ch.h:333
AASRC_init
void AASRC_init(void)
This function initializes the AASRC module.
AASRC_OpenParamsInit
static void AASRC_OpenParamsInit(AASRC_Object *drvObj)
Function to initialize the AASRC_OpenParams struct to its defaults.
Definition: aasrc/v0/aasrc.h:279
AASRC_open
AASRC_Handle AASRC_open(uint8_t instNum, const AASRC_OpenParams *openParams)
This function opens a given AASRC IP Core.
AASRC_Attrs::groupDataBaseAddr
uintptr_t groupDataBaseAddr
Definition: aasrc/v0/aasrc.h:130
AASRC_close
void AASRC_close(AASRC_Handle drvHandle)
Function to close a AASRC IP Core specified by the AASRC handle.
CacheP.h
AASRC_Object::isDataAlignmentDisabled
uint32_t isDataAlignmentDisabled
Definition: aasrc/v0/aasrc.h:155
AASRC_Object::isOpen
bool isOpen
Definition: aasrc/v0/aasrc.h:165
AASRC_Handle
void * AASRC_Handle
A handle that is returned from a AASRC_open() call.
Definition: aasrc_types.h:65
AASRC_Config
AASRC global configuration array.
Definition: aasrc/v0/aasrc.h:181
AASRC_DmaHandle
void * AASRC_DmaHandle
AASRC udma handle which points to udma instance.
Definition: aasrc_types.h:74
HwiP.h
AASRC_Attrs::streamDataBaseAddr
uintptr_t streamDataBaseAddr
Definition: aasrc/v0/aasrc.h:128
AASRC_Object
AASRC driver object.
Definition: aasrc/v0/aasrc.h:143
AASRC_Attrs::instNum
uint32_t instNum
Definition: aasrc/v0/aasrc.h:124
AASRC_TRANSFER_MODE_INTERRUPT
#define AASRC_TRANSFER_MODE_INTERRUPT
AASRC read/write APIs does not block code execution and will call a AASRC_TxnCallbackFxn This mode ca...
Definition: aasrc_transactions.h:103
gAasrcConfig
AASRC_Config gAasrcConfig[]
Externally defined driver configuration array.
AASRC_OpenParams::isDataAlignmentDisabled
uint32_t isDataAlignmentDisabled
Definition: aasrc/v0/aasrc.h:109
QueueP.h
AASRC_Attrs
AASRC hardware instance attributes - used during init time.
Definition: aasrc/v0/aasrc.h:120
CycleCounterP.h
AASRC_Object::dmaDrvObj
AASRC_DmaHandle dmaDrvObj
Definition: aasrc/v0/aasrc.h:160
AASRC_softReset
void AASRC_softReset(AASRC_Handle drvHandle)
Function to soft reset a AASRC IP Core specified by the AASRC handle.
AASRC_INPUT_CLOCK_ZONE_COUNT
#define AASRC_INPUT_CLOCK_ZONE_COUNT
Maximum number of input and output clock zones.
Definition: aasrc_clocking.h:100
AASRC_Object::txClkZoneCfg
AASRC_ClockZoneConfig txClkZoneCfg[AASRC_OUTPUT_CLOCK_ZONE_COUNT]
Definition: aasrc/v0/aasrc.h:153
AASRC_ClockZoneConfig::overrideClkSettle
bool overrideClkSettle
Definition: aasrc_ch.h:311
AASRC_OUTPUT_CLOCK_ZONE_COUNT
#define AASRC_OUTPUT_CLOCK_ZONE_COUNT
Definition: aasrc_clocking.h:101
HwiP_Object
Opaque Hwi object used with the Hwi APIs.
Definition: HwiP.h:93
AASRC_ClockZoneConfig::isClkZoneDivEnable
bool isClkZoneDivEnable
Definition: aasrc_ch.h:304
AASRC_RXSYNC_INVALID_CLOCK
#define AASRC_RXSYNC_INVALID_CLOCK
Definition: aasrc_soc.h:112
AASRC_ClockZoneConfig
Hardware setup clock zones.
Definition: aasrc_ch.h:301
aasrc_soc.h
AASRC AM275X SoC specific file.
AASRC_ClockZoneConfig::extClkSrc
uint32_t extClkSrc
Definition: aasrc_ch.h:308
gAasrcTxClkZoneNum
uint8_t gAasrcTxClkZoneNum[]
Externally defined Tx Clockzone configuration array size
aasrc_types.h
AASRC Driver API/interface data types file.
gAasrcInstNum
uint8_t gAasrcInstNum
Externally defined driver configuration array size.
AASRC_Config::object
AASRC_Object * object
Definition: aasrc/v0/aasrc.h:184
aasrc_dma.h
AASRC dma related parameters and APIs.
AASRC_ClockZoneConfig::syncPin
uint8_t syncPin
Definition: aasrc_ch.h:306