SDL API Guide for J721E
sdl_dcc.h
Go to the documentation of this file.
1 /*
2  * @file dl_dcc.h
3  *
4  * @brief This file contains the prototypes of the APIs present in the
5  * device abstraction layer file of DCC.
6  * This also contains some related macros.
7  * Copyright (c) Texas Instruments Incorporated 2021-2025
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  *
16  * Redistributions in binary form must reproduce the above copyright
17  * notice, this list of conditions and the following disclaimer in the
18  * documentation and/or other materials provided with the
19  * distribution.
20  *
21  * Neither the name of Texas Instruments Incorporated nor the names of
22  * its contributors may be used to endorse or promote products derived
23  * from this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  *
37  */
45 #ifndef SDL_DCC_H_
46 #define SDL_DCC_H_
47 
48 
49 
50 /* ========================================================================== */
51 /* Include Files */
52 /* ========================================================================== */
53 
54 #include <sdl_types.h>
55 #include <tistdtypes.h>
56 #include <stdint.h>
57 #include <stdbool.h>
58 #include <src/sdl/hw_types.h>
59 
60 #if defined (SOC_J721E)
62 #include <include/soc/j721e/sdlr_soc_baseaddress.h>
63 #endif /* SOC_J721E */
64 
65 #if defined (SOC_J7200)
66 #include <src/sdl/dcc/soc/j7200/sdl_soc_dcc.h>
67 #include <include/soc/j7200/sdlr_soc_baseaddress.h>
68 #endif /* SOC_J7200 */
69 
70 #if defined (SOC_J721S2)
71 #include <src/sdl/dcc/soc/j721s2/sdl_soc_dcc.h>
72 #include <include/soc/j721s2/sdlr_soc_baseaddress.h>
73 #endif /* SOC_J721S2 */
74 
75 #if defined (SOC_J784S4)
76 #include <src/sdl/dcc/soc/j784s4/sdl_soc_dcc.h>
77 #include <include/soc/j784s4/sdlr_soc_baseaddress.h>
78 #endif /* SOC_J784S4 */
79 
80 #ifdef __cplusplus
81 extern "C" {
82 #endif
83 
104 /* ========================================================================== */
105 /* Macros & Typedefs */
106 /* ========================================================================== */
107 
117 #define DCC_SRC0_COUNT_MAX (0xFFFFFU)
118 
121 #define DCC_SRC0_VALID_MAX (0x0FFFFU)
122 
125 #define DCC_SRC1_COUNT_MAX (0xFFFFFU)
126 
127 #define MIN_CLK0_VLD_SEED (4u)
128 
144 
150 typedef uint32_t SDL_DCC_mode;
151 
152 #define SDL_DCC_MODE_SINGLE_SHOT_1 (DCC_DCCGCTRL_SINGLESHOT_MODE1)
153 
154 #define SDL_DCC_MODE_SINGLE_SHOT_2 (DCC_DCCGCTRL_SINGLESHOT_MODE2)
155 
156 #define SDL_DCC_MODE_CONTINUOUS (DCC_DCCGCTRL_SINGLESHOT_DISABLE)
157 
158 
164 
168 typedef uint32_t SDL_DCC_clkSrc0;
169 
170 #define SDL_DCC_CLK0_SRC_CLOCK0_0 (DCC_DCCCLKSRC0_CLKSRC0_0)
171 
172 #define SDL_DCC_CLK0_SRC_CLOCK0_1 (DCC_DCCCLKSRC0_CLKSRC0_1)
173 
174 #define SDL_DCC_CLK0_SRC_CLOCK0_2 (DCC_DCCCLKSRC0_CLKSRC0_2)
175 
176 
182 
186 typedef uint32_t SDL_DCC_clkSrc1;
187 #define SDL_DCC_CLK1_SRC_CLOCK1 (DCC_DCCCLKSRC1_CLKSRC_0)
188 
189 #define SDL_DCC_CLK1_SRC_CLOCKSRC0 (DCC_DCCCLKSRC1_CLKSRC_1)
190 
191 #define SDL_DCC_CLK1_SRC_CLOCKSRC1 (DCC_DCCCLKSRC1_CLKSRC_2)
192 
193 #define SDL_DCC_CLK1_SRC_CLOCKSRC2 (DCC_DCCCLKSRC1_CLKSRC_3)
194 
195 #define SDL_DCC_CLK1_SRC_CLOCKSRC3 (DCC_DCCCLKSRC1_CLKSRC_4)
196 
197 #define SDL_DCC_CLK1_SRC_CLOCKSRC4 (DCC_DCCCLKSRC1_CLKSRC_5)
198 
199 #define SDL_DCC_CLK1_SRC_CLOCKSRC5 (DCC_DCCCLKSRC1_CLKSRC_6)
200 
201 #define SDL_DCC_CLK1_SRC_CLOCKSRC6 (DCC_DCCCLKSRC1_CLKSRC_7)
202 
203 #define SDL_DCC_CLK1_SRC_CLOCKSRC7 (DCC_DCCCLKSRC1_CLKSRC_8)
204 
205 #define SDL_DCC_CLK1_SRC_FICLK (DCC_DCCCLKSRC1_CLKSRC_OTHER)
206 
207 
213 
218 typedef uint32_t SDL_DCC_intrType;
219 
220 #define SDL_DCC_INTERRUPT_ERR (0x0U)
221 
222 #define SDL_DCC_INTERRUPT_DONE (0x1U)
223 
224 
228 /* ========================================================================== */
229 /* Structures */
230 /* ========================================================================== */
231 
232 
241 typedef struct SDL_DCC_config_st
242 {
251  uint32_t clk1Src;
255  uint32_t clk0Seed;
257  uint32_t clk0ValidSeed;
259  uint32_t clk1Seed;
262 
263 
264 typedef struct SDL_DCC_status_st
265 {
266  bool doneIntr;
267  /* Indicates if a done interrupt is currently pending */
268  bool errIntr;
269  /* Indicates if an error interrupt is currently pending */
271  /* DCC config structure */
272  uint32_t clk0Cnt;
273  /* Current COUNT0 value of clock source 0 */
274  uint32_t clk0Valid;
275  /* Current VALID0 value */
276  uint32_t clk1Cnt;
277  /* Current COUNT1 value of clock source 1 */
279 
280 
281 typedef struct SDL_DCC_staticRegs_st
282 {
283  uint32_t DCC_REV;
284  /* DCC revision register */
285  uint32_t DCC_CNTSEED0;
286  /* COUNT0 SEED register */
287  uint32_t DCC_VALIDSEED0;
288  /* VALID0 SEED register */
289  uint32_t DCC_CNTSEED1;
290  /* COUNT1 SEED register */
291  uint32_t DCC_CLKSRC1;
292  /* CLOCK SOURCE1 register */
293  uint32_t DCC_CLKSRC0;
294  /* CLOCK SOURCE0 register */
296 
300 /* ========================================================================== */
301 /* Global Variables */
302 /* ========================================================================== */
303 
304 /* None */
305 
306 /* ========================================================================== */
307 /* Function Declarations */
308 /* ========================================================================== */
309 
326 int32_t SDL_DCC_configure(SDL_DCC_Inst instance, const SDL_DCC_config *pConfig);
327 
335 int32_t SDL_DCC_verifyConfig(SDL_DCC_Inst instance, const SDL_DCC_config *pConfig);
341 int32_t SDL_DCC_enable(SDL_DCC_Inst instance);
347 int32_t SDL_DCC_disable(SDL_DCC_Inst instance);
355 int32_t SDL_DCC_getStatus(SDL_DCC_Inst instance, SDL_DCC_status *pStatus);
363 int32_t SDL_DCC_enableIntr(SDL_DCC_Inst instance, SDL_DCC_intrType intr);
371 int32_t SDL_DCC_clearIntr(SDL_DCC_Inst instance, SDL_DCC_intrType intr);
379 int32_t SDL_DCC_getStaticRegs(SDL_DCC_Inst instance, SDL_DCC_staticRegs *pStaticRegs);
380 
385 /****************************************************************************************************
386 * Register Definitions
387 ****************************************************************************************************/
388 
389 #define DCC_DCCGCTRL (0x0U)
390 #define DCC_DCCREV (0x4U)
391 #define DCC_DCCCNTSEED0 (0x8U)
392 #define DCC_DCCVALIDSEED0 (0xcU)
393 #define DCC_DCCCNTSEED1 (0x10U)
394 #define DCC_DCCSTAT (0x14U)
395 #define DCC_DCCCNT0 (0x18U)
396 #define DCC_DCCVALID0 (0x1cU)
397 #define DCC_DCCCNT1 (0x20U)
398 #define DCC_DCCCLKSRC1 (0x24U)
399 #define DCC_DCCCLKSRC0 (0x28U)
400 
401 /****************************************************************************************************
402 * Field Definition Macros
403 ****************************************************************************************************/
404 
405 #define DCC_DCCGCTRL_DCCENA_SHIFT (0U)
406 #define DCC_DCCGCTRL_DCCENA_MASK (0x0000000fU)
407 #define DCC_DCCGCTRL_DCCENA_ENABLE (0xFU)
408 #define DCC_DCCGCTRL_DCCENA_DISABLE (0x5U)
409 
410 #define DCC_DCCGCTRL_ERRENA_SHIFT (4U)
411 #define DCC_DCCGCTRL_ERRENA_MASK (0x000000f0U)
412 #define DCC_DCCGCTRL_ERRENA_ENABLE (0xFU)
413 #define DCC_DCCGCTRL_ERRENA_DISABLE (0x5U)
414 
415 #define DCC_DCCGCTRL_SINGLESHOT_SHIFT (8U)
416 #define DCC_DCCGCTRL_SINGLESHOT_MASK (0x00000f00U)
417 #define DCC_DCCGCTRL_SINGLESHOT_MODE1 (0xAU)
418 #define DCC_DCCGCTRL_SINGLESHOT_MODE2 (0xBU)
419 #define DCC_DCCGCTRL_SINGLESHOT_DISABLE (0x0U)
420 
421 #define DCC_DCCGCTRL_DONEENA_SHIFT (12U)
422 #define DCC_DCCGCTRL_DONEENA_MASK (0x0000f000U)
423 #define DCC_DCCGCTRL_DONEENA_ENABLE (0xFU)
424 #define DCC_DCCGCTRL_DONEENA_DISABLE (0x5U)
425 
426 #define DCC_DCCGCTRL_RES_SHIFT (16U)
427 #define DCC_DCCGCTRL_RES_MASK (0xffff0000U)
428 
429 #define DCC_DCCREV_MINOR_SHIFT (0U)
430 #define DCC_DCCREV_MINOR_MASK (0x0000003fU)
431 
432 #define DCC_DCCREV_CUSTOM_SHIFT (6U)
433 #define DCC_DCCREV_CUSTOM_MASK (0x000000c0U)
434 
435 #define DCC_DCCREV_MAJOR_SHIFT (8U)
436 #define DCC_DCCREV_MAJOR_MASK (0x00000700U)
437 
438 #define DCC_DCCREV_RTL_SHIFT (11U)
439 #define DCC_DCCREV_RTL_MASK (0x0000f800U)
440 
441 #define DCC_DCCREV_FUNC_SHIFT (16U)
442 #define DCC_DCCREV_FUNC_MASK (0x0fff0000U)
443 
444 #define DCC_DCCREV_RES_SHIFT (28U)
445 #define DCC_DCCREV_RES_MASK (0x30000000U)
446 
447 #define DCC_DCCREV_SCHEME_SHIFT (30U)
448 #define DCC_DCCREV_SCHEME_MASK (0xc0000000U)
449 
450 #define DCC_DCCCNTSEED0_COUNTSEED0_SHIFT (0U)
451 #define DCC_DCCCNTSEED0_COUNTSEED0_MASK (0x000fffffU)
452 
453 #define DCC_DCCCNTSEED0_RES_SHIFT (20U)
454 #define DCC_DCCCNTSEED0_RES_MASK (0xfff00000U)
455 
456 #define DCC_DCCVALIDSEED0_VALIDSEED0_SHIFT (0U)
457 #define DCC_DCCVALIDSEED0_VALIDSEED0_MASK (0x0000ffffU)
458 
459 #define DCC_DCCVALIDSEED0_RES_SHIFT (16U)
460 #define DCC_DCCVALIDSEED0_RES_MASK (0xffff0000U)
461 
462 #define DCC_DCCCNTSEED1_COUNTSEED1_SHIFT (0U)
463 #define DCC_DCCCNTSEED1_COUNTSEED1_MASK (0x000fffffU)
464 
465 #define DCC_DCCCNTSEED1_RES_SHIFT (20U)
466 #define DCC_DCCCNTSEED1_RES_MASK (0xfff00000U)
467 
468 #define DCC_DCCSTAT_ERRFLG_SHIFT (0U)
469 #define DCC_DCCSTAT_ERRFLG_MASK (0x00000001U)
470 
471 #define DCC_DCCSTAT_DONEFLG_SHIFT (1U)
472 #define DCC_DCCSTAT_DONEFLG_MASK (0x00000002U)
473 
474 #define DCC_DCCSTAT_RES_SHIFT (2U)
475 #define DCC_DCCSTAT_RES_MASK (0xfffffffcU)
476 
477 #define DCC_DCCCNT0_COUNT0_SHIFT (0U)
478 #define DCC_DCCCNT0_COUNT0_MASK (0x000fffffU)
479 
480 #define DCC_DCCCNT0_RES_SHIFT (20U)
481 #define DCC_DCCCNT0_RES_MASK (0xfff00000U)
482 
483 #define DCC_DCCVALID0_VALID0_SHIFT (0U)
484 #define DCC_DCCVALID0_VALID0_MASK (0x0000ffffU)
485 
486 #define DCC_DCCVALID0_RES_SHIFT (16U)
487 #define DCC_DCCVALID0_RES_MASK (0xffff0000U)
488 
489 #define DCC_DCCCNT1_COUNT1_SHIFT (0U)
490 #define DCC_DCCCNT1_COUNT1_MASK (0x000fffffU)
491 
492 #define DCC_DCCCNT1_RES_SHIFT (20U)
493 #define DCC_DCCCNT1_RES_MASK (0xfff00000U)
494 
495 #define DCC_DCCCLKSRC1_CLKSRC_SHIFT (0U)
496 #define DCC_DCCCLKSRC1_CLKSRC_MASK (0x0000000fU)
497 #define DCC_DCCCLKSRC1_CLKSRC_0 (0x0U)
498 #define DCC_DCCCLKSRC1_CLKSRC_1 (0x1U)
499 #define DCC_DCCCLKSRC1_CLKSRC_2 (0x2U)
500 #define DCC_DCCCLKSRC1_CLKSRC_3 (0x3U)
501 #define DCC_DCCCLKSRC1_CLKSRC_4 (0x4U)
502 #define DCC_DCCCLKSRC1_CLKSRC_5 (0x5U)
503 #define DCC_DCCCLKSRC1_CLKSRC_6 (0x6U)
504 #define DCC_DCCCLKSRC1_CLKSRC_7 (0x7U)
505 #define DCC_DCCCLKSRC1_CLKSRC_8 (0x8U)
506 #define DCC_DCCCLKSRC1_CLKSRC_OTHER (0xFU)
507 
508 #define DCC_DCCCLKSRC1_RES1_SHIFT (4U)
509 #define DCC_DCCCLKSRC1_RES1_MASK (0x00000ff0U)
510 
511 #define DCC_DCCCLKSRC1_KEY_SHIFT (12U)
512 #define DCC_DCCCLKSRC1_KEY_MASK (0x0000f000U)
513 #define DCC_DCCCLKSRC1_KEY_ENABLE (0xAU)
514 #define DCC_DCCCLKSRC1_KEY_DISABLE (0x0U)
515 
516 #define DCC_DCCCLKSRC1_RES0_SHIFT (16U)
517 #define DCC_DCCCLKSRC1_RES0_MASK (0xffff0000U)
518 
519 #define DCC_DCCCLKSRC0_CLKSRC0_SHIFT (0U)
520 #define DCC_DCCCLKSRC0_CLKSRC0_MASK (0x0000000fU)
521 #define DCC_DCCCLKSRC0_CLKSRC0_0 (0x0U)
522 #define DCC_DCCCLKSRC0_CLKSRC0_1 (0x1U)
523 #define DCC_DCCCLKSRC0_CLKSRC0_2 (0x2U)
524 
525 #define DCC_DCCCLKSRC0_RES1_SHIFT (4U)
526 #define DCC_DCCCLKSRC0_RES1_MASK (0x00000ff0U)
527 
528 #define DCC_DCCCLKSRC0_KEY_SHIFT (12U)
529 #define DCC_DCCCLKSRC0_KEY_MASK (0x0000f000U)
530 #define DCC_DCCCLKSRC0_KEY_ENABLE (0xAU)
531 #define DCC_DCCCLKSRC0_KEY_DISABLE (0x0U)
532 
533 #define DCC_DCCCLKSRC0_RES0_SHIFT (16U)
534 #define DCC_DCCCLKSRC0_RES0_MASK (0xffff0000U)
535 
536 #ifdef __cplusplus
537 }
538 
539 #endif /*extern "C" */
540 
541 #endif
uint32_t DCC_CLKSRC1
Definition: sdl_dcc.h:291
uint32_t clk0Cnt
Definition: sdl_dcc.h:272
SDL_DCC_config config
Definition: sdl_dcc.h:270
SDL_DCC_Inst
Definition: sdl_soc_dcc.h:72
uint32_t DCC_CNTSEED0
Definition: sdl_dcc.h:285
uint32_t SDL_DCC_mode
Enum to select the DCC Operation Mode.
Definition: sdl_dcc.h:150
Definition: sdl_dcc.h:264
uint32_t SDL_DCC_clkSrc1
Enum to select the COUNT1 clock source.
Definition: sdl_dcc.h:186
uint32_t clk0Valid
Definition: sdl_dcc.h:274
int32_t SDL_DCC_getStaticRegs(SDL_DCC_Inst instance, SDL_DCC_staticRegs *pStaticRegs)
This API is used to get the value of static registers for DCC module.
uint32_t DCC_CNTSEED1
Definition: sdl_dcc.h:289
int32_t SDL_DCC_verifyConfig(SDL_DCC_Inst instance, const SDL_DCC_config *pConfig)
This API is used to verify the configuration for DCC module.
Definition: sdl_dcc.h:281
uint32_t DCC_CLKSRC0
Definition: sdl_dcc.h:293
int32_t SDL_DCC_clearIntr(SDL_DCC_Inst instance, SDL_DCC_intrType intr)
This API is used to clear the interrupts.
SDL_DCC_mode mode
Definition: sdl_dcc.h:243
uint32_t SDL_DCC_intrType
Enum for DCC interrupts.
Definition: sdl_dcc.h:218
bool errIntr
Definition: sdl_dcc.h:268
SDL_DCC_clkSrc0 clk0Src
Definition: sdl_dcc.h:247
int32_t SDL_DCC_disable(SDL_DCC_Inst instance)
This API is used to disable the DCC module.
uint32_t clk1Src
Definition: sdl_dcc.h:251
int32_t SDL_DCC_getStatus(SDL_DCC_Inst instance, SDL_DCC_status *pStatus)
This API is used to get the stauts of DCC module.
uint32_t clk1Cnt
Definition: sdl_dcc.h:276
Structure containing parameters for DCC module configuration.
Definition: sdl_dcc.h:241
uint32_t DCC_VALIDSEED0
Definition: sdl_dcc.h:287
uint32_t DCC_REV
Definition: sdl_dcc.h:283
uint32_t clk0Seed
Definition: sdl_dcc.h:255
uint32_t clk0ValidSeed
Definition: sdl_dcc.h:257
uint32_t clk1Seed
Definition: sdl_dcc.h:259
int32_t SDL_DCC_enableIntr(SDL_DCC_Inst instance, SDL_DCC_intrType intr)
This API is used to Enable the interrupts.
bool doneIntr
Definition: sdl_dcc.h:266
int32_t SDL_DCC_configure(SDL_DCC_Inst instance, const SDL_DCC_config *pConfig)
This API is used to configure DCC module.
uint32_t SDL_DCC_clkSrc0
Enum to select the COUNT0 clock source.
Definition: sdl_dcc.h:168
int32_t SDL_DCC_enable(SDL_DCC_Inst instance)
This API is used to enable the DCC module.