AM275 FreeRTOS SDK  11.01.00
aasrc_soc.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 
47 #ifndef AASRC_SOC_H_
48 #define AASRC_SOC_H_
49 
50 /* ========================================================================== */
51 /* Include Files */
52 /* ========================================================================== */
53 
54 #include <drivers/soc.h>
55 #include <drivers/hw_include/am275x/cslr_main_ctrl_mmr.h>
56 
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60 
61 /* ========================================================================== */
62 /* Macros & Typedefs */
63 /* ========================================================================== */
64 
65 /* AASRC Instance numbers */
66 #define AASRC0 (0U)
67 #define AASRC1 (1U)
68 
69 /* CLEC offset for AASRC Interrupts */
70 #define AASRC_IRQ_CLEC_OFFSET (224U)
71 
72 /* AASRC Instance count */
73 #define AASRC_INSTANCE_COUNT (2U)
74 /* AASRC external clock mux max value */
75 #define AASRC_EXTERNAL_CLOCK_SRC_MAX_VAL (0x1BU)
76 /* AASRC external audio pll divisor value
77  * Use 1 to divide by 2
78  * =2, to get 12.288 MHz from 24.576 MHz*/
79 #define AASRC_DIV_PLL4_HSDIV3_DIVISOR (1U)
80 /* AASRC soft reset cycles count, needs 16 cycles of aasrc sys_clk ticks
81  * AASRC runs at 200MHz, assuming C7 or R5 runs at 1 GHz
82  * ratio = 5, so we need 16 x 5 = 80 processor cycles.
83  * for safety, double this = 160 */
84 #define AASRC_SOFTRESET_CYCLES (160U)
85 
92 #define AASRC_RXSYNC_McASP0_AFSR (0x0U)
93 #define AASRC_RXSYNC_McASP1_AFSR (0x1U)
94 #define AASRC_RXSYNC_McASP2_AFSR (0x2U)
95 #define AASRC_RXSYNC_McASP3_AFSR (0x3U)
96 #define AASRC_RXSYNC_McASP4_AFSR (0x4U)
97 #define AASRC_RXSYNC_McASP0_AFSX (0x8U)
98 #define AASRC_RXSYNC_McASP1_AFSX (0x9U)
99 #define AASRC_RXSYNC_McASP2_AFSX (0xAU)
100 #define AASRC_RXSYNC_McASP3_AFSX (0xBU)
101 #define AASRC_RXSYNC_McASP4_AFSX (0xCU)
102 #define AASRC_RXSYNC_AUDIO_EXT_REFCLK0_Pin (0x10U)
103 #define AASRC_RXSYNC_AUDIO_EXT_REFCLK1_Pin (0x11U)
104 #define AASRC_RXSYNC_AUDIO_EXT_REFCLK2_Pin (0x12U)
105 #define AASRC_RXSYNC_ADC0_CLK (0x14U)
106 #define AASRC_RXSYNC_MLB_IO_CLK (0x15U)
107 #define AASRC_RXSYNC_MAIN_PLL4_HSDIV3_CLKOUT (0x16U)
108 #define AASRC_RXSYNC_MCU_EXT_REFCLK0_Pin (0x18U)
109 #define AASRC_RXSYNC_EXT_REFCLK1_Pin (0x19U)
110 #define AASRC_RXSYNC_CPSW_CPTS_GENF0 (0x1AU)
111 #define AASRC_RXSYNC_CPSW_CPTS_GENF1 (0x1BU)
112 #define AASRC_RXSYNC_INVALID_CLOCK (0xFFU)
113 
121 #define AASRC_TXSYNC_McASP0_AFSR (0x0U)
122 #define AASRC_TXSYNC_McASP1_AFSR (0x1U)
123 #define AASRC_TXSYNC_McASP2_AFSR (0x2U)
124 #define AASRC_TXSYNC_McASP3_AFSR (0x3U)
125 #define AASRC_TXSYNC_McASP4_AFSR (0x4U)
126 #define AASRC_TXSYNC_McASP0_AFSX (0x8U)
127 #define AASRC_TXSYNC_McASP1_AFSX (0x9U)
128 #define AASRC_TXSYNC_McASP2_AFSX (0xAU)
129 #define AASRC_TXSYNC_McASP3_AFSX (0xBU)
130 #define AASRC_TXSYNC_McASP4_AFSX (0xCU)
131 #define AASRC_TXSYNC_AUDIO_EXT_REFCLK0_Pin (0x10U)
132 #define AASRC_TXSYNC_AUDIO_EXT_REFCLK1_Pin (0x11U)
133 #define AASRC_TXSYNC_AUDIO_EXT_REFCLK2_Pin (0x12U)
134 #define AASRC_TXSYNC_ADC0_CLK (0x14U)
135 #define AASRC_TXSYNC_MLB_IO_CLK (0x15U)
136 #define AASRC_TXSYNC_MAIN_PLL4_HSDIV3_CLKOUT (0x16U)
137 #define AASRC_TXSYNC_MCU_EXT_REFCLK0_Pin (0x18U)
138 #define AASRC_TXSYNC_EXT_REFCLK1_Pin (0x19U)
139 #define AASRC_TXSYNC_CPSW_CPTS_GENF0 (0x1AU)
140 #define AASRC_TXSYNC_CPSW_CPTS_GENF1 (0x1BU)
141 #define AASRC_TXSYNC_INVALID_CLOCK (0xFFU)
142 
144 /* ========================================================================== */
145 /* API Function Declarations */
146 /* ========================================================================== */
147 
152 
163 int32_t AASRC_extClkSrcRxConfig(uint32_t instNum, uint32_t rxsync, uint32_t clk_source);
164 
175 int32_t AASRC_extClkSrcTxConfig(uint32_t instNum, uint32_t txsync, uint32_t clk_source);
176 
177 #ifdef __cplusplus
178 }
179 #endif
180 
181 #endif /* #ifndef AASRC_SOC_H_ */
182 
AASRC_extClkSrcTxConfig
int32_t AASRC_extClkSrcTxConfig(uint32_t instNum, uint32_t txsync, uint32_t clk_source)
Function to configure each aasrc_txsync input's external clk source.
AASRC_extClkSrcRxConfig
int32_t AASRC_extClkSrcRxConfig(uint32_t instNum, uint32_t rxsync, uint32_t clk_source)
Function to configure each aasrc_rxsync input's external clk source.
AASRC_audioPllDivConfig
void AASRC_audioPllDivConfig(void)
Function to configure audio pll divisor.