Infineon MOTIX™ MCU TLE987x Device Family SDK
pmu.h
Go to the documentation of this file.
1 /*
2  ***********************************************************************************************************************
3  *
4  * Copyright (c) Infineon Technologies AG
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the
8  * following conditions are met:
9  *
10  * Redistributions of source code must retain the above copyright notice, this list of conditions and the following
11  * disclaimer.
12  *
13  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
14  * following disclaimer in the documentation and/or other materials provided with the distribution.
15  *
16  * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote
17  * products derived from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
20  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24  * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
25  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  **********************************************************************************************************************/
37 /*******************************************************************************
38 ** Author(s) Identity **
39 ********************************************************************************
40 ** Initials Name **
41 ** ---------------------------------------------------------------------------**
42 ** DM Daniel Mysliwitz **
43 ** BG Blandine Guillot **
44 ** JO Julia Ott **
45 *******************************************************************************/
46 
47 /*******************************************************************************
48 ** Revision Control History **
49 ********************************************************************************
50 ** V0.1.0: 2014-05-12, DM: Initial version **
51 ** V0.1.1: 2015-02-10, DM: Individual header file added **
52 ** V0.1.2: 2017-07-06, DM: PMU_VDDEXT_On() function updated to satisfy **
53 ** the EPN for BE-Step **
54 ** V0.1.3: 2017-07-20, DM: PMU_VDDEXT_On() workaround reworked to work **
55 ** for fSYS=40MHz as well **
56 ** V0.1.4: 2017-10-10, DM: MISRA 2012 compliance, the following PC-Lint **
57 ** rules are globally deactivated: **
58 ** - Info 793: ANSI/ISO limit of 6 'significant **
59 ** characters in an external identifier **
60 ** - Info 835: A zero has been given as right **
61 ** argument to operator **
62 ** - Info 845: The left argument to operator '&' **
63 ** is certain to be 0 **
64 ** Replaced macros by INLINE functions **
65 ** Replaced register accesses within functions by **
66 ** function calls **
67 ** Replaced __STATIC_INLINE by INLINE **
68 ** V0.1.5: 2018-03-20, DM: PMU_VDDEXT_On() return value handling modified **
69 ** to meet MISRA 2012 **
70 ** V0.1.6: 2018-07-06, BG: PMU_Clear_Reset_Status(), PMU_VDDEXT_Off(), **
71 ** PMU_Get_Reset_Status, PMU_VDDEXT_Error_Clear(u8),**
72 ** PMU_VDDEXT_Set(uint8) rewritten **
73 ** V0.1.7: 2018-10-16, JO: PMU_VDDEXT_Error_Clear renamed to **
74 ** PMU_VDDEXT_Short_Clr, parameter removed **
75 ** Corrected mask in PMU_Get_Reset_Status and **
76 ** PMU_Set_Reset_Status **
77 ** Field_Mod8 instead of Field_Wrt8 in **
78 ** PMU_VDDEXT_On BF-step **
79 ** V0.1.8: 2018-11-27, JO: Doxygen update **
80 ** Moved revision history from pmu.c to pmu.h **
81 ** V0.1.9: 2020-04-15, BG: Updated revision history format **
82 ** V0.2.0: 2020-07-21, BG: EP-439: Formatted .h/.c files **
83 ** V0.2.1: 2022-02-25, JO: EP-1040: Corrected usage of CMSIS_Irq_Dis() **
84 ** V0.2.2: 2022-02-28, JO: EP-936: Updated copyright and branding **
85 *******************************************************************************/
86 
87 #ifndef PMU_H
88 #define PMU_H
89 
90 /*******************************************************************************
91 ** Includes **
92 *******************************************************************************/
93 #include "tle987x.h"
94 #include "types.h"
95 #include "sfr_access.h"
96 
97 /*******************************************************************************
98 ** Global Macro Definitions **
99 *******************************************************************************/
101 #define PMU_RESET_STS_POR (0x80u)
103 #define PMU_RESET_STS_PIN (0x40u)
105 #define PMU_RESET_STS_WDT1 (0x20u)
107 #define PMU_RESET_STS_ClkWDT (0x10u)
109 #define PMU_RESET_STS_LPR (0x08u)
111 #define PMU_RESET_STS_SLEEP (0x04u)
113 #define PMU_RESET_STS_WAKE (0x02u)
115 #define PMU_RESET_STS_SYS_FAIL (0x01u)
116 
118 #define PMU_VDDEXT_STABLE (0x80u)
120 #define PMU_VDDEXT_OK (0x40u)
122 #define PMU_VDDEXT_OVERLOAD (0x20u)
124 #define PMU_VDDEXT_OVERVOLT (0x10u)
126 #define PMU_VDDEXT_SHORT (0x08u)
128 #define PMU_VDDEXT_IE (0x04u)
130 #define PMU_VDDEXT_CYC_EN (0x02u)
132 #define PMU_VDDEXT_ENABLE (0x01u)
133 
134 /*******************************************************************************
135 ** Global Inline Function Definitions **
136 *******************************************************************************/
154 {
156 }
157 
176 {
178 }
179 
197 {
199 }
200 
219 {
221 }
222 
240 {
242 }
243 
262 {
264 }
265 
266 /*******************************************************************************
267 ** Global Function Declarations **
268 *******************************************************************************/
273 void PMU_Init(void);
274 
293 bool PMU_VDDEXT_On(void);
294 
295 /*******************************************************************************
296 ** Inline Function Declarations **
297 *******************************************************************************/
299 INLINE void PMU_Clear_Reset_Status(void);
301 INLINE void PMU_VDDEXT_Short_Clr(void);
302 INLINE void PMU_VDDEXT_Set(uint8 FlagMask);
303 
304 /*******************************************************************************
305 ** Inline Function Definitions **
306 *******************************************************************************/
325 {
326  return u8_Field_Rd8(&PMU->PMU_RESET_STS1.reg, 0u, 0xFFu);
327 }
328 
345 {
346  Field_Wrt8all(&PMU->PMU_RESET_STS1.reg, 0u);
347 }
348 
367 {
370 }
371 
385 {
386  Field_Clr8(&PMU->VDDEXT_CTRL.reg, 0x08);
387 }
388 
404 {
405  Field_Mod8(&PMU->VDDEXT_CTRL.reg, 0u, (uint8)FlagMask, 0xFFu);
406 }
407 
408 #endif
#define PMU
Definition: tle987x.h:6095
#define PMU_VDDEXT_CTRL_FAIL_EN_Msk
Definition: tle987x.h:8398
#define PMU_PMU_SUPPLY_STS_PMU_5V_FAIL_EN_Msk
Definition: tle987x.h:8359
#define PMU_PMU_SUPPLY_STS_PMU_1V5_FAIL_EN_Msk
Definition: tle987x.h:8365
#define PMU_PMU_SUPPLY_STS_PMU_5V_FAIL_EN_Pos
Definition: tle987x.h:8358
#define PMU_VDDEXT_CTRL_STABLE_Pos
Definition: tle987x.h:8387
#define PMU_VDDEXT_CTRL_ENABLE_Msk
Definition: tle987x.h:8402
#define PMU_VDDEXT_CTRL_STABLE_Msk
Definition: tle987x.h:8388
#define PMU_VDDEXT_CTRL_FAIL_EN_Pos
Definition: tle987x.h:8397
#define PMU_PMU_SUPPLY_STS_PMU_1V5_FAIL_EN_Pos
Definition: tle987x.h:8364
#define PMU_VDDEXT_CTRL_ENABLE_Pos
Definition: tle987x.h:8401
INLINE void PMU_VDDP_Int_Dis(void)
disables VDDP status information as interrupt source.
Definition: pmu.h:261
INLINE void PMU_VDDEXT_Short_Clr(void)
Clear VDDEXT Short Error Flag.
Definition: pmu.h:384
INLINE uint8 PMU_VDDEXT_Off(void)
Switches off (disables) VDDEXT and returns the stable state of VDDEXT (VDDEXT Supply works inside its...
Definition: pmu.h:366
INLINE uint8 PMU_Get_Reset_Status(void)
Reads out the Reset Status Hard Register (PMU->PMU_RESET_STS1)
Definition: pmu.h:324
INLINE void PMU_VDDEXT_Set(uint8 FlagMask)
Set the given bits in the PMU->VDDEXT_CTRL register.
Definition: pmu.h:403
INLINE void PMU_VDDP_Int_En(void)
enables VDDP status information as interrupt source.
Definition: pmu.h:239
INLINE void PMU_VDDEXT_Int_Dis(void)
disables VDDEXT Supply status information as interrupt source (disable Fail Interrupt).
Definition: pmu.h:175
INLINE void PMU_VDDEXT_Int_En(void)
enables VDDEXT Supply status information as interrupt source (enable Fail Interrupt).
Definition: pmu.h:153
void PMU_Init(void)
Initializes the ADC1 based on the Config Wizard for MOTIX MCU configuration.
INLINE void PMU_Clear_Reset_Status(void)
Clears the Reset Status Hard Register (PMU->PMU_RESET_STS1)
Definition: pmu.h:344
bool PMU_VDDEXT_On(void)
Turns VDDEXT on.
INLINE void PMU_VDDC_Int_Dis(void)
disables VDDC status information as interrupt source.
Definition: pmu.h:218
INLINE void PMU_VDDC_Int_En(void)
enables VDDC status information as interrupt source.
Definition: pmu.h:196
SFR low level access library.
INLINE uint8 u8_Field_Rd8(const volatile uint8 *reg, uint8 pos, uint8 msk)
This function reads a 8-bit field of a 8-bit register.
Definition: sfr_access.h:412
INLINE void Field_Wrt8all(volatile uint8 *reg, uint8 val)
This function writes an 8-bit register directly, no mask/position needed.
Definition: sfr_access.h:332
INLINE void Field_Clr8(volatile uint8 *reg, uint8 msk)
This function clears a bit field in a 8-bit register.
Definition: sfr_access.h:382
INLINE uint8 u1_Field_Rd8(const volatile uint8 *reg, uint8 pos, uint8 msk)
This function reads a 1-bit field of a 8-bit register.
Definition: sfr_access.h:397
INLINE void Field_Mod8(volatile uint8 *reg, uint8 pos, uint8 msk, uint8 val)
This function writes a bit field in a 8-bit register.
Definition: sfr_access.h:352
CMSIS register HeaderFile.
General type declarations.
#define INLINE
Definition: types.h:148
uint8_t uint8
8 bit unsigned value
Definition: types.h:153