PowerCC26XX.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2022, 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 CONSEQueueNTIAL 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 #ifdef __cplusplus
62 extern "C" {
63 #endif
64 
65 /* \cond */
66 typedef uint8_t PowerCC26XX_Resource; /* Resource identifier */
67 /* \endcond */
68 
70 #define PowerCC26XX_RESUMETIMESTANDBY 750
71 
73 #define PowerCC26XX_TOTALTIMESTANDBY 1000
74 
76 #define PowerCC26XX_WAKEDELAYSTANDBY 240
77 
79 #define PowerCC26XX_INITIALWAITRCOSC_LF 1000
80 
82 #define PowerCC26XX_RETRYWAITRCOSC_LF 1000
83 
85 #define PowerCC26XX_INITIALWAITXOSC_HF 50
86 
88 #define PowerCC26XX_RETRYWAITXOSC_HF 50
89 
91 #define PowerCC26XX_INITIALWAITXOSC_LF 10000
92 
94 #define PowerCC26XX_RETRYWAITXOSC_LF 5000
95 
96 /* resource IDs */
97 #define PowerCC26XX_PERIPH_GPT0 0
98 
100 #define PowerCC26XX_PERIPH_GPT1 1
101 
103 #define PowerCC26XX_PERIPH_GPT2 2
104 
106 #define PowerCC26XX_PERIPH_GPT3 3
107 
109 #define PowerCC26XX_PERIPH_SSI0 4
110 
112 #define PowerCC26XX_PERIPH_UART0 5
114 #define PowerCC26XX_PERIPH_I2C0 6
116 #define PowerCC26XX_PERIPH_TRNG 7
117 
119 #define PowerCC26XX_PERIPH_GPIO 8
121 #define PowerCC26XX_PERIPH_UDMA 9
123 #define PowerCC26XX_PERIPH_CRYPTO 10
125 #define PowerCC26XX_PERIPH_I2S 11
127 #define PowerCC26XX_PERIPH_RFCORE 12
129 #define PowerCC26XX_XOSC_HF 13
130 
132 #define PowerCC26XX_DOMAIN_PERIPH 14
133 
135 #define PowerCC26XX_DOMAIN_SERIAL 15
136 
138 #define PowerCC26XX_DOMAIN_RFCORE 16
139 
141 #define PowerCC26XX_DOMAIN_SYSBUS 17
142 
144 /* The PKA and UART1 peripherals are not available on CC13X1 and CC26X1 devices */
145 #if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X2_CC26X2 || \
146  DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X4_CC26X3_CC26X4)
147 
149 #define PowerCC26XX_PERIPH_PKA 18
150 
152 #define PowerCC26XX_PERIPH_UART1 19
153 
155 #define PowerCC26XX_PERIPH_SSI1 20
156 
157 #endif
158 
159 /* The peripherals below are only available on CC13X4 and CC26X4 devices */
160 #if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X4_CC26X3_CC26X4)
161 
163 #define PowerCC26XX_PERIPH_UART2 21
164 
166 #define PowerCC26XX_PERIPH_UART3 22
167 
169 #define PowerCC26XX_PERIPH_SSI2 23
170 
172 #define PowerCC26XX_PERIPH_SSI3 24
173 
175 #define PowerCC26XX_PERIPH_I2C1 25
176 
177 #endif
178 
179 /* \cond */
180 #if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X0_CC26X0)
181 #define PowerCC26XX_NUMRESOURCES 19 /* Number of resources in database */
182 #elif (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X1_CC26X1)
183 #define PowerCC26XX_NUMRESOURCES 19 /* Number of resources in database */
184 #elif (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X2_CC26X2)
185 #define PowerCC26XX_NUMRESOURCES 21 /* Number of resources in database */
186 #elif (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X4_CC26X3_CC26X4)
187 #define PowerCC26XX_NUMRESOURCES 26 /* Number of resources in database */
188 #endif
189 /* \endcond */
190 
191 /* \cond */
192 /* resource record bitmasks */
193 #define PowerCC26XX_PERIPH 0x80 /* resource is a peripheral */
194 #define PowerCC26XX_SPECIAL 0x40 /* resource requires special handler */
195 #define PowerCC26XX_DOMAIN 0x00 /* resource is a domain */
196 #define PowerCC26XX_PARENTMASK 0x3F /* parent resource mask */
197 #define PowerCC26XX_NOPARENT 0x3F /* if resource has no parent */
198 /* \endcond */
199 
200 #define PowerCC26XX_STANDBY 0x1
201 /* \cond */
202 /* internal flags for enabling/disabling resources */
203 #define PowerCC26XX_ENABLE 1
204 #define PowerCC26XX_DISABLE 0
205 /* \endcond */
206 
207 /* constraints */
208 #define PowerCC26XX_RETAIN_VIMS_CACHE_IN_STANDBY 0
209 
211 #define PowerCC26XX_DISALLOW_SHUTDOWN 1
212 
214 #define PowerCC26XX_DISALLOW_STANDBY 2
215 
217 #define PowerCC26XX_DISALLOW_IDLE 3
218 
220 #define PowerCC26XX_NEED_FLASH_IN_IDLE 4
221 
223 #define PowerCC26XX_SWITCH_XOSC_HF_MANUALLY 5
224 
236 #define PowerCC26XX_DISALLOW_XOSC_HF_SWITCHING 6
237 
245 /* \cond */
246 #define PowerCC26XX_NUMCONSTRAINTS 7 /* Number of constraints supported */
247 /* \endcond */
248 
249 /* \cond */
250 /* Deprecated constraint names */
251 #define PowerCC26XX_SD_DISALLOW PowerCC26XX_DISALLOW_SHUTDOWN
252 #define PowerCC26XX_SB_DISALLOW PowerCC26XX_DISALLOW_STANDBY
253 #define PowerCC26XX_IDLE_PD_DISALLOW PowerCC26XX_DISALLOW_IDLE
254 #define PowerCC26XX_XOSC_HF_SWITCHING_DISALLOW PowerCC26XX_DISALLOW_XOSC_HF_SWITCHING
255 #define PowerCC26XX_SB_VIMS_CACHE_RETAIN PowerCC26XX_RETAIN_VIMS_CACHE_IN_STANDBY
256 /* \endcond */
257 
258 /*
259  * Events
260  *
261  * Each event must be a power of two and must be sequential
262  * without any gaps.
263  */
264 #define PowerCC26XX_ENTERING_STANDBY 0x1
265 
267 #define PowerCC26XX_ENTERING_SHUTDOWN 0x2
268 
270 #define PowerCC26XX_AWAKE_STANDBY 0x4
271 
273 #define PowerCC26XX_AWAKE_STANDBY_LATE 0x8
274 
276 #define PowerCC26XX_XOSC_HF_SWITCHED 0x10
277 
279 #define PowerCC26XX_JTAG_PD_TURNED_ON 0x20
280 
349 /* \cond */
350 #define PowerCC26XX_NUMEVENTS 6 /* Number of events supported */
351 /* \endcond */
352 
353 /* \cond */
354 /*
355  * Calibration stages
356  */
357 #define PowerCC26XX_SETUP_CALIBRATE 1
358 #define PowerCC26XX_INITIATE_CALIBRATE 2
359 #define PowerCC26XX_DO_CALIBRATE 3
360 /* \endcond */
361 
362 /* \cond */
364 typedef struct {
365  uint8_t flags; /* resource type | first parent */
366  uint16_t driverlibID; /* corresponding driverlib ID for this resource */
367 } PowerCC26XX_ResourceRecord;
368 /* \endcond */
369 
371 typedef struct {
412  bool (*calibrateFxn)(unsigned int arg);
502 
509 typedef struct {
511  uint32_t constraintMask;
512  ClockP_Struct clockObj;
513  ClockP_Struct xoscClockObj;
514  ClockP_Struct lfClockObj;
515  ClockP_Struct calClockStruct;
516  HwiP_Struct hwiStruct;
517  int32_t nDeltaFreqCurr;
518  int32_t nCtrimCurr;
519  int32_t nCtrimFractCurr;
520  int32_t nCtrimNew;
521  int32_t nCtrimFractNew;
522  int32_t nRtrimNew;
523  int32_t nRtrimCurr;
524  int32_t nDeltaFreqNew;
525  bool bRefine;
526  uint32_t state;
527  bool xoscPending;
528  bool calLF;
529  uint8_t hwiState;
530  bool busyCal;
531  uint8_t calStep;
532  bool firstLF;
534  bool initialized;
535 #if defined(DeviceFamily_CC26X0R2)
536  bool emulatorAttached;
537 #endif
538  uint8_t constraintCounts[PowerCC26XX_NUMCONSTRAINTS];
540  uint8_t resourceCounts[PowerCC26XX_NUMRESOURCES];
542  unsigned int (*resourceHandlers[3])(unsigned int arg);
546 
558 bool PowerCC26XX_calibrate(unsigned int arg);
559 
570 void PowerCC26XX_doWFI(void);
571 
583 ClockP_Handle PowerCC26XX_getClockHandle(void);
584 
595 uint32_t PowerCC26XX_getXoscStartupTime(uint32_t timeUntilWakeupInMs);
596 
612 
629 bool PowerCC26XX_noCalibrate(unsigned int arg);
630 
643 bool PowerCC26XX_isStableXOSC_HF(void);
644 
659 void PowerCC26XX_switchXOSC_HF(void);
660 
684 void PowerCC26XX_standbyPolicy(void);
685 
688 
689 #define Power_getPerformanceLevel(void) 0
690 #define Power_setPerformanceLevel(level) Power_EFAIL
691 
692 #ifdef __cplusplus
693 }
694 #endif
695 
696 #endif /* POWER_CC26XX_ */
bool calLF
Definition: PowerCC26XX.h:528
void PowerCC26XX_doWFI(void)
The Wait for interrupt (WFI) policy.
int32_t nDeltaFreqNew
Definition: PowerCC26XX.h:524
bool xoscPending
Definition: PowerCC26XX.h:527
bool bRefine
Definition: PowerCC26XX.h:525
bool PowerCC26XX_calibrate(unsigned int arg)
The RC Oscillator (RCOSC) calibration function.
Definition: List.h:131
uint32_t constraintMask
Definition: PowerCC26XX.h:511
bool calibrateRCOSC_LF
Boolean specifying whether the low frequency RC oscillator (RCOSC_LF) should be calibrated.
Definition: PowerCC26XX.h:491
bool enableMaxStandbyDuration
Boolean that enables limiting the duration spent in standby.
Definition: PowerCC26XX.h:469
Power_PolicyInitFxn policyInitFxn
The Power Policy&#39;s initialization function.
Definition: PowerCC26XX.h:378
void(* Power_PolicyInitFxn)(void)
Power policy initialization function pointer.
Definition: Power.h:402
uint16_t vddrRechargeMargin
Margin in SCLK_LF periods subtracted from previous longest VDDR recharge period.
Definition: PowerCC26XX.h:456
Power Manager.
HwiP_Struct hwiStruct
Definition: PowerCC26XX.h:516
uint32_t maxStandbyDuration
Time in system ticks that specifies the maximum duration the device may spend in standby.
Definition: PowerCC26XX.h:439
bool enablePolicy
Boolean specifying if the Power Policy function is enabled.
Definition: PowerCC26XX.h:482
int32_t nCtrimFractNew
Definition: PowerCC26XX.h:521
Power_PolicyFxn policyFxn
The Power Policy function.
Definition: PowerCC26XX.h:400
bool initialized
Definition: PowerCC26XX.h:534
int32_t nRtrimNew
Definition: PowerCC26XX.h:522
int32_t nCtrimNew
Definition: PowerCC26XX.h:520
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:407
uint32_t state
Definition: PowerCC26XX.h:526
bool busyCal
Definition: PowerCC26XX.h:530
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:500
Power_PolicyFxn policyFxn
Definition: PowerCC26XX.h:544
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:518
PowerCC26XX_ModuleState.
Definition: PowerCC26XX.h:509
uint8_t calStep
Definition: PowerCC26XX.h:531
ClockP_Struct calClockStruct
Definition: PowerCC26XX.h:515
Global configuration structure.
Definition: PowerCC26XX.h:371
bool PowerCC26XX_injectCalibration(void)
Explicitly trigger RC oscillator calibration.
int32_t nCtrimFractCurr
Definition: PowerCC26XX.h:519
int32_t nDeltaFreqCurr
Definition: PowerCC26XX.h:517
bool PowerCC26XX_noCalibrate(unsigned int arg)
Function to specify when RCOSC calibration is to be disabled.
bool firstLF
Definition: PowerCC26XX.h:532
int32_t nRtrimCurr
Definition: PowerCC26XX.h:523
ClockP_Struct xoscClockObj
Definition: PowerCC26XX.h:513
ClockP_Struct clockObj
Definition: PowerCC26XX.h:512
bool enablePolicy
Definition: PowerCC26XX.h:533
ClockP_Struct lfClockObj
Definition: PowerCC26XX.h:514
void PowerCC26XX_schedulerRestore(void)
uint8_t hwiState
Definition: PowerCC26XX.h:529
List_List notifyList
Definition: PowerCC26XX.h:510
bool PowerCC26XX_isStableXOSC_HF(void)
Check if the XOSC_HF is stable and ready to be switched to.
© Copyright 1995-2022, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale