PowerCC23X0.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021-2024, 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  */
84 #ifndef ti_drivers_power_PowerCC23X0_
85 #define ti_drivers_power_PowerCC23X0_
86 
87 #include <ti/drivers/dpl/HwiP.h>
88 #include <ti/drivers/dpl/ClockP.h>
89 #include <ti/drivers/Power.h>
90 
91 #include <ti/devices/DeviceFamily.h>
92 #include DeviceFamily_constructPath(inc/hw_pmctl.h)
93 #include DeviceFamily_constructPath(inc/hw_clkctl.h)
94 #include DeviceFamily_constructPath(inc/hw_lrfddbell.h)
95 #include DeviceFamily_constructPath(inc/hw_memmap.h)
96 #include DeviceFamily_constructPath(inc/hw_types.h)
97 #include DeviceFamily_constructPath(driverlib/pmctl.h)
98 
99 #ifdef __cplusplus
100 extern "C" {
101 #endif
102 
104 #define PowerCC23X0_RESUMETIMESTANDBY 400
105 
107 #define PowerCC23X0_TOTALTIMESTANDBY 500
108 
110 #define PowerCC23X0_WAKEDELAYSTANDBY 185
111 
112 /* Default lower threshold for when HFXT compensation is enabled */
113 #define PowerCC23X0_HFXT_THRESHOLD_TEMP_DEFAULT (-40)
114 
115 /* \cond */
116 /* The control of the peripherals are split between multiple groups.
117  * These defines are used to differentiate between the groups.
118  * The bits in the PowerCC23X0_PERIPH_GROUP_M mask is used to store the group id,
119  * and the bits in the PowerCC23X0_PERIPH_BIT_INDEX_M mask is used to store the
120  * bit index shift value in the register for the given group.
121  */
122 #define PowerCC23X0_PERIPH_GROUP_M 0xFF00
123 #define PowerCC23X0_PERIPH_GROUP_CLKCTL0 0x0000
124 #define PowerCC23X0_PERIPH_GROUP_LRFD 0x0100
125 #define PowerCC23X0_PERIPH_BIT_INDEX_M 0x00FF
126 
127 /* \endcond */
128 
129 /* \cond */
130 typedef uint16_t PowerLPF3_Resource; /* Power resource identifier */
131 /* \endcond */
132 
133 /* Resource IDs */
134 
136 #define PowerLPF3_PERIPH_GPIO (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_GPIO_S)
137 
139 #define PowerLPF3_PERIPH_UART0 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_UART0_S)
140 
142 #define PowerLPF3_PERIPH_I2C0 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_I2C0_S)
143 
145 #define PowerLPF3_PERIPH_SPI0 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_SPI0_S)
146 
148 #define PowerLPF3_PERIPH_ADC0 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_ADC0_S)
149 
151 #define PowerLPF3_PERIPH_AES (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LAES_S)
152 
154 #define PowerLPF3_PERIPH_DMA (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_DMA_S)
155 
157 #define PowerLPF3_PERIPH_LGPT0 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LGPT0_S)
158 
160 #define PowerLPF3_PERIPH_LGPT1 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LGPT1_S)
161 
162 /* The peripherals below are not available on CC23X0R2 devices */
163 #if !defined(DeviceFamily_CC23X0R2)
164 
165  #define PowerLPF3_PERIPH_LGPT2 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LGPT2_S)
166 
168  #define PowerLPF3_PERIPH_LGPT3 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LGPT3_S)
169 #endif
170 
172 #define PowerLPF3_PERIPH_LFRD_TRC (PowerCC23X0_PERIPH_GROUP_LRFD | LRFDDBELL_CLKCTL_TRC_S)
173 
175 #define PowerLPF3_PERIPH_LFRD_S2RRAM (PowerCC23X0_PERIPH_GROUP_LRFD | LRFDDBELL_CLKCTL_S2RRAM_S)
176 
177 /* \cond */
178 /* Number of resources in the different resource groups. This is possibly larger
179  * than the peripheral instance count on various device variants. This is
180  * because some indexes might not be used for a given variant, resulting in a
181  * sparse table.
182  */
183 #if defined(DeviceFamily_CC23X0R2)
184  #define PowerCC23X0_NUMRESOURCES_CLKCTL0 29
185 #elif (defined(DeviceFamily_CC23X0R5) || defined(DeviceFamily_CC23X0R22))
186  #define PowerCC23X0_NUMRESOURCES_CLKCTL0 31
187 #else
188  #error "Unsupported DeviceFamily specified!"
189 #endif
190 #define PowerCC23X0_NUMRESOURCES_LRFD 12
191 /* \endcond */
192 
193 #define PowerLPF3_STANDBY 0x1
194 /* \cond */
195 /* Internal flags for enabling/disabling resources */
196 #define PowerLPF3_ENABLE 1
197 #define PowerLPF3_DISABLE 0
198 /* \endcond */
199 
200 /* Constraints
201  *
202  * Constraints restrict a specific system behavior from occurring or guarantee
203  * a specified effect until released.
204  */
205 
207 #define PowerLPF3_DISALLOW_SHUTDOWN 0
208 
210 #define PowerLPF3_DISALLOW_STANDBY 1
211 
213 #define PowerLPF3_DISALLOW_IDLE 2
214 
216 #define PowerLPF3_NEED_FLASH_IN_IDLE 3
217 
218 /* \cond */
219 #define PowerCC23X0_NUMCONSTRAINTS 4 /* Number of constraints supported */
220 /* \endcond */
221 
222 /*
223  * Events
224  *
225  * Each event must be a power of two and must be sequential
226  * without any gaps.
227  */
228 
230 #define PowerLPF3_ENTERING_STANDBY (1 << 0)
231 
233 #define PowerLPF3_ENTERING_SHUTDOWN (1 << 1)
234 
236 #define PowerLPF3_AWAKE_STANDBY (1 << 2)
237 
241 #define PowerLPF3_HFXT_AVAILABLE (1 << 3)
242 
246 #define PowerLPF3_LFCLK_SWITCHED (1 << 4)
247 
248 /* \cond */
249 #define PowerCC23X0_NUMEVENTS 5 /* Number of events supported */
250 /* \endcond */
251 
259 
261 typedef struct
262 {
299 
316 
320 typedef enum
321 {
323  PowerLPF3_RESET_SHUTDOWN_IO = PMCTL_RESET_SHUTDOWN_IO,
325  PowerLPF3_RESET_SHUTDOWN_SWD = PMCTL_RESET_SHUTDOWN_SWD,
327  PowerLPF3_RESET_WATCHDOG = PMCTL_RESET_WATCHDOG,
329  PowerLPF3_RESET_SYSTEM = PMCTL_RESET_SYSTEM,
331  PowerLPF3_RESET_CPU = PMCTL_RESET_CPU,
333  PowerLPF3_RESET_LOCKUP = PMCTL_RESET_LOCKUP,
335  PowerLPF3_RESET_TSD = PMCTL_RESET_TSD,
337  PowerLPF3_RESET_SWD = PMCTL_RESET_SWD,
339  PowerLPF3_RESET_LFXT = PMCTL_RESET_LFXT,
341  PowerLPF3_RESET_VDDR = PMCTL_RESET_VDDR,
343  PowerLPF3_RESET_VDDS = PMCTL_RESET_VDDS,
345  PowerLPF3_RESET_PIN = PMCTL_RESET_PIN,
347  PowerLPF3_RESET_POR = PMCTL_RESET_POR,
349 
360 void PowerCC23X0_doWFI(void);
361 
369 static inline PowerLPF3_ResetReason PowerLPF3_getResetReason(void)
370 {
371  return (PowerLPF3_ResetReason)PMCTLGetResetReason();
372 }
373 
388 static inline void PowerLPF3_releaseLatches(void)
389 {
390  HWREG(PMCTL_BASE + PMCTL_O_SLPCTL) = PMCTL_SLPCTL_SLPN_DIS;
391 }
392 
416 void PowerCC23X0_standbyPolicy(void);
417 
433 void PowerLPF3_selectLFOSC(void);
434 
450 void PowerLPF3_selectLFXT(void);
451 
472 void PowerLPF3_selectEXTLF(void);
473 
492 void PowerLPF3_initHFXTCompensation(int32_t P0, int32_t P1, int32_t P2, int32_t P3, uint8_t shift, bool fcfgInsertion);
493 
516 void PowerLPF3_enableHFXTCompensation(int16_t tempThreshold, int16_t tempDelta);
517 
529 
537 
556 int_fast8_t PowerLPF3_getHfxtAmpAdjustment(void);
557 
577 void PowerLPF3_adjustHfxtAmp(int_fast8_t adjustment);
578 
581 
582 #ifdef __cplusplus
583 }
584 #endif
585 
586 #endif /* POWER_CC23X0_ */
Definition: PowerCC23X0.h:345
void PowerCC23X0_schedulerRestore(void)
PowerLPF3_ResetReason
Reasons the device has booted or rebooted.
Definition: PowerCC23X0.h:320
void PowerLPF3_disableHFXTCompensation(void)
Disable HFXT temperature compensation.
void PowerCC23X0_doWFI(void)
The wait for interrupt (WFI) policy.
Definition: PowerCC23X0.h:343
Clock interface for the RTOS Porting Interface.
Definition: PowerCC23X0.h:333
void(* Power_PolicyInitFxn)(void)
Power policy initialization function pointer.
Definition: Power.h:401
Global configuration structure.
Definition: PowerCC23X0.h:261
Power Manager.
void PowerLPF3_enableHFXTCompensation(int16_t tempThreshold, int16_t tempDelta)
Enable HFXT temperature compensation.
Definition: PowerCC23X0.h:337
Definition: PowerCC23X0.h:335
Definition: PowerCC23X0.h:339
void PowerLPF3_adjustHfxtAmp(int_fast8_t adjustment)
Adjust the HFXT amplitude.
int_fast8_t PowerLPF3_getHfxtAmpAdjustment(void)
Check if HFXT amplitude needs to be adjusted.
void PowerCC23X0_standbyPolicy(void)
The STANDBY Power Policy.
void(* Power_PolicyFxn)(void)
Power policy function pointer.
Definition: Power.h:406
Power_PolicyInitFxn policyInitFxn
The Power Policy&#39;s initialization function.
Definition: PowerCC23X0.h:269
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:298
Definition: PowerCC23X0.h:327
void PowerCC23X0_schedulerDisable(void)
void PowerLPF3_selectLFXT(void)
Select LFXT as LFCLK source.
void PowerLPF3_selectLFOSC(void)
Select LFOSC as LFCLK source.
Definition: PowerCC23X0.h:323
Definition: PowerCC23X0.h:329
void PowerLPF3_startInitialHfxtAmpComp(void)
Start initial compensation of the HFXT amplitude.
void(* PowerLPF3_StartInitialHfxtAmpCompFxn)(void)
Function pointer to PowerLPF3_startInitialHfxtAmpComp() or NULL.
Definition: PowerCC23X0.h:258
Definition: PowerCC23X0.h:341
Definition: PowerCC23X0.h:331
static PowerLPF3_ResetReason PowerLPF3_getResetReason(void)
Returns the reason for the most recent reset or wakeup.
Definition: PowerCC23X0.h:369
PowerLPF3_StartInitialHfxtAmpCompFxn startInitialHfxtAmpCompFxn
Pointer to the function to start the initial HFXT amplitude compensation.
Definition: PowerCC23X0.h:314
static void PowerLPF3_releaseLatches(void)
Unlatch all IOs.
Definition: PowerCC23X0.h:388
Hardware Interrupt module for the RTOS Porting Interface.
void PowerLPF3_selectEXTLF(void)
Select EXTLF as LFCLK source.
Definition: PowerCC23X0.h:325
Definition: PowerCC23X0.h:347
© Copyright 1995-2024, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale