MCUSW
Loading...
Searching...
No Matches
Mcu.h
Go to the documentation of this file.
1/*
2*
3* Copyright (c) 2024 Texas Instruments Incorporated
4*
5* All rights reserved not granted herein.
6*
7* Limited License.
8*
9* Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive
10* license under copyrights and patents it now or hereafter owns or controls to make,
11* have made, use, import, offer to sell and sell ("Utilize") this software subject to the
12* terms herein. With respect to the foregoing patent license, such license is granted
13* solely to the extent that any such patent is necessary to Utilize the software alone.
14* The patent license shall not apply to any combinations which include this software,
15* other than combinations with devices manufactured by or for TI ("TI Devices").
16* No hardware patent is licensed hereunder.
17*
18* Redistributions must preserve existing copyright notices and reproduce this license
19* (including the above copyright notice and the disclaimer and (if applicable) source
20* code license limitations below) in the documentation and/or other materials provided
21* with the distribution
22*
23* Redistribution and use in binary form, without modification, are permitted provided
24* that the following conditions are met:
25*
26* * No reverse engineering, decompilation, or disassembly of this software is
27* permitted with respect to any software provided in binary form.
28*
29* * any redistribution and use are licensed by TI for use only with TI Devices.
30*
31* * Nothing shall obligate TI to provide you with source code for the software
32* licensed and provided to you in object code.
33*
34* If software source code is provided to you, modification and redistribution of the
35* source code are permitted provided that the following conditions are met:
36*
37* * any redistribution and use of the source code, including any resulting derivative
38* works, are licensed by TI for use only with TI Devices.
39*
40* * any redistribution and use of any object code compiled from the source code
41* and any resulting derivative works, are licensed by TI for use only with TI Devices.
42*
43* Neither the name of Texas Instruments Incorporated nor the names of its suppliers
44*
45* may be used to endorse or promote products derived from this software without
46* specific prior written permission.
47*
48* DISCLAIMER.
49*
50* THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS
51* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
52* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
53* IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT,
54* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
55* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
56* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
57* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
58* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
59* OF THE POSSIBILITY OF SUCH DAMAGE.
60*
61*/
62
77#ifndef MCU_H_
78#define MCU_H_
79
80/* ========================================================================== */
81/* Include Files */
82/* ========================================================================== */
83
84#include "Std_Types.h"
85#include "Mcu_Cfg.h"
86
87
88#ifdef __cplusplus
89extern "C"
90{
91#endif
92
93/* ========================================================================== */
94/* Macros & Typedefs */
95/* ========================================================================== */
96
97#define ARRAYSIZE(array) ((sizeof (array) / \
98 sizeof ((array)[0])))
99
100
108#define MCU_SW_MAJOR_VERSION (10U)
110#define MCU_SW_MINOR_VERSION (1U)
112#define MCU_SW_PATCH_VERSION (3U)
113/* @} */
114
122#define MCU_AR_RELEASE_MAJOR_VERSION (4U)
124#define MCU_AR_RELEASE_MINOR_VERSION (3U)
126#define MCU_AR_RELEASE_REVISION_VERSION (1U)
127/* @} */
128
134#define MCU_VENDOR_ID ((uint16) 44U)
136#define MCU_MODULE_ID ((uint16) 101U)
138#define MCU_INSTANCE_ID ((uint8) 0U)
139/* @} */
140
148 /*
149 * Design: MCAL-8507,MCAL-8489
150 */
151 #ifndef MCU_E_PARAM_CONFIG
153 #define MCU_E_PARAM_CONFIG (0x0AU)
154 #endif
155
156
157 /*
158 * Design: MCAL-8507
159 */
160
161#ifndef MCU_E_PARAM_CLOCK
163#define MCU_E_PARAM_CLOCK (0x0BU)
164#endif
165
166/*
167 * Design: MCAL-8507
168 */
169#ifndef MCU_E_PARAM_MODE
171#define MCU_E_PARAM_MODE (0x0CU)
172#endif
173
174/*
175 * Design: MCAL-8507
176 */
177#ifndef MCU_E_PARAM_RAMSECTION
179#define MCU_E_PARAM_RAMSECTION (0x0DU)
180#endif
181
182/*
183 * Design: MCAL-8507
184 */
185#ifndef MCU_E_PLL_NOT_LOCKED
187#define MCU_E_PLL_NOT_LOCKED (0x0EU)
188#endif
189
190/*
191 * Design: MCAL-8507
192 */
193#ifndef MCU_E_UNINIT
195#define MCU_E_UNINIT (0x0FU)
196#endif
197
198/*
199 * Design: MCAL-8507
200 */
201#ifndef MCU_E_PARAM_POINTER
203#define MCU_E_PARAM_POINTER (0x10U)
204#endif
205
206/*
207 * Design: MCAL-8507
208 */
209#ifndef MCU_E_INIT_FAILED
211#define MCU_E_INIT_FAILED (0x11U)
212#endif
213
220 /*
221 * Design: MCAL-8507
222 */
224#define MCU_STATUS_UNINIT ((uint8)(0U))
226#define MCU_STATUS_INIT ((uint8)(1U))
227
237#define MCU_SID_INIT (0x00U)
239#define MCU_SID_INIT_RAM_SECTION (0x01U)
241#define MCU_SID_INIT_CLOCK (0x02U)
243#define MCU_SID_DISTRIBUTE_PLL_CLOCK (0x03U)
245#define MCU_SID_GET_PLL_STATUS (0x04U)
247#define MCU_SID_GET_RESET_REASON (0x05U)
249#define MCU_SID_GET_RESET_RAW_VALUE (0x06U)
251#define MCU_SID_PERFORM_RESET (0x07U)
253#define MCU_SID_SETMODE (0x08U)
255#define MCU_SID_GET_VERSION_INFO (0x09U)
257#define MCU_SID_GET_RAM_STATE (0x0AU)
258/* @} */
259
260#if defined (SOC_J721E) || defined (SOC_J7200) || defined (SOC_J721S2) || defined (SOC_J784S4) || defined (SOC_J742S2)
268#define MCU_PERFORM_RESET_MODE_COLD ((uint8) 0U)
269#endif
271#define MCU_PERFORM_RESET_MODE_WARM ((uint8) 1U)
272/* @} */
273#define MCU_E_MODE_FAILURE 0U
274
275
276
277
278/*
279 * Design: MCAL-8487,MCAL-8492
280 */
285typedef uint8 Mcu_ClockType;
286
287/*
288 * Design: MCAL-8491,MCAL-8471
289 */
294typedef uint32 Mcu_RawResetType;
295
296/*
297 * Design: MCAL-8406,MCAL-8421
298 */
303typedef uint8 Mcu_RamSectionType;
304
305/*
306 * Design: MCAL-8490,MCAL-8418
307 */
312typedef uint8 Mcu_ModeType;
313
314/* ========================================================================== */
315/* Structures and Enums */
316/* ========================================================================== */
317
318/*
319 * Design: MCAL-8438
320 */
339
340
341
345typedef P2CONST (Mcu_ClockConfigType, AUTOMATIC, MCU_PBCFG)
347
348/*
349* Design: MCAL-8439,MCAL-8424,MCAL-8405,MCAL-8438,MCAL-8457
350*/
355 typedef struct Mcu_ConfigType_s
356 {
366#if defined (SOC_J721E) || defined (SOC_J7200) || defined (SOC_J721S2) || defined (SOC_J784S4) || defined (SOC_J742S2)
368 Mcu_SoftResetCBKFunctionPtrType Mcu_SoftReset_CBK_Function;
369#endif
372
373
375extern const struct Mcu_ConfigType_s McuModuleConfiguration_0;
376
377
378
379
380/* @} */
381
382/* ========================================================================== */
383/* Function Declarations */
384/* ========================================================================== */
385
402FUNC(void, MCU_CODE) Mcu_Init(
403 P2CONST(Mcu_ConfigType, AUTOMATIC, MCU_PBCFG) CfgPtr);
404
405
406#if (STD_ON == MCU_INIT_CLOCK_API)
427FUNC(Std_ReturnType, MCU_CODE) Mcu_InitClock(Mcu_ClockType ClockSetting);
428#endif /* MCU_INIT_CLOCK_API */
429
447#if(STD_OFF == MCU_NO_PLL)
448FUNC(Std_ReturnType, MCU_CODE) Mcu_DistributePllClock(void);
449
450#endif /* STD_OFF == MCU_NO_PLL */
451
452#if (STD_ON == MCU_PERFORM_RESET_API)
469FUNC(void, MCU_CODE) Mcu_PerformReset(void);
470
471#endif /* MCU_PERFORM_RESET_API */
472
473#if (STD_ON == MCU_INIT_RAM_API)
495FUNC(Std_ReturnType, MCU_CODE) Mcu_InitRamSection(
496 Mcu_RamSectionType RamSection);
497#endif /* MCU_INIT_RAM_API */
498
499
500/* Design: MCAL-8391 */
501
502/* This is a Dummy API */
503
521
539FUNC(Mcu_ResetType, MCU_CODE) Mcu_GetResetReason(void);
540
560
561#if defined (SOC_J721E) || defined (SOC_J7200) || defined (SOC_J721S2) || defined (SOC_J784S4) || defined (SOC_J742S2)
579FUNC(void, MCU_CODE) Mcu_ClearResetReason(void);
580#endif
581
582#if (STD_ON == MCU_GET_RAM_STATE_API)
583
584/* This is a Dummy API
585*/
604FUNC(Mcu_RamStateType, MCU_CODE) Mcu_GetRamState(void);
605#endif /* MCU_GET_RAM_STATE_API */
606
607#if (STD_ON == MCU_GET_VERSION_INFO_API)
631FUNC(void, MCU_CODE) Mcu_GetVersionInfo(
632 P2VAR(Std_VersionInfoType, AUTOMATIC, MCU_APPL_DATA) versioninfo);
633#endif /* MCU_GET_VERSION_INFO_API */
634
635
636
654 FUNC(void, MCU_CODE) Mcu_SetMode(Mcu_ModeType McuMode);
655
656
657
658#ifdef __cplusplus
659}
660#endif
661
662#endif /* #ifndef MCU_H_ */
663
664/* @} */
This file contains generated pre compile configuration file for MCU MCAL driver.
void Mcu_GetVersionInfo(Std_VersionInfoType *versioninfo)
This service returns the version information of this module.
uint8 Mcu_RamSectionType
This type specifies the identification (ID) for a RAM section used in Mcu_InitRamSection()
Definition Mcu.h:303
Mcu_CBKFunctionPtrType Mcu_CBK_Function
Definition Mcu.h:365
uint8 Mcu_ResetMode
Definition Mcu.h:359
Std_ReturnType Mcu_InitClock(Mcu_ClockType ClockSetting)
This service initializes the PLL and other MCU specific clock options.
Mcu_ModuleName ModuleName
Definition Mcu.h:330
void Mcu_Init(const Mcu_ConfigType *CfgPtr)
This service initializes the MCU driver.
Mcu_ClkSourceIdType Mcu_ClockSourceId
Definition Mcu.h:328
Std_ReturnType Mcu_InitRamSection(Mcu_RamSectionType RamSection)
This service initializes the RAM section wise.
Mcu_ResetType Mcu_GetResetReason(void)
The service reads the reset type from the hardware, if supported.
uint32 Mcu_RawResetType
This type specifies the identification (ID) for a RAW MCU reset status returned by Mcu_GetResetRawVal...
Definition Mcu.h:294
Mcu_RamStateType Mcu_GetRamState(void)
This service provides the actual status of the microcontroller Ram. (if supported)
Mcu_RawResetType Mcu_GetResetRawValue(void)
The service reads the reset type from the hardware register, if supported.
Mcu_ModeType Mcu_Mode
Definition Mcu.h:357
uint8 Mcu_ClockType
This type specifies the identification (ID) for a ClockType status used by Mcu_InitClock()
Definition Mcu.h:285
void Mcu_SetMode(Mcu_ModeType McuMode)
This service activates the MCU power modes.
Mcu_ClkModuleIdType Mcu_ClockModuleId
Definition Mcu.h:326
uint8 Mcu_ModeType
This type specifies the identification (ID) for a MCU mode used in Mcu_SetMode()
Definition Mcu.h:312
const struct Mcu_ConfigType_s McuModuleConfiguration_0
MCU Configuration struct declaration.
Std_ReturnType Mcu_DistributePllClock(void)
This service activates the PLL clock to the MCU clock distribution.
boolean Mcu_InitCfg
Definition Mcu.h:334
Mcu_ClockConfigPtrType Mcu_ClockConfig
Definition Mcu.h:361
uint64 Mcu_ClockFrequency
Definition Mcu.h:336
Mcu_DomainType Domain
Definition Mcu.h:332
void Mcu_PerformReset(void)
The service performs a microcontroller reset.
uint8 Mcu_NumberOfClockConfig
Definition Mcu.h:363
Mcu_PllStatusType Mcu_GetPllStatus(void)
This service provides the lock status of the PLL.
Mcu_RamStateType
Enumeration of ranstate queried by Mcu_GetRamState()
Definition Mcu_Cfg.h:461
Mcu_ModuleName
Definition Mcu_Cfg.h:310
Mcu_PllStatusType
This is a status value returned by the function Mcu_GetPllStatus() of the MCU module.
Definition Mcu_Cfg.h:414
Mcu_ClkSourceIdType
This is the type of the clock source in clock tree that is selectable for peripheral....
Definition Mcu_Cfg.h:395
Mcu_DomainType
Definition Mcu_Cfg.h:299
Std_ReturnType(* Mcu_CBKFunctionPtrType)(uint32 moduleId, uint32 clkId, uint64 ParentId)
Pointer to Callback function.
Definition Mcu_Cfg.h:496
Mcu_ClkModuleIdType
Clock source config modules id enum.
Definition Mcu_Cfg.h:343
Mcu_ResetType
This is the type of the reset enumerator containing the subset of reset types. It is not required t...
Definition Mcu_Cfg.h:284
Structure for module clock setting.
Definition Mcu.h:325
MCU CONFIG ROOT structure.
Definition Mcu.h:356