PowerCC32XX.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2020, 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  */
59 #ifndef ti_drivers_power_PowerCC32XX__include
60 #define ti_drivers_power_PowerCC32XX__include
61 
62 #include <stdint.h>
63 #include <ti/drivers/utils/List.h>
64 #include <ti/drivers/Power.h>
65 
66 /* driverlib header files */
67 #include <ti/devices/cc32xx/inc/hw_types.h>
68 #include <ti/devices/cc32xx/driverlib/rom.h>
69 #include <ti/devices/cc32xx/driverlib/rom_map.h>
70 #include <ti/devices/cc32xx/driverlib/pin.h>
71 
72 #ifdef __cplusplus
73 extern "C" {
74 #endif
75 
76 /* latency values were measured with a logic analyzer, and rounded up */
77 
79 #define PowerCC32XX_RESUMETIMELPDS 2500
80 
82 #define PowerCC32XX_TOTALTIMELPDS 20000
83 
85 #define PowerCC32XX_TOTALTIMESHUTDOWN 500000
86 
87 /* Power resources */
88 #define PowerCC32XX_PERIPH_CAMERA 0
89 
91 #define PowerCC32XX_PERIPH_I2S 1
92 
94 #define PowerCC32XX_PERIPH_SDHOST 2
95 
97 #define PowerCC32XX_PERIPH_GSPI 3
98 
100 #define PowerCC32XX_PERIPH_LSPI 4
101 
103 #define PowerCC32XX_PERIPH_UDMA 5
104 
106 #define PowerCC32XX_PERIPH_GPIOA0 6
107 
109 #define PowerCC32XX_PERIPH_GPIOA1 7
110 
112 #define PowerCC32XX_PERIPH_GPIOA2 8
113 
115 #define PowerCC32XX_PERIPH_GPIOA3 9
116 
118 #define PowerCC32XX_PERIPH_GPIOA4 10
119 
121 #define PowerCC32XX_PERIPH_WDT 11
122 
124 #define PowerCC32XX_PERIPH_UARTA0 12
125 
127 #define PowerCC32XX_PERIPH_UARTA1 13
128 
130 #define PowerCC32XX_PERIPH_TIMERA0 14
131 
133 #define PowerCC32XX_PERIPH_TIMERA1 15
134 
136 #define PowerCC32XX_PERIPH_TIMERA2 16
137 
139 #define PowerCC32XX_PERIPH_TIMERA3 17
140 
142 #define PowerCC32XX_PERIPH_DTHE 18
143 
145 #define PowerCC32XX_PERIPH_SSPI 19
146 
148 #define PowerCC32XX_PERIPH_I2CA0 20
149 
151 /* \cond */
152 #define PowerCC32XX_NUMRESOURCES 21 /* Number of resources in database */
153 /* \endcond */
154 
155 /*
156  * Power constraints on the CC32XX device
157  */
158 #define PowerCC32XX_DISALLOW_LPDS 0
159 
161 #define PowerCC32XX_DISALLOW_SHUTDOWN 1
162 
164 /* \cond */
165 #define PowerCC32XX_NUMCONSTRAINTS 2
166 /* \endcond */
167 
168 /*
169  * Power events on the CC32XX device
170  *
171  * Each event must be a power of two, and the event IDs must be sequential
172  * without any gaps.
173  */
174 #define PowerCC32XX_ENTERING_LPDS 0x1
175 
177 #define PowerCC32XX_ENTERING_SHUTDOWN 0x2
178 
180 #define PowerCC32XX_AWAKE_LPDS 0x4
181 
183 /* \cond */
184 #define PowerCC32XX_NUMEVENTS 3
185 /* \endcond */
186 
187 /* Power sleep states */
188 #define PowerCC32XX_LPDS 0x1
190 /* \cond */
191 /* Use by NVIC Register structure */
192 #define PowerCC32XX_numNVICSetEnableRegs 6
193 #define PowerCC32XX_numNVICIntPriority 49
194 /* \endcond */
195 
196 /* \cond */
197 /* Number of pins that can be parked in LPDS */
198 #define PowerCC32XX_NUMPINS 34
199 /* \endcond */
200 
202 typedef struct
203 {
204  uint32_t pin;
206  uint32_t parkState;
209 
211 typedef struct
212 {
223  void (*enterLPDSHookFxn)(void);
230  void (*resumeLPDSHookFxn)(void);
277  void (*wakeupGPIOFxnLPDS)(uint_least8_t argument);
281  uint_least8_t wakeupGPIOFxnLPDSArg;
335  uint32_t numPins;
343  uint32_t latencyForLPDS;
345 
350 typedef struct
351 {
352  uint32_t vectorTable;
353  uint32_t auxCtrl;
354  uint32_t intCtrlState;
355  uint32_t appInt;
356  uint32_t sysCtrl;
357  uint32_t configCtrl;
358  uint32_t sysPri1;
359  uint32_t sysPri2;
360  uint32_t sysPri3;
361  uint32_t sysHcrs;
362  uint32_t systickCtrl;
363  uint32_t systickReload;
364  uint32_t systickCalib;
365  uint32_t intSetEn[PowerCC32XX_numNVICSetEnableRegs];
366  uint32_t intPriority[PowerCC32XX_numNVICIntPriority];
367 } PowerCC32XX_NVICRegisters;
374 typedef struct
375 {
376  uint32_t msp;
377  uint32_t psp;
378  uint32_t psr;
379  uint32_t primask;
380  uint32_t faultmask;
381  uint32_t basepri;
382  uint32_t control;
383 } PowerCC32XX_MCURegisters;
390 typedef struct
391 {
392  PowerCC32XX_MCURegisters m4Regs;
393  PowerCC32XX_NVICRegisters nvicRegs;
394 } PowerCC32XX_SaveRegisters;
398 typedef enum
399 {
401  PowerCC32XX_NO_PULL_HIZ = PIN_TYPE_STD,
403  PowerCC32XX_WEAK_PULL_UP_STD = PIN_TYPE_STD_PU,
417 
419 typedef enum
420 {
490 
499 typedef struct
500 {
545  void (*wakeupGPIOFxnLPDS)(uint_least8_t argument);
549  uint_least8_t wakeupGPIOFxnLPDSArg;
569 
574 typedef struct
575 {
576  List_List notifyList;
577  uint32_t constraintMask;
578  uint32_t state;
579  uint16_t dbRecords[PowerCC32XX_NUMRESOURCES];
580  bool enablePolicy;
581  bool initialized;
582  uint8_t refCount[PowerCC32XX_NUMRESOURCES];
583  uint8_t constraintCounts[PowerCC32XX_NUMCONSTRAINTS];
584  Power_PolicyFxn policyFxn;
585  uint32_t pinType[PowerCC32XX_NUMPINS];
586  uint16_t pinDir[PowerCC32XX_NUMPINS];
587  uint8_t pinMode[PowerCC32XX_NUMPINS];
588  uint16_t stateAntPin29;
589  uint16_t stateAntPin30;
590  uint32_t pinLockMask;
591  PowerCC32XX_Wakeup wakeupConfig;
592 } PowerCC32XX_ModuleState;
606 
608 void PowerCC32XX_initPolicy(void);
609 
619 
621 PowerCC32XX_ParkState PowerCC32XX_getParkState(PowerCC32XX_Pin pin);
622 
624 void PowerCC32XX_restoreParkState(PowerCC32XX_Pin pin, PowerCC32XX_ParkState state);
625 
627 void PowerCC32XX_setParkState(PowerCC32XX_Pin pin, uint32_t level);
628 
645 void PowerCC32XX_disableIORetention(unsigned long groupFlags);
646 
657 void PowerCC32XX_sleepPolicy(void);
658 
674 int_fast16_t PowerCC32XX_reset(uint_fast16_t resourceId);
675 
676 /* \cond */
677 #define Power_getPerformanceLevel(void) 0
678 #define Power_setPerformanceLevel(level) Power_EFAIL
679 /* \endcond */
680 
681 #ifdef __cplusplus
682 }
683 #endif
684 
685 #endif /* ti_drivers_power_PowerCC32XX__include */
Definition: PowerCC32XX.h:448
Definition: PowerCC32XX.h:424
Definition: PowerCC32XX.h:430
Definition: PowerCC32XX.h:460
Definition: PowerCC32XX.h:476
void PowerCC32XX_configureWakeup(PowerCC32XX_Wakeup *wakeup)
Function configures wakeup for LPDS and shutdown.
Definition: List.h:132
void PowerCC32XX_getWakeup(PowerCC32XX_Wakeup *wakeup)
Function to get wakeup configuration settings.
bool enableNetworkWakeupLPDS
Definition: PowerCC32XX.h:506
Definition: PowerCC32XX.h:450
uint32_t ramRetentionMaskLPDS
SRAM retention mask for LPDS.
Definition: PowerCC32XX.h:307
Definition: PowerCC32XX.h:426
Definition: PowerCC32XX.h:413
Definition: PowerCC32XX.h:462
Definition: PowerCC32XX.h:488
PowerCC32XX_ParkInfo * pinParkDefs
Pointer to an array of pins to be parked during LPDS.
Definition: PowerCC32XX.h:331
Definition: PowerCC32XX.h:436
PowerCC32XX_ParkState PowerCC32XX_getParkState(PowerCC32XX_Pin pin)
Definition: PowerCC32XX.h:409
bool enableNetworkWakeupLPDS
Definition: PowerCC32XX.h:238
bool enableGPIOWakeupLPDS
Definition: PowerCC32XX.h:502
void(* Power_PolicyInitFxn)(void)
Power policy initialization function pointer.
Definition: Power.h:402
bool enableGPIOWakeupLPDS
Definition: PowerCC32XX.h:234
Definition: PowerCC32XX.h:480
Power Manager.
Definition: PowerCC32XX.h:466
Definition: PowerCC32XX.h:468
Definition: PowerCC32XX.h:403
Specify the wakeup sources for LPDS and Shutdown.
Definition: PowerCC32XX.h:499
bool enablePolicy
Definition: PowerCC32XX.h:232
Definition: PowerCC32XX.h:470
Definition: PowerCC32XX.h:478
Definition: PowerCC32XX.h:432
uint32_t wakeupGPIOSourceShutdown
The GPIO sources for wakeup from shutdown.
Definition: PowerCC32XX.h:291
uint32_t parkState
Definition: PowerCC32XX.h:206
Definition: PowerCC32XX.h:401
Definition: PowerCC32XX.h:486
uint32_t pin
Definition: PowerCC32XX.h:204
Definition: PowerCC32XX.h:484
Definition: PowerCC32XX.h:405
Definition: PowerCC32XX.h:464
void PowerCC32XX_sleepPolicy(void)
A reference power policy is provided which can transition the MCU from the active state to one of two...
uint32_t wakeupGPIOSourceLPDS
The GPIO source for wakeup from LPDS.
Definition: PowerCC32XX.h:516
uint32_t latencyForLPDS
Latency to reserve for entry to and exit from LPDS, in microseconds.
Definition: PowerCC32XX.h:343
void PowerCC32XX_disableIORetention(unsigned long groupFlags)
Function to disable IO retention and unlock pin groups following exit from Shutdown.
void(* Power_PolicyFxn)(void)
Power policy function pointer.
Definition: Power.h:407
Definition: PowerCC32XX.h:472
Definition: PowerCC32XX.h:434
uint32_t wakeupGPIOTypeShutdown
The GPIO trigger type for wakeup from shutdown.
Definition: PowerCC32XX.h:299
uint32_t wakeupGPIOTypeLPDS
The GPIO trigger type for wakeup from LPDS.
Definition: PowerCC32XX.h:524
Definition: PowerCC32XX.h:440
Definition: PowerCC32XX.h:474
bool keepDebugActiveDuringLPDS
Keep debug interface active during LPDS.
Definition: PowerCC32XX.h:317
Definition: PowerCC32XX.h:411
Used to specify parking of a pin during LPDS.
Definition: PowerCC32XX.h:202
int_fast16_t PowerCC32XX_reset(uint_fast16_t resourceId)
Software reset of a resource.
Power_PolicyFxn policyFxn
Definition: PowerCC32XX.h:216
bool enableGPIOWakeupShutdown
Definition: PowerCC32XX.h:236
void PowerCC32XX_restoreParkState(PowerCC32XX_Pin pin, PowerCC32XX_ParkState state)
PowerCC32XX_Pin
Enumeration of pins that can be parked.
Definition: PowerCC32XX.h:419
uint32_t numPins
Number of pins to be parked during LPDS.
Definition: PowerCC32XX.h:335
Definition: PowerCC32XX.h:452
uint32_t wakeupGPIOSourceShutdown
The GPIO sources for wakeup from shutdown.
Definition: PowerCC32XX.h:559
Definition: PowerCC32XX.h:422
Definition: PowerCC32XX.h:442
void PowerCC32XX_setParkState(PowerCC32XX_Pin pin, uint32_t level)
Definition: PowerCC32XX.h:454
uint32_t wakeupGPIOTypeShutdown
The GPIO trigger type for wakeup from shutdown.
Definition: PowerCC32XX.h:567
Power global configuration.
Definition: PowerCC32XX.h:211
Definition: PowerCC32XX.h:407
Definition: PowerCC32XX.h:444
void PowerCC32XX_initPolicy(void)
Definition: PowerCC32XX.h:482
uint_least8_t wakeupGPIOFxnLPDSArg
The argument to be passed to wakeupGPIOFxnLPDS()
Definition: PowerCC32XX.h:549
Definition: PowerCC32XX.h:458
Definition: PowerCC32XX.h:446
bool enableGPIOWakeupShutdown
Definition: PowerCC32XX.h:504
Definition: PowerCC32XX.h:438
Power_PolicyInitFxn policyInitFxn
Definition: PowerCC32XX.h:214
uint32_t wakeupGPIOSourceLPDS
The GPIO source for wakeup from LPDS.
Definition: PowerCC32XX.h:248
uint_least8_t wakeupGPIOFxnLPDSArg
The argument to be passed to wakeupGPIOFxnLPDS()
Definition: PowerCC32XX.h:281
uint32_t wakeupGPIOTypeLPDS
The GPIO trigger type for wakeup from LPDS.
Definition: PowerCC32XX.h:256
Definition: PowerCC32XX.h:415
uint32_t ioRetentionShutdown
IO retention mask for Shutdown.
Definition: PowerCC32XX.h:325
Definition: PowerCC32XX.h:456
Definition: PowerCC32XX.h:428
Linked List interface for use in drivers.
PowerCC32XX_ParkState
Enumeration of states a pin can be parked in.
Definition: PowerCC32XX.h:398
© Copyright 1995-2023, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale