PowerCC23X0.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021-2025, 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  */
94 #ifndef ti_drivers_power_PowerCC23X0_
95 #define ti_drivers_power_PowerCC23X0_
96 
97 #include <ti/drivers/dpl/HwiP.h>
98 #include <ti/drivers/dpl/ClockP.h>
99 #include <ti/drivers/Power.h>
100 
101 #include <ti/devices/DeviceFamily.h>
102 #include DeviceFamily_constructPath(inc/hw_pmctl.h)
103 #include DeviceFamily_constructPath(inc/hw_clkctl.h)
104 #include DeviceFamily_constructPath(inc/hw_lrfddbell.h)
105 #include DeviceFamily_constructPath(inc/hw_memmap.h)
106 #include DeviceFamily_constructPath(inc/hw_types.h)
107 #include DeviceFamily_constructPath(driverlib/pmctl.h)
108 
109 #ifdef __cplusplus
110 extern "C" {
111 #endif
112 
114 #define PowerCC23X0_RESUMETIMESTANDBY (400U)
115 
117 #define PowerCC23X0_TOTALTIMESTANDBY (500U)
118 
120 #define PowerCC23X0_WAKEDELAYSTANDBY (185U)
121 
122 /* Default lower threshold for when HFXT compensation is enabled */
123 #define PowerCC23X0_HFXT_THRESHOLD_TEMP_DEFAULT (-40)
124 
125 /* \cond */
126 /* The control of the peripherals are split between multiple groups.
127  * These defines are used to differentiate between the groups.
128  * The bits in the PowerCC23X0_PERIPH_GROUP_M mask is used to store the group id,
129  * and the bits in the PowerCC23X0_PERIPH_BIT_INDEX_M mask is used to store the
130  * bit index shift value in the register for the given group.
131  */
132 #define PowerCC23X0_PERIPH_GROUP_M (0xFF00U)
133 #define PowerCC23X0_PERIPH_GROUP_CLKCTL0 (0x0000U)
134 #define PowerCC23X0_PERIPH_GROUP_LRFD (0x0100U)
135 #define PowerCC23X0_PERIPH_BIT_INDEX_M (0x00FFU)
136 
137 /* \endcond */
138 
139 /* \cond */
140 typedef uint16_t PowerLPF3_Resource; /* Power resource identifier */
141 /* \endcond */
142 
143 /* Resource IDs */
144 
146 #define PowerLPF3_PERIPH_GPIO (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_GPIO_S)
147 
149 #define PowerLPF3_PERIPH_UART0 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_UART0_S)
150 
152 #define PowerLPF3_PERIPH_I2C0 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_I2C0_S)
153 
155 #define PowerLPF3_PERIPH_SPI0 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_SPI0_S)
156 
158 #define PowerLPF3_PERIPH_ADC0 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_ADC0_S)
159 
161 #define PowerLPF3_PERIPH_AES (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LAES_S)
162 
164 #define PowerLPF3_PERIPH_DMA (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_DMA_S)
165 
167 #define PowerLPF3_PERIPH_LGPT0 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LGPT0_S)
168 
170 #define PowerLPF3_PERIPH_LGPT1 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LGPT1_S)
171 
172 /* The peripherals below are not available on CC23X0R2 devices */
173 #if !defined(DeviceFamily_CC23X0R2)
174 
175  #define PowerLPF3_PERIPH_LGPT2 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LGPT2_S)
176 
178  #define PowerLPF3_PERIPH_LGPT3 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LGPT3_S)
179 #endif
180 
182 #define PowerLPF3_PERIPH_LFRD_TRC (PowerCC23X0_PERIPH_GROUP_LRFD | LRFDDBELL_CLKCTL_TRC_S)
183 
185 #define PowerLPF3_PERIPH_LFRD_S2RRAM (PowerCC23X0_PERIPH_GROUP_LRFD | LRFDDBELL_CLKCTL_S2RRAM_S)
186 
187 /* \cond */
188 /* Number of resources in the different resource groups. This is possibly larger
189  * than the peripheral instance count on various device variants. This is
190  * because some indexes might not be used for a given variant, resulting in a
191  * sparse table.
192  */
193 #if defined(DeviceFamily_CC23X0R2)
194  #define PowerCC23X0_NUMRESOURCES_CLKCTL0 (29U)
195 #elif (defined(DeviceFamily_CC23X0R5) || defined(DeviceFamily_CC23X0R22))
196  #define PowerCC23X0_NUMRESOURCES_CLKCTL0 (31U)
197 #else
198  #error "Unsupported DeviceFamily specified!"
199 #endif
200 #define PowerCC23X0_NUMRESOURCES_LRFD (12U)
201 /* \endcond */
202 
203 #define PowerLPF3_STANDBY (0x1U)
205 /* Constraints
206  *
207  * Constraints restrict a specific system behavior from occurring or guarantee
208  * a specified effect until released.
209  */
210 
212 #define PowerLPF3_DISALLOW_SHUTDOWN (0U)
213 
215 #define PowerLPF3_DISALLOW_STANDBY (1U)
216 
218 #define PowerLPF3_DISALLOW_IDLE (2U)
219 
221 #define PowerLPF3_NEED_FLASH_IN_IDLE (3U)
222 
224 #define PowerLPF3_DISALLOW_SWTCXO (4U)
225 
226 /* \cond */
227 #define PowerCC23X0_NUMCONSTRAINTS (5U) /* Number of constraints supported */
228 /* \endcond */
229 
230 /*
231  * Events
232  *
233  * Each event must be a power of two and must be sequential
234  * without any gaps.
235  */
236 
238 #define PowerLPF3_ENTERING_STANDBY ((uint_fast16_t)((uint_fast16_t)1U << 0))
239 
241 #define PowerLPF3_ENTERING_SHUTDOWN ((uint_fast16_t)((uint_fast16_t)1U << 1))
242 
244 #define PowerLPF3_AWAKE_STANDBY ((uint_fast16_t)((uint_fast16_t)1U << 2))
245 
249 #define PowerLPF3_HFXT_AVAILABLE ((uint_fast16_t)((uint_fast16_t)1U << 3))
250 
254 #define PowerLPF3_LFCLK_SWITCHED ((uint_fast16_t)((uint_fast16_t)1U << 4))
255 
256 /* \cond */
257 #define PowerCC23X0_NUMEVENTS ((uint_fast16_t)((uint_fast16_t)5U)) /* Number of events supported */
258 /* \endcond */
259 
267 
269 typedef struct
270 {
307 
324 
328 typedef enum
329 {
331  PowerLPF3_RESET_SHUTDOWN_IO = PMCTL_RESET_SHUTDOWN_IO,
333  PowerLPF3_RESET_SHUTDOWN_SWD = PMCTL_RESET_SHUTDOWN_SWD,
335  PowerLPF3_RESET_WATCHDOG = PMCTL_RESET_WATCHDOG,
337  PowerLPF3_RESET_SYSTEM = PMCTL_RESET_SYSTEM,
339  PowerLPF3_RESET_CPU = PMCTL_RESET_CPU,
341  PowerLPF3_RESET_LOCKUP = PMCTL_RESET_LOCKUP,
343  PowerLPF3_RESET_TSD = PMCTL_RESET_TSD,
345  PowerLPF3_RESET_SWD = PMCTL_RESET_SWD,
347  PowerLPF3_RESET_LFXT = PMCTL_RESET_LFXT,
349  PowerLPF3_RESET_VDDR = PMCTL_RESET_VDDR,
351  PowerLPF3_RESET_VDDS = PMCTL_RESET_VDDS,
353  PowerLPF3_RESET_PIN = PMCTL_RESET_PIN,
355  PowerLPF3_RESET_POR = PMCTL_RESET_POR,
359 
370 void PowerCC23X0_doWFI(void);
371 
379 PowerLPF3_ResetReason PowerLPF3_getResetReason(void);
380 
395 static inline void PowerLPF3_releaseLatches(void)
396 {
397  HWREG(PMCTL_BASE + PMCTL_O_SLPCTL) = PMCTL_SLPCTL_SLPN_DIS;
398 }
399 
423 void PowerCC23X0_standbyPolicy(void);
424 
440 void PowerLPF3_selectLFOSC(void);
441 
457 void PowerLPF3_selectLFXT(void);
458 
479 void PowerLPF3_selectEXTLF(void);
480 
502 void PowerLPF3_initHFXTCompensation(int32_t P0, int32_t P1, int32_t P2, int32_t P3, uint8_t shift, bool fcfgInsertion);
503 
526 void PowerLPF3_enableHFXTCompensation(int16_t tempThreshold, int16_t tempDelta);
527 
539 
549 
561 
569 
588 int_fast8_t PowerLPF3_getHfxtAmpAdjustment(void);
589 
609 void PowerLPF3_adjustHfxtAmp(int_fast8_t adjustment);
610 
652 int_fast16_t PowerLPF3_sleep(uint32_t nextEventTimeUs);
653 
663 
666 
667 #ifdef __cplusplus
668 }
669 #endif
670 
671 #endif /* POWER_CC23X0_ */
Definition: PowerCC23X0.h:353
void PowerCC23X0_schedulerRestore(void)
PowerLPF3_ResetReason
Reasons the device has booted or rebooted.
Definition: PowerCC23X0.h:328
void PowerLPF3_disableHFXTCompensation(void)
Disable HFXT temperature compensation.
void PowerCC23X0_doWFI(void)
The wait for interrupt (WFI) policy.
Definition: PowerCC23X0.h:351
Clock interface for the RTOS Porting Interface.
Definition: PowerCC23X0.h:341
void(* Power_PolicyInitFxn)(void)
Power policy initialization function pointer.
Definition: Power.h:401
Global configuration structure.
Definition: PowerCC23X0.h:269
Power Manager.
void PowerLPF3_enableHFXTCompensation(int16_t tempThreshold, int16_t tempDelta)
Enable HFXT temperature compensation.
Definition: PowerCC23X0.h:345
PowerLPF3_ResetReason PowerLPF3_getResetReason(void)
Returns the reason for the most recent reset or wakeup.
Definition: PowerCC23X0.h:343
Definition: PowerCC23X0.h:347
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:277
void PowerLPF3_initHFXTCompensation(int32_t P0, int32_t P1, int32_t P2, int32_t P3, uint8_t shift, bool fcfgInsertion)
Initialize HFXT temperature compensation coefficients.
Definition: PowerCC23X0.h:357
bool PowerLPF3_isLfincFilterAllowingStandby(void)
Checks if the LFINC filter is ready to go to standby or not.
Power_PolicyFxn policyFxn
The Power Policy function.
Definition: PowerCC23X0.h:306
Definition: PowerCC23X0.h:335
void PowerLPF3_forceHFXTCompensationUpdate(void)
Force HFXT temperature compensation update.
void PowerCC23X0_schedulerDisable(void)
void PowerLPF3_selectLFXT(void)
Select LFXT as LFCLK source.
void PowerLPF3_selectLFOSC(void)
Select LFOSC as LFCLK source.
int_fast16_t PowerLPF3_sleep(uint32_t nextEventTimeUs)
Transition the device into standby and configure RTC to wakeup the device ahead of a specified time...
Definition: PowerCC23X0.h:331
Definition: PowerCC23X0.h:337
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:266
Definition: PowerCC23X0.h:349
Definition: PowerCC23X0.h:339
uint32_t PowerLPF3_getHFXTCompensationRatio(void)
Get the current HFXT compensation ratio.
PowerLPF3_StartInitialHfxtAmpCompFxn startInitialHfxtAmpCompFxn
Pointer to the function to start the initial HFXT amplitude compensation.
Definition: PowerCC23X0.h:322
static void PowerLPF3_releaseLatches(void)
Unlatch all IOs.
Definition: PowerCC23X0.h:395
Hardware Interrupt module for the RTOS Porting Interface.
void PowerLPF3_selectEXTLF(void)
Select EXTLF as LFCLK source.
Definition: PowerCC23X0.h:333
Definition: PowerCC23X0.h:355
© Copyright 1995-2025, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale