PDK API Guide for J721E
j721e/osal_soc.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017-present, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the 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 "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
48 #ifndef ti_osal_soc_j7_include
49 #define ti_osal_soc_j7_include
50 
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54 #include <ti/osal/osal.h>
55 #include <ti/csl/soc.h>
56 #if defined(TimerP_numTimerDevices)
57 #undef TimerP_numTimerDevices
58 #endif
59 
60 #if defined(TIMERP_ANY_MASK)
61 #undef TIMERP_ANY_MASK
62 #endif
63 
64 #define OSAL_MPU1_0 (0U)
65 #define OSAL_MCU1_0 (1U)
66 #define OSAL_MCU1_1 (2U)
67 #define OSAL_MCU2_0 (3U)
68 #define OSAL_MCU2_1 (4U)
69 #define OSAL_MCU3_0 (5U)
70 #define OSAL_MCU3_1 (6U)
71 #define OSAL_C66_1 (7U)
72 #define OSAL_C66_2 (8U)
73 #define OSAL_C7X_1 (9U)
74 #define OSAL_INVALID_CORE_ID (10U)
75 
76 /* Number of timers restricted for use */
77 //#define MAX_RESTRICTED_TIMERS (9U)
78 
79 #define EXTERNAL_CLOCK_KHZ_DEFAULT (24000U)
80 #define PMU_CLOCK_KHZ_DEFAULT (1000000U)
81 
82 #if defined(BUILD_MCU)
83  #define OSAL_CPU_FREQ_KHZ_DEFAULT (1000000U)
84 #elif defined(_TMS320C6X)
85  #define OSAL_CPU_FREQ_KHZ_DEFAULT (1350000U)
86 #elif defined(BUILD_C7X)
87  #define OSAL_CPU_FREQ_KHZ_DEFAULT (1000000U)
88 #else
89  #define OSAL_CPU_FREQ_KHZ_DEFAULT (1000000U)
90 #endif
91 
92 
93 #if defined(TIMERP_TIMER_FREQ_LO)
94 #undef TIMERP_TIMER_FREQ_LO
95 #endif
96 
97 #if defined(TIMERP_TIMER_FREQ_HI)
98 #undef TIMERP_TIMER_FREQ_HI
99 #endif
100 
101 #define TIMERP_TIMER_FREQ_LO (19200000U)
102 #define TIMERP_TIMER_FREQ_HI (0U)
103 
104 #define TimerP_numTimerDevices ((uint32_t) 20U )
105 #if defined (BUILD_MCU)
106  #define TIMERP_ANY_MASK ((uint32_t) 0x00FF)
107  #define TIMERP_AVAILABLE_MASK ((uint32_t) 0x00FF)
108 #elif defined (BUILD_C7X)
109  #define TIMERP_ANY_MASK ((uint32_t) 0x000F)
110  #define TIMERP_AVAILABLE_MASK ((uint32_t) 0x000F)
111 #else
112  #define TIMERP_ANY_MASK ((uint32_t) 0x0FFF)
113  #define TIMERP_AVAILABLE_MASK ((uint32_t) 0x0FFF)
114 #endif
115 
116 /* using the default timer base addresses */
117 #if defined(__aarch64__)
118 #define OSAL_DELAY_TIMER_ADDR_DEFAULT (CSL_TIMER1_CFG_BASE)
119 #else
120 #define OSAL_DELAY_TIMER_ADDR_DEFAULT (CSL_MCU_TIMER1_CFG_BASE)
121 #endif
122 
123 #define TIMER_INITIAL_COUNT (0xFFF00000U)
124 #define TIMER_RLD_COUNT (0xFFF00000U)
125 
126 /* GTC count clock for A72 */
127 #define OSAL_SOC_MPU_GTC_CLK (200000U)
128 
129 /* Max number of various modules for NonOs */
130 #define OSAL_NONOS_MAX_SEMAPHOREP_PER_SOC ((uint32_t) 80U)
131 #define OSAL_NONOS_MAX_HWIP_PER_SOC ((uint32_t) 40U)
132 #define OSAL_NONOS_MAX_TIMERP_PER_SOC (TimerP_numTimerDevices)
133 
134 /* Max number of various modules for FreeRTOS */
135 #define OSAL_FREERTOS_MAX_SEMAPHOREP_PER_SOC ((uint32_t) 360U)
136 #define OSAL_FREERTOS_MAX_HWIP_PER_SOC ((uint32_t) 40U)
137 #define OSAL_FREERTOS_MAX_TIMERP_PER_SOC (TimerP_numTimerDevices)
138 #define OSAL_FREERTOS_MAX_TASKP_PER_SOC ((uint32_t) 160U)
139 #define OSAL_FREERTOS_MAX_CLOCKP_PER_SOC ((uint32_t) 20U)
140 #define OSAL_FREERTOS_MAX_MUTEXP_PER_SOC ((uint32_t) 20U)
141 #define OSAL_FREERTOS_MAX_MAILBOXP_PER_SOC ((uint32_t) 20U)
142 #define OSAL_FREERTOS_MAX_QUEUEP_PER_SOC ((uint32_t) 40U)
143 #define OSAL_FREERTOS_MAX_HEAPP_PER_SOC ((uint32_t) 20U)
144 #define OSAL_FREERTOS_MAX_EVENTP_PER_SOC ((uint32_t) 20U)
145 
146 /* Max number of various modules for SafeRTOS */
147 #define OSAL_SAFERTOS_MAX_HWIP_PER_SOC ((uint32_t) 40U)
148 #define OSAL_SAFERTOS_MAX_SEMAPHOREP_PER_SOC ((uint32_t) 360U)
149 #define OSAL_SAFERTOS_MAX_TASKP_PER_SOC ((uint32_t) 160U)
150 #define OSAL_SAFERTOS_MAX_TIMERP_PER_SOC (TimerP_numTimerDevices)
151 #define OSAL_SAFERTOS_MAX_CLOCKP_PER_SOC ((uint32_t) 20U)
152 #define OSAL_SAFERTOS_MAX_MUTEXP_PER_SOC ((uint32_t) 20U)
153 #define OSAL_SAFERTOS_MAX_MAILBOXP_PER_SOC ((uint32_t) 20U)
154 #define OSAL_SAFERTOS_MAX_EVENTP_PER_SOC ((uint32_t) 20U)
155 
156 #define OSAL_ARCH_TIMER_INST_FOR_TS (TimerP_ANY)
157 
159 /* Default DM Timer allocation for r5f cores in j721e */
160 #define OSAL_SAFERTOS_OS_TIMER_ID_MCU1_0 ( 1U ) /* MCU DM Timer 1 */
161 #define OSAL_SAFERTOS_OS_TIMER_ID_MCU1_1 ( 2U ) /* MCU DM Timer 2 */
162 #define OSAL_SAFERTOS_OS_TIMER_ID_MCU2_0 ( 0U ) /* DM Timer 12 */
163 #define OSAL_SAFERTOS_OS_TIMER_ID_MCU2_1 ( 1U ) /* DM Timer 13 */
164 #define OSAL_SAFERTOS_OS_TIMER_ID_MCU3_0 ( 2U ) /* DM Timer 14 */
165 #define OSAL_SAFERTOS_OS_TIMER_ID_MCU3_1 ( 3U ) /* DM Timer 15 */
166 #define OSAL_FREERTOS_OS_TIMER_ID_MCU1_0 ( 1U ) /* MCU DM Timer 1 */
167 #define OSAL_FREERTOS_OS_TIMER_ID_MCU1_1 ( 2U ) /* MCU DM Timer 2 */
168 #define OSAL_FREERTOS_OS_TIMER_ID_MCU2_0 ( 0U ) /* DM Timer 12 */
169 #define OSAL_FREERTOS_OS_TIMER_ID_MCU2_1 ( 1U ) /* DM Timer 13 */
170 #define OSAL_FREERTOS_OS_TIMER_ID_MCU3_0 ( 2U ) /* DM Timer 14 */
171 #define OSAL_FREERTOS_OS_TIMER_ID_MCU3_1 ( 3U ) /* DM Timer 15 */
172 
173 /* Default DM Timer allocation for c66x cores in j721e */
174 #define OSAL_SAFERTOS_OS_TIMER_ID_C66X_1 ( 0U ) /* DM Timer 0 */
175 #define OSAL_SAFERTOS_OS_TIMER_ID_C66X_2 ( 1U ) /* DM Timer 1 */
176 #define OSAL_FREERTOS_OS_TIMER_ID_C66X_1 ( 0U ) /* DM Timer 0 */
177 #define OSAL_FREERTOS_OS_TIMER_ID_C66X_2 ( 1U ) /* DM Timer 1 */
178 
179 #define OSAL_SAFERTOS_OS_TIMER_INT_NUM_C66X_1 ( 14U )
180 #define OSAL_SAFERTOS_OS_TIMER_INT_NUM_C66X_2 ( 15U )
181 #define OSAL_SAFERTOS_OS_TIMER_EVENT_ID_C66X_1 ( 21U )
182 #define OSAL_SAFERTOS_OS_TIMER_EVENT_ID_C66X_2 ( 20U )
183 
184 /* Default DM Timer allocation for c7x cores in j721e */
185 #define OSAL_SAFERTOS_OS_TIMER_ID_C7X_1 ( 2U ) /* DM Timer 2 */
186 #define OSAL_FREERTOS_OS_TIMER_ID_C7X_1 ( 2U ) /* DM Timer 2 */
187 
188 #define OSAL_SAFERTOS_OS_TIMER_INT_NUM_C7X_1 ( 16U )
189 
190 #define OSAL_SAFERTOS_OS_YEILD_INT_NUM_C7X ( 13U )
191 
192 /* external references */
194 
195 #if defined (BUILD_C7X)
196 /* The C7x CLEC should be programmed to allow config/re config either in secure
197  * OR non secure mode. This function configures all inputs to given level
198  *
199  * Instance is hard-coded for J721e only
200  *
201  */
202 void OsalCfgClecAccessCtrl (bool onlyInSecure);
203 #endif
204 
205 
206 #ifdef __cplusplus
207 }
208 #endif
209 
210 /* @} */
211 
212 #endif
213 /* nothing past this point */
OS Abstraction Layer header.
Osal hw attributes structure.
Definition: osal.h:306
Osal_HwAttrs gOsal_HwAttrs