PowerCC26XX.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2018, 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 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 
59 #include <ti/drivers/dpl/HwiP.h>
60 #include <ti/drivers/dpl/ClockP.h>
61 #include <ti/drivers/Power.h>
62 
63 /* \cond */
64 typedef uint8_t PowerCC26XX_Resource; /* Resource identifier */
65 /* \endcond */
66 
68 #define PowerCC26XX_RESUMETIMESTANDBY 750
69 
71 #define PowerCC26XX_TOTALTIMESTANDBY 1000
72 
74 #define PowerCC26XX_WAKEDELAYSTANDBY 240
75 
77 #define PowerCC26XX_INITIALWAITRCOSC_LF 1000
78 
80 #define PowerCC26XX_RETRYWAITRCOSC_LF 1000
81 
83 #define PowerCC26XX_INITIALWAITXOSC_HF 50
84 
86 #define PowerCC26XX_RETRYWAITXOSC_HF 50
87 
89 #define PowerCC26XX_INITIALWAITXOSC_LF 10000
90 
92 #define PowerCC26XX_RETRYWAITXOSC_LF 5000
93 
94 /* resource IDs */
95 #define PowerCC26XX_PERIPH_GPT0 0
96 
98 #define PowerCC26XX_PERIPH_GPT1 1
99 
101 #define PowerCC26XX_PERIPH_GPT2 2
102 
104 #define PowerCC26XX_PERIPH_GPT3 3
105 
107 #define PowerCC26XX_PERIPH_SSI0 4
108 
110 #define PowerCC26XX_PERIPH_SSI1 5
111 
113 #define PowerCC26XX_PERIPH_UART0 6
115 #define PowerCC26XX_PERIPH_I2C0 7
117 #define PowerCC26XX_PERIPH_TRNG 8
118 
120 #define PowerCC26XX_PERIPH_GPIO 9
122 #define PowerCC26XX_PERIPH_UDMA 10
124 #define PowerCC26XX_PERIPH_CRYPTO 11
126 #define PowerCC26XX_PERIPH_I2S 12
128 #define PowerCC26XX_PERIPH_RFCORE 13
130 #define PowerCC26XX_XOSC_HF 14
131 
133 #define PowerCC26XX_DOMAIN_PERIPH 15
134 
136 #define PowerCC26XX_DOMAIN_SERIAL 16
137 
139 #define PowerCC26XX_DOMAIN_RFCORE 17
140 
142 #define PowerCC26XX_DOMAIN_SYSBUS 18
143 
145 /* \cond */
146 #define PowerCC26XX_NUMRESOURCES 19 /* Number of resources in database */
147 /* \endcond */
148 
149 /* \cond */
150 /* resource record bitmasks */
151 #define PowerCC26XX_PERIPH 0x80 /* resource is a peripheral */
152 #define PowerCC26XX_SPECIAL 0x40 /* resource requires special handler */
153 #define PowerCC26XX_DOMAIN 0x00 /* resource is a domain */
154 #define PowerCC26XX_PARENTMASK 0x3F /* parent resource mask */
155 #define PowerCC26XX_NOPARENT 0x3F /* if resource has no parent */
156 /* \endcond */
157 
158 #define PowerCC26XX_STANDBY 0x1
159 /* \cond */
160 /* internal flags for enabling/disabling resources */
161 #define PowerCC26XX_ENABLE 1
162 #define PowerCC26XX_DISABLE 0
163 /* \endcond */
164 
165 /* constraints */
166 #define PowerCC26XX_RETAIN_VIMS_CACHE_IN_STANDBY 0
167 
169 #define PowerCC26XX_DISALLOW_SHUTDOWN 1
170 
172 #define PowerCC26XX_DISALLOW_STANDBY 2
173 
175 #define PowerCC26XX_DISALLOW_IDLE 3
176 
178 #define PowerCC26XX_NEED_FLASH_IN_IDLE 4
179 
181 #define PowerCC26XX_SWITCH_XOSC_HF_MANUALLY 5
182 
194 #define PowerCC26XX_DISALLOW_XOSC_HF_SWITCHING 6
195 
203 /* \cond */
204 #define PowerCC26XX_NUMCONSTRAINTS 7 /* Number of constraints supported */
205 /* \endcond */
206 
207 /* \cond */
208 /* Deprecated constraint names */
209 #define PowerCC26XX_SD_DISALLOW PowerCC26XX_DISALLOW_SHUTDOWN
210 #define PowerCC26XX_SB_DISALLOW PowerCC26XX_DISALLOW_STANDBY
211 #define PowerCC26XX_IDLE_PD_DISALLOW PowerCC26XX_DISALLOW_IDLE
212 #define PowerCC26XX_XOSC_HF_SWITCHING_DISALLOW PowerCC26XX_DISALLOW_XOSC_HF_SWITCHING
213 #define PowerCC26XX_SB_VIMS_CACHE_RETAIN PowerCC26XX_RETAIN_VIMS_CACHE_IN_STANDBY
214 /* \endcond */
215 
216 /*
217  * Events
218  *
219  * Each event must be a power of two and must be sequential
220  * without any gaps.
221  */
222 #define PowerCC26XX_ENTERING_STANDBY 0x1
223 
225 #define PowerCC26XX_ENTERING_SHUTDOWN 0x2
226 
228 #define PowerCC26XX_AWAKE_STANDBY 0x4
229 
231 #define PowerCC26XX_AWAKE_STANDBY_LATE 0x8
232 
234 #define PowerCC26XX_XOSC_HF_SWITCHED 0x10
235 
237 #define PowerCC26XX_JTAG_PD_TURNED_ON 0x20
238 
307 /* \cond */
308 #define PowerCC26XX_NUMEVENTS 6 /* Number of events supported */
309 /* \endcond */
310 
311 /* \cond */
312 /*
313  * Calibration stages
314  */
315 #define PowerCC26XX_SETUP_CALIBRATE 1
316 #define PowerCC26XX_INITIATE_CALIBRATE 2
317 #define PowerCC26XX_DO_CALIBRATE 3
318 /* \endcond */
319 
320 /* \cond */
322 typedef struct PowerCC26XX_ResourceRecord {
323  uint8_t flags; /* resource type | first parent */
324  uint16_t driverlibID; /* corresponding driverlib ID for this resource */
325 } PowerCC26XX_ResourceRecord;
326 /* \endcond */
327 
329 typedef struct PowerCC26XX_Config {
370  bool (*calibrateFxn)(unsigned int);
460 
467 typedef struct PowerCC26XX_ModuleState {
469  uint32_t constraintMask;
470  ClockP_Struct clockObj;
471  ClockP_Struct xoscClockObj;
472  ClockP_Struct lfClockObj;
473  ClockP_Struct calClockStruct;
474  HwiP_Struct hwiStruct;
475  int32_t nDeltaFreqCurr;
476  int32_t nCtrimCurr;
477  int32_t nCtrimFractCurr;
478  int32_t nCtrimNew;
479  int32_t nCtrimFractNew;
480  int32_t nRtrimNew;
481  int32_t nRtrimCurr;
482  int32_t nDeltaFreqNew;
483  bool bRefine;
484  uint32_t state;
485  bool xoscPending;
486  bool calLF;
487  uint8_t hwiState;
488  bool busyCal;
489  uint8_t calStep;
490  bool firstLF;
492  bool initialized;
493 #if defined(DeviceFamily_CC26X0R2)
494  bool emulatorAttached;
495 #endif
496  uint8_t constraintCounts[PowerCC26XX_NUMCONSTRAINTS];
498  uint8_t resourceCounts[PowerCC26XX_NUMRESOURCES];
500  unsigned int (*resourceHandlers[3])(unsigned int);
504 
516 bool PowerCC26XX_calibrate(unsigned int arg);
517 
528 void PowerCC26XX_doWFI(void);
529 
541 ClockP_Handle PowerCC26XX_getClockHandle(void);
542 
553 uint32_t PowerCC26XX_getXoscStartupTime(uint32_t timeUntilWakeupInMs);
554 
566 
583 bool PowerCC26XX_noCalibrate(unsigned int arg);
584 
597 bool PowerCC26XX_isStableXOSC_HF(void);
598 
613 void PowerCC26XX_switchXOSC_HF(void);
614 
638 void PowerCC26XX_standbyPolicy(void);
639 
642 
643 #define Power_getPerformanceLevel(void) 0
644 #define Power_setPerformanceLevel(level) Power_EFAIL
645 
646 #ifdef __cplusplus
647 }
648 #endif
649 
650 #endif /* POWER_CC26XX_ */
bool calLF
Definition: PowerCC26XX.h:486
void PowerCC26XX_doWFI(void)
The Wait for interrupt (WFI) policy.
int32_t nDeltaFreqNew
Definition: PowerCC26XX.h:482
bool xoscPending
Definition: PowerCC26XX.h:485
struct PowerCC26XX_Config PowerCC26XX_Config
Global configuration structure.
bool bRefine
Definition: PowerCC26XX.h:483
bool PowerCC26XX_calibrate(unsigned int arg)
The RC Oscillator (RCOSC) calibration function.
Definition: List.h:131
uint32_t constraintMask
Definition: PowerCC26XX.h:469
bool calibrateRCOSC_LF
Boolean specifying whether the low frequency RC oscillator (RCOSC_LF) should be calibrated.
Definition: PowerCC26XX.h:449
struct PowerCC26XX_ModuleState PowerCC26XX_ModuleState
PowerCC26XX_ModuleState.
bool enableMaxStandbyDuration
Boolean that enables limiting the duration spent in standby.
Definition: PowerCC26XX.h:427
Power_PolicyInitFxn policyInitFxn
The Power Policy&#39;s initialization function.
Definition: PowerCC26XX.h:336
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:414
Power Manager.
HwiP_Struct hwiStruct
Definition: PowerCC26XX.h:474
uint32_t maxStandbyDuration
Time in system ticks that specifies the maximum duration the device may spend in standby.
Definition: PowerCC26XX.h:397
bool enablePolicy
Boolean specifying if the Power Policy function is enabled.
Definition: PowerCC26XX.h:440
int32_t nCtrimFractNew
Definition: PowerCC26XX.h:479
Power_PolicyFxn policyFxn
The Power Policy function.
Definition: PowerCC26XX.h:358
bool initialized
Definition: PowerCC26XX.h:492
int32_t nRtrimNew
Definition: PowerCC26XX.h:480
int32_t nCtrimNew
Definition: PowerCC26XX.h:478
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:484
bool busyCal
Definition: PowerCC26XX.h:488
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:458
Power_PolicyFxn policyFxn
Definition: PowerCC26XX.h:502
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:476
PowerCC26XX_ModuleState.
Definition: PowerCC26XX.h:467
uint8_t calStep
Definition: PowerCC26XX.h:489
ClockP_Struct calClockStruct
Definition: PowerCC26XX.h:473
Global configuration structure.
Definition: PowerCC26XX.h:329
bool PowerCC26XX_injectCalibration(void)
Explicitly trigger RC oscillator calibration.
int32_t nCtrimFractCurr
Definition: PowerCC26XX.h:477
int32_t nDeltaFreqCurr
Definition: PowerCC26XX.h:475
bool PowerCC26XX_noCalibrate(unsigned int arg)
Function to specify when RCOSC calibration is to be disabled.
bool firstLF
Definition: PowerCC26XX.h:490
int32_t nRtrimCurr
Definition: PowerCC26XX.h:481
ClockP_Struct xoscClockObj
Definition: PowerCC26XX.h:471
ClockP_Struct clockObj
Definition: PowerCC26XX.h:470
bool enablePolicy
Definition: PowerCC26XX.h:491
ClockP_Struct lfClockObj
Definition: PowerCC26XX.h:472
void PowerCC26XX_schedulerRestore(void)
uint8_t hwiState
Definition: PowerCC26XX.h:487
List_List notifyList
Definition: PowerCC26XX.h:468
bool PowerCC26XX_isStableXOSC_HF(void)
Check if the XOSC_HF is stable and ready to be switched to.
© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale