PowerCC23X0.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021-2023, 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  */
52 #ifndef ti_drivers_power_PowerCC23X0_
53 #define ti_drivers_power_PowerCC23X0_
54 
55 #include <ti/drivers/dpl/HwiP.h>
56 #include <ti/drivers/dpl/ClockP.h>
57 #include <ti/drivers/Power.h>
58 
59 #include <ti/devices/DeviceFamily.h>
60 #include DeviceFamily_constructPath(inc/hw_pmctl.h)
61 #include DeviceFamily_constructPath(inc/hw_clkctl.h)
62 #include DeviceFamily_constructPath(inc/hw_lrfddbell.h)
63 #include DeviceFamily_constructPath(inc/hw_memmap.h)
64 #include DeviceFamily_constructPath(inc/hw_types.h)
65 #include DeviceFamily_constructPath(driverlib/pmctl.h)
66 
67 #ifdef __cplusplus
68 extern "C" {
69 #endif
70 
72 #define PowerCC23X0_RESUMETIMESTANDBY 400
73 
75 #define PowerCC23X0_TOTALTIMESTANDBY 500
76 
78 #define PowerCC23X0_WAKEDELAYSTANDBY 185
79 
80 /* Default lower threshold for when HFXT compensation is enabled */
81 #define PowerCC23X0_HFXT_THRESHOLD_TEMP_DEFAULT (-40)
82 
83 /* \cond */
84 /* The control of the peripherals are split between multiple groups.
85  * These defines are used to differentiate between the groups.
86  * The bits in the PowerCC23X0_PERIPH_GROUP_M mask is used to store the group id,
87  * and the bits in the PowerCC23X0_PERIPH_BIT_INDEX_M mask is used to store the
88  * bit index shift value in the register for the given group.
89  */
90 #define PowerCC23X0_PERIPH_GROUP_M 0xFF00
91 #define PowerCC23X0_PERIPH_GROUP_CLKCTL0 0x0000
92 #define PowerCC23X0_PERIPH_GROUP_LRFD 0x0100
93 #define PowerCC23X0_PERIPH_BIT_INDEX_M 0x00FF
94 
95 /* \endcond */
96 /* Resource IDs */
97 
99 #define PowerLPF3_PERIPH_GPIO (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_GPIO_S)
100 
102 #define PowerLPF3_PERIPH_UART0 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_UART0_S)
103 
105 #define PowerLPF3_PERIPH_I2C0 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_I2C0_S)
106 
108 #define PowerLPF3_PERIPH_SPI0 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_SPI0_S)
109 
111 #define PowerLPF3_PERIPH_ADC0 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_ADC0_S)
112 
114 #define PowerLPF3_PERIPH_AES (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LAES_S)
115 
117 #define PowerLPF3_PERIPH_DMA (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_DMA_S)
118 
120 #define PowerLPF3_PERIPH_LGPT0 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LGPT0_S)
121 
123 #define PowerLPF3_PERIPH_LGPT1 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LGPT1_S)
124 
125 /* The peripherals below are not available on CC23X0R2 devices */
126 #if !defined(DeviceFamily_CC23X0R2)
127 
128  #define PowerLPF3_PERIPH_LGPT2 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LGPT2_S)
129 
131  #define PowerLPF3_PERIPH_LGPT3 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LGPT3_S)
132 #endif
133 
135 #define PowerLPF3_PERIPH_LFRD_TRC (PowerCC23X0_PERIPH_GROUP_LRFD | LRFDDBELL_CLKCTL_TRC_S)
136 
138 #define PowerLPF3_PERIPH_LFRD_S2RRAM (PowerCC23X0_PERIPH_GROUP_LRFD | LRFDDBELL_CLKCTL_S2RRAM_S)
139 
140 /* \cond */
141 /* Number of resources in the different resource groups. This is possibly larger
142  * than the peripheral instance count on various device variants. This is
143  * because some indexes might not be used for a given variant, resulting in a
144  * sparse table.
145  */
146 #if defined(DeviceFamily_CC23X0R2)
147  #define PowerCC23X0_NUMRESOURCES_CLKCTL0 29
148 #elif defined(DeviceFamily_CC23X0R5)
149  #define PowerCC23X0_NUMRESOURCES_CLKCTL0 31
150 #else
151  #error "Unsupported DeviceFamily specified!"
152 #endif
153 #define PowerCC23X0_NUMRESOURCES_LRFD 12
154 /* \endcond */
155 
156 #define PowerLPF3_STANDBY 0x1
157 /* \cond */
158 /* Internal flags for enabling/disabling resources */
159 #define PowerLPF3_ENABLE 1
160 #define PowerLPF3_DISABLE 0
161 /* \endcond */
162 
163 /* Constraints
164  *
165  * Constraints restrict a specific system behavior from occurring or guarantee
166  * a specified effect until released.
167  */
168 
170 #define PowerLPF3_DISALLOW_SHUTDOWN 0
171 
173 #define PowerLPF3_DISALLOW_STANDBY 1
174 
176 #define PowerLPF3_DISALLOW_IDLE 2
177 
179 #define PowerLPF3_NEED_FLASH_IN_IDLE 3
180 
181 /* \cond */
182 #define PowerCC23X0_NUMCONSTRAINTS 4 /* Number of constraints supported */
183 /* \endcond */
184 
185 /*
186  * Events
187  *
188  * Each event must be a power of two and must be sequential
189  * without any gaps.
190  */
191 
193 #define PowerLPF3_ENTERING_STANDBY (1 << 0)
194 
196 #define PowerLPF3_ENTERING_SHUTDOWN (1 << 1)
197 
199 #define PowerLPF3_AWAKE_STANDBY (1 << 2)
200 
204 #define PowerLPF3_HFXT_AVAILABLE (1 << 3)
205 
209 #define PowerLPF3_LFCLK_SWITCHED (1 << 4)
210 
211 /* \cond */
212 #define PowerCC23X0_NUMEVENTS 5 /* Number of events supported */
213 /* \endcond */
214 
216 typedef struct
217 {
255 
259 typedef enum
260 {
262  PowerLPF3_RESET_SHUTDOWN_IO = PMCTL_RESET_SHUTDOWN_IO,
264  PowerLPF3_RESET_SHUTDOWN_SWD = PMCTL_RESET_SHUTDOWN_SWD,
266  PowerLPF3_RESET_WATCHDOG = PMCTL_RESET_WATCHDOG,
268  PowerLPF3_RESET_SYSTEM = PMCTL_RESET_SYSTEM,
270  PowerLPF3_RESET_CPU = PMCTL_RESET_CPU,
272  PowerLPF3_RESET_LOCKUP = PMCTL_RESET_LOCKUP,
274  PowerLPF3_RESET_TSD = PMCTL_RESET_TSD,
276  PowerLPF3_RESET_SWD = PMCTL_RESET_SWD,
278  PowerLPF3_RESET_LFXT = PMCTL_RESET_LFXT,
280  PowerLPF3_RESET_VDDR = PMCTL_RESET_VDDR,
282  PowerLPF3_RESET_VDDS = PMCTL_RESET_VDDS,
284  PowerLPF3_RESET_PIN = PMCTL_RESET_PIN,
286  PowerLPF3_RESET_POR = PMCTL_RESET_POR,
288 
299 void PowerCC23X0_doWFI(void);
300 
308 static inline PowerLPF3_ResetReason PowerLPF3_getResetReason(void)
309 {
310  return (PowerLPF3_ResetReason)PMCTLGetResetReason();
311 }
312 
327 static inline void PowerLPF3_releaseLatches(void)
328 {
329  HWREG(PMCTL_BASE + PMCTL_O_SLPCTL) = PMCTL_SLPCTL_SLPN_DIS;
330 }
331 
355 void PowerCC23X0_standbyPolicy(void);
356 
371 void PowerLPF3_selectLFOSC(void);
372 
387 void PowerLPF3_selectLFXT(void);
388 
406 void PowerLPF3_initHFXTCompensation(int32_t P0, int32_t P1, int32_t P2, int32_t P3, uint8_t shift, bool fcfgInsertion);
407 
430 void PowerLPF3_enableHFXTCompensation(int16_t tempThreshold, int16_t tempDelta);
431 
443 
446 
447 #define Power_getPerformanceLevel(void) 0
448 #define Power_setPerformanceLevel(level) Power_EFAIL
449 
450 #ifdef __cplusplus
451 }
452 #endif
453 
454 #endif /* POWER_CC23X0_ */
Definition: PowerCC23X0.h:284
void PowerCC23X0_schedulerRestore(void)
PowerLPF3_ResetReason
Reasons the device has booted or rebooted.
Definition: PowerCC23X0.h:259
void PowerLPF3_disableHFXTCompensation(void)
Disable HFXT temperature compensation.
void PowerCC23X0_doWFI(void)
The wait for interrupt (WFI) policy.
Definition: PowerCC23X0.h:282
Clock interface for the RTOS Porting Interface.
Definition: PowerCC23X0.h:272
void(* Power_PolicyInitFxn)(void)
Power policy initialization function pointer.
Definition: Power.h:405
Global configuration structure.
Definition: PowerCC23X0.h:216
Power Manager.
void PowerLPF3_enableHFXTCompensation(int16_t tempThreshold, int16_t tempDelta)
Enable HFXT temperature compensation.
Definition: PowerCC23X0.h:276
Definition: PowerCC23X0.h:274
Definition: PowerCC23X0.h:278
void PowerCC23X0_standbyPolicy(void)
The STANDBY Power Policy.
void(* Power_PolicyFxn)(void)
Power policy function pointer.
Definition: Power.h:410
Power_PolicyInitFxn policyInitFxn
The Power Policy&#39;s initialization function.
Definition: PowerCC23X0.h:224
void PowerLPF3_initHFXTCompensation(int32_t P0, int32_t P1, int32_t P2, int32_t P3, uint8_t shift, bool fcfgInsertion)
Initialise HFXT temperature compensation coefficients.
Power_PolicyFxn policyFxn
The Power Policy function.
Definition: PowerCC23X0.h:253
Definition: PowerCC23X0.h:266
void PowerCC23X0_schedulerDisable(void)
void PowerLPF3_selectLFXT(void)
Select LFOSC as LFCLK source.
void PowerLPF3_selectLFOSC(void)
Select LFOSC as LFCLK source.
Definition: PowerCC23X0.h:262
Definition: PowerCC23X0.h:268
Definition: PowerCC23X0.h:280
Definition: PowerCC23X0.h:270
static PowerLPF3_ResetReason PowerLPF3_getResetReason(void)
Returns the reason for the most recent reset or wakeup.
Definition: PowerCC23X0.h:308
static void PowerLPF3_releaseLatches(void)
Unlatch all IOs.
Definition: PowerCC23X0.h:327
Hardware Interrupt module for the RTOS Porting Interface.
Definition: PowerCC23X0.h:264
Definition: PowerCC23X0.h:286
© Copyright 1995-2023, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale