PowerCC26XX.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-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_PowerCC26XX_
53 #define ti_drivers_power_PowerCC26XX_
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 
61 /* Note: Device specific Power include files are included in the bottom of this file. */
62 
63 #ifdef __cplusplus
64 extern "C" {
65 #endif
66 
67 /* \cond */
68 typedef uint8_t PowerCC26XX_Resource; /* Resource identifier */
69 /* \endcond */
70 
72 #define PowerCC26XX_RESUMETIMESTANDBY 750
73 
75 #define PowerCC26XX_TOTALTIMESTANDBY 1000
76 
78 #define PowerCC26XX_WAKEDELAYSTANDBY 240
79 
81 #define PowerCC26XX_INITIALWAITRCOSC_LF 1000
82 
84 #define PowerCC26XX_RETRYWAITRCOSC_LF 1000
85 
87 #define PowerCC26XX_INITIALWAITXOSC_HF 50
88 
90 #define PowerCC26XX_RETRYWAITXOSC_HF 50
91 
93 #define PowerCC26XX_INITIALWAITXOSC_LF 10000
94 
96 #define PowerCC26XX_RETRYWAITXOSC_LF 5000
97 
98 /*
99  * Resource IDs
100  */
102 #define PowerCC26XX_PERIPH_GPT0 0
103 
105 #define PowerCC26XX_PERIPH_GPT1 1
106 
108 #define PowerCC26XX_PERIPH_GPT2 2
109 
111 #define PowerCC26XX_PERIPH_GPT3 3
112 
114 #define PowerCC26XX_PERIPH_SSI0 4
115 #if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X4_CC26X3_CC26X4)
116 
117  #define PowerCC26XX_PERIPH_SPI0 PowerCC26XX_PERIPH_SSI0
118 #endif
119 
121 #define PowerCC26XX_PERIPH_UART0 5
122 
124 #define PowerCC26XX_PERIPH_I2C0 6
125 
127 #define PowerCC26XX_PERIPH_TRNG 7
128 
130 #define PowerCC26XX_PERIPH_GPIO 8
131 
133 #define PowerCC26XX_PERIPH_UDMA 9
134 
136 #define PowerCC26XX_PERIPH_CRYPTO 10
137 
139 #define PowerCC26XX_PERIPH_I2S 11
140 
142 #define PowerCC26XX_PERIPH_RFCORE 12
143 
145 #define PowerCC26XX_XOSC_HF 13
146 
148 #define PowerCC26XX_DOMAIN_PERIPH 14
149 
151 #define PowerCC26XX_DOMAIN_SERIAL 15
152 
154 #define PowerCC26XX_DOMAIN_RFCORE 16
155 
157 #define PowerCC26XX_DOMAIN_SYSBUS 17
158 
159 /* The PKA and UART1 peripherals are not available on CC13X1 and CC26X1 devices */
160 #if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X2_CC26X2 || \
161  DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X4_CC26X3_CC26X4)
162 
164  #define PowerCC26XX_PERIPH_PKA 18
165 
167  #define PowerCC26XX_PERIPH_UART1 19
168 
170  #define PowerCC26XX_PERIPH_SSI1 20
171  #if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X4_CC26X3_CC26X4)
172 
173  #define PowerCC26XX_PERIPH_SPI1 PowerCC26XX_PERIPH_SSI1
174  #endif
175 #endif
176 
177 /* The peripherals below are only available on CC13X4 and CC26X4 devices */
178 #if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X4_CC26X3_CC26X4)
179 
181  #define PowerCC26XX_PERIPH_UART2 21
182 
184  #define PowerCC26XX_PERIPH_UART3 22
185 
187  #define PowerCC26XX_PERIPH_SPI2 23
188 
189  #define PowerCC26XX_PERIPH_SSI2 PowerCC26XX_PERIPH_SPI2
190 
192  #define PowerCC26XX_PERIPH_SPI3 24
193 
194  #define PowerCC26XX_PERIPH_SSI3 PowerCC26XX_PERIPH_SPI3
195 
197  #define PowerCC26XX_PERIPH_I2C1 25
198 #endif
199 
200 /* \cond */
201 #if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X0_CC26X0)
202  #define PowerCC26XX_NUMRESOURCES 19 /* Number of resources in database */
203 #elif (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X1_CC26X1)
204  #define PowerCC26XX_NUMRESOURCES 19 /* Number of resources in database */
205 #elif (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X2_CC26X2)
206  #define PowerCC26XX_NUMRESOURCES 21 /* Number of resources in database */
207 #elif (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X4_CC26X3_CC26X4)
208  #define PowerCC26XX_NUMRESOURCES 26 /* Number of resources in database */
209 #endif
210 /* \endcond */
211 
212 /* \cond */
213 /* Resource record bitmasks */
214 #define PowerCC26XX_PERIPH 0x80 /* resource is a peripheral */
215 #define PowerCC26XX_SPECIAL 0x40 /* resource requires special handler */
216 #define PowerCC26XX_DOMAIN 0x00 /* resource is a domain */
217 #define PowerCC26XX_PARENTMASK 0x3F /* parent resource mask */
218 #define PowerCC26XX_NOPARENT 0x3F /* if resource has no parent */
219 /* \endcond */
220 
222 #define PowerCC26XX_STANDBY 0x1
223 /* \cond */
224 /* Internal flags for enabling/disabling resources */
225 #define PowerCC26XX_ENABLE 1
226 #define PowerCC26XX_DISABLE 0
227 /* \endcond */
228 
229 /* Constraints */
231 #define PowerCC26XX_RETAIN_VIMS_CACHE_IN_STANDBY 0
232 
234 #define PowerCC26XX_DISALLOW_SHUTDOWN 1
235 
237 #define PowerCC26XX_DISALLOW_STANDBY 2
238 
240 #define PowerCC26XX_DISALLOW_IDLE 3
241 
243 #define PowerCC26XX_NEED_FLASH_IN_IDLE 4
244 
256 #define PowerCC26XX_SWITCH_XOSC_HF_MANUALLY 5
257 
265 #define PowerCC26XX_DISALLOW_XOSC_HF_SWITCHING 6
266 
267 /* \cond */
268 #define PowerCC26XX_NUMCONSTRAINTS 7 /* Number of constraints supported */
269 /* \endcond */
270 
271 /* \cond */
272 /* Deprecated constraint names */
273 #define PowerCC26XX_SD_DISALLOW PowerCC26XX_DISALLOW_SHUTDOWN
274 #define PowerCC26XX_SB_DISALLOW PowerCC26XX_DISALLOW_STANDBY
275 #define PowerCC26XX_IDLE_PD_DISALLOW PowerCC26XX_DISALLOW_IDLE
276 #define PowerCC26XX_XOSC_HF_SWITCHING_DISALLOW PowerCC26XX_DISALLOW_XOSC_HF_SWITCHING
277 #define PowerCC26XX_SB_VIMS_CACHE_RETAIN PowerCC26XX_RETAIN_VIMS_CACHE_IN_STANDBY
278 /* \endcond */
279 
280 /*
281  * Events
282  *
283  * Each event must be a power of two and must be sequential
284  * without any gaps.
285  */
287 #define PowerCC26XX_ENTERING_STANDBY 0x1
288 
290 #define PowerCC26XX_ENTERING_SHUTDOWN 0x2
291 
293 #define PowerCC26XX_AWAKE_STANDBY 0x4
294 
297 #define PowerCC26XX_AWAKE_STANDBY_LATE 0x8
298 
300 #define PowerCC26XX_XOSC_HF_SWITCHED 0x10
301 
312 #define PowerCC26XX_SCLK_LF_SWITCHED 0x20
313 
382 #define PowerCC26XX_JTAG_PD_TURNED_ON 0x40
383 
384 /* \cond */
385 #define PowerCC26XX_NUMEVENTS 6 /* Number of events supported */
386 /* \endcond */
387 
388 /* \cond */
389 /*
390  * Calibration stages
391  */
392 #define PowerCC26XX_SETUP_CALIBRATE 1
393 #define PowerCC26XX_INITIATE_CALIBRATE 2
394 #define PowerCC26XX_DO_CALIBRATE 3
395 /* \endcond */
396 
397 /* \cond */
399 typedef struct
400 {
401  uint8_t flags; /* resource type | first parent */
402  uint16_t driverlibID; /* corresponding driverlib ID for this resource */
403 } PowerCC26XX_ResourceRecord;
404 /* \endcond */
405 
407 typedef struct
408 {
449  bool (*calibrateFxn)(unsigned int arg);
539 
546 typedef struct
547 {
549  uint32_t constraintMask;
555  int32_t nDeltaFreqCurr;
556  int32_t nCtrimCurr;
557  int32_t nCtrimFractCurr;
558  int32_t nCtrimNew;
559  int32_t nCtrimFractNew;
560  int32_t nRtrimNew;
561  int32_t nRtrimCurr;
562  int32_t nDeltaFreqNew;
563  bool bRefine;
564  uint32_t state;
565  bool xoscPending;
566  bool calLF;
567  uint8_t hwiState;
568  bool busyCal;
569  uint8_t calStep;
570  bool firstLF;
572  bool initialized;
573 #if defined(DeviceFamily_CC26X0R2)
574  bool emulatorAttached;
575 #endif
576  uint8_t constraintCounts[PowerCC26XX_NUMCONSTRAINTS];
578  uint8_t resourceCounts[PowerCC26XX_NUMRESOURCES];
580  unsigned int (*resourceHandlers[3])(unsigned int arg);
584 
596 bool PowerCC26XX_calibrate(unsigned int arg);
597 
608 void PowerCC26XX_doWFI(void);
609 
622 
633 uint32_t PowerCC26XX_getXoscStartupTime(uint32_t timeUntilWakeupInMs);
634 
650 
667 bool PowerCC26XX_noCalibrate(unsigned int arg);
668 
681 bool PowerCC26XX_isStableXOSC_HF(void);
682 
697 void PowerCC26XX_switchXOSC_HF(void);
698 
722 void PowerCC26XX_standbyPolicy(void);
723 
726 
727 #ifdef __cplusplus
728 }
729 #endif
730 
731 #if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X1_CC26X1 || \
732  DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X2_CC26X2 || \
733  DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X4_CC26X3_CC26X4)
735 #endif
736 
737 #endif /* POWER_CC26XX_ */
bool calLF
Definition: PowerCC26XX.h:566
Power manager interface for CC26X2.
void PowerCC26XX_doWFI(void)
The Wait for interrupt (WFI) policy.
int32_t nDeltaFreqNew
Definition: PowerCC26XX.h:562
bool xoscPending
Definition: PowerCC26XX.h:565
bool bRefine
Definition: PowerCC26XX.h:563
bool PowerCC26XX_calibrate(unsigned int arg)
The RC Oscillator (RCOSC) calibration function.
HwiP structure.
Definition: HwiP.h:78
Definition: List.h:132
uint32_t constraintMask
Definition: PowerCC26XX.h:549
bool calibrateRCOSC_LF
Boolean specifying whether the low frequency RC oscillator (RCOSC_LF) should be calibrated.
Definition: PowerCC26XX.h:528
bool enableMaxStandbyDuration
Boolean that enables limiting the duration spent in standby.
Definition: PowerCC26XX.h:506
Power_PolicyInitFxn policyInitFxn
The Power Policy&#39;s initialization function.
Definition: PowerCC26XX.h:415
ClockP structure.
Definition: ClockP.h:81
Clock interface for the RTOS Porting Interface.
void(* Power_PolicyInitFxn)(void)
Power policy initialization function pointer.
Definition: Power.h:401
uint16_t vddrRechargeMargin
Margin in SCLK_LF periods subtracted from previous longest VDDR recharge period.
Definition: PowerCC26XX.h:493
Power Manager.
HwiP_Struct hwiStruct
Definition: PowerCC26XX.h:554
uint32_t maxStandbyDuration
Time in system ticks that specifies the maximum duration the device may spend in standby.
Definition: PowerCC26XX.h:476
bool enablePolicy
Boolean specifying if the Power Policy function is enabled.
Definition: PowerCC26XX.h:519
int32_t nCtrimFractNew
Definition: PowerCC26XX.h:559
Power_PolicyFxn policyFxn
The Power Policy function.
Definition: PowerCC26XX.h:437
bool initialized
Definition: PowerCC26XX.h:572
int32_t nRtrimNew
Definition: PowerCC26XX.h:560
int32_t nCtrimNew
Definition: PowerCC26XX.h:558
void PowerCC26XX_schedulerDisable(void)
ClockP_Handle PowerCC26XX_getClockHandle(void)
Get the handle of the Clock object used for scheduling device wakeups.
void(* Power_PolicyFxn)(void)
Power policy function pointer.
Definition: Power.h:406
uint32_t state
Definition: PowerCC26XX.h:564
bool busyCal
Definition: PowerCC26XX.h:568
void PowerCC26XX_standbyPolicy(void)
The STANDBY Power Policy.
void PowerCC26XX_switchXOSC_HF(void)
Switch the HF clock source to XOSC_HF.
bool calibrateRCOSC_HF
Boolean specifying whether the high frequency RC oscillator (RCOSC_HF) should be calibrated.
Definition: PowerCC26XX.h:537
Power_PolicyFxn policyFxn
Definition: PowerCC26XX.h:582
uint32_t PowerCC26XX_getXoscStartupTime(uint32_t timeUntilWakeupInMs)
Get the estimated HF crystal oscillator (XOSC_HF) startup delay, for a given delay from now...
int32_t nCtrimCurr
Definition: PowerCC26XX.h:556
PowerCC26XX_ModuleState.
Definition: PowerCC26XX.h:546
uint8_t calStep
Definition: PowerCC26XX.h:569
ClockP_Struct calClockStruct
Definition: PowerCC26XX.h:553
Global configuration structure.
Definition: PowerCC26XX.h:407
bool PowerCC26XX_injectCalibration(void)
Explicitly trigger RC oscillator calibration.
int32_t nCtrimFractCurr
Definition: PowerCC26XX.h:557
int32_t nDeltaFreqCurr
Definition: PowerCC26XX.h:555
bool PowerCC26XX_noCalibrate(unsigned int arg)
Function to specify when RCOSC calibration is to be disabled.
bool firstLF
Definition: PowerCC26XX.h:570
int32_t nRtrimCurr
Definition: PowerCC26XX.h:561
ClockP_Struct xoscClockObj
Definition: PowerCC26XX.h:551
ClockP_Struct clockObj
Definition: PowerCC26XX.h:550
bool enablePolicy
Definition: PowerCC26XX.h:571
Hardware Interrupt module for the RTOS Porting Interface.
ClockP_Struct lfClockObj
Definition: PowerCC26XX.h:552
void PowerCC26XX_schedulerRestore(void)
uint8_t hwiState
Definition: PowerCC26XX.h:567
List_List notifyList
Definition: PowerCC26XX.h:548
void * ClockP_Handle
Opaque client reference to an instance of a ClockP.
Definition: ClockP.h:112
bool PowerCC26XX_isStableXOSC_HF(void)
Check if the XOSC_HF is stable and ready to be switched to.
© Copyright 1995-2023, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale