TI-RTOS Drivers  tidrivers_cc32xx_2_16_00_08
PowerCC3200.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015, 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  */
75 #ifndef ti_drivers_power_PowerCC3200__include
76 #define ti_drivers_power_PowerCC3200__include
77 
78 #include <stdint.h>
79 #include <ti/drivers/utils/List.h>
80 #include <ti/drivers/Power.h>
81 
82 /* driverlib header files */
83 #include <inc/hw_types.h>
84 #include <driverlib/pin.h>
85 #include <driverlib/rom_map.h>
86 
87 #ifdef __cplusplus
88 extern "C" {
89 #endif
90 
91 /* values were gathered from a logic analyzer and rounded up */
93 #define PowerCC3200_RESUMETIMELPDS 2500
94 
96 #define PowerCC3200_TOTALTIMELPDS 20000
97 
99 #define PowerCC3200_TOTALTIMESHUTDOWN 500000
100 
101 /* Power resources */
102 #define PowerCC3200_PERIPH_CAMERA 0
103 #define PowerCC3200_PERIPH_I2S 1
104 #define PowerCC3200_PERIPH_SDHOST 2
105 #define PowerCC3200_PERIPH_GSPI 3
106 #define PowerCC3200_PERIPH_LSPI 4
107 #define PowerCC3200_PERIPH_UDMA 5
108 #define PowerCC3200_PERIPH_GPIOA0 6
109 #define PowerCC3200_PERIPH_GPIOA1 7
110 #define PowerCC3200_PERIPH_GPIOA2 8
111 #define PowerCC3200_PERIPH_GPIOA3 9
112 #define PowerCC3200_PERIPH_GPIOA4 10
113 #define PowerCC3200_PERIPH_WDT 11
114 #define PowerCC3200_PERIPH_UARTA0 12
115 #define PowerCC3200_PERIPH_UARTA1 13
116 #define PowerCC3200_PERIPH_TIMERA0 14
117 #define PowerCC3200_PERIPH_TIMERA1 15
118 #define PowerCC3200_PERIPH_TIMERA2 16
119 #define PowerCC3200_PERIPH_TIMERA3 17
120 #define PowerCC3200_PERIPH_DTHE 18
121 #define PowerCC3200_PERIPH_SSPI 19
122 #define PowerCC3200_PERIPH_I2CA0 20
123 #define PowerCC3200_NUMRESOURCES 21
124 
125 /*
126  * Power constraints on the CC3200 device
127  */
128 #define PowerCC3200_DISALLOW_LPDS 0
129 #define PowerCC3200_DISALLOW_SHUTDOWN 1
130 #define PowerCC3200_NUMCONSTRAINTS 2
132 /*
133  * Power events on the CC3200 device
134  *
135  * Each event must be a power of two and must be sequential
136  * without any gaps.
137  */
138 #define PowerCC3200_ENTERING_LPDS 0x1
139 #define PowerCC3200_ENTERING_SHUTDOWN 0x2
140 #define PowerCC3200_AWAKE_LPDS 0x4
141 #define PowerCC3200_NUMEVENTS 3
143 /* Power sleep states */
144 #define PowerCC3200_LPDS 0x1
146 /* Use by NVIC Register structure */
147 #define PowerCC3200_numNVICSetEnableRegs 6
148 #define PowerCC3200_numNVICIntPriority 49
149 
151 typedef struct PowerCC3200_Config {
157  void (*enterLPDSHookFxn)(void);
164  void (*resumeLPDSHookFxn)(void);
224 
226 typedef struct PowerCC3200_ModuleState {
228  uint32_t constraintMask;
229  uint32_t state;
236 
239  uint32_t vectorTable;
240  uint32_t auxCtrl;
241  uint32_t intCtrlState;
242  uint32_t appInt;
243  uint32_t sysCtrl;
244  uint32_t configCtrl;
245  uint32_t sysPri1;
246  uint32_t sysPri2;
247  uint32_t sysPri3;
248  uint32_t sysHcrs;
249  uint32_t systickCtrl;
250  uint32_t systickReload;
251  uint32_t systickCalib;
255 
257 typedef struct PowerCC3200_MCURegisters {
258  uint32_t msp;
259  uint32_t psp;
260  uint32_t psr;
261  uint32_t primask;
262  uint32_t faultmask;
263  uint32_t basepri;
264  uint32_t control;
266 
272 
274 typedef enum {
275  PowerCC3200_NO_PULL_HIZ = PIN_TYPE_STD,
276  PowerCC3200_WEAK_PULL_UP_STD = PIN_TYPE_STD_PU,
281 
283 typedef enum {
317 
319 typedef struct PowerCC3200_Wakeup {
328 
341 
343 void PowerCC3200_initPolicy(void);
344 
347 
349 void PowerCC3200_sleepPolicy(void);
350 
351 #define Power_getPerformanceLevel(void) 0
352 #define Power_setPerformanceLevel(level) Power_EFAIL
353 
354 #ifdef __cplusplus
355 }
356 #endif
357 
358 #endif /* ti_drivers_power_PowerCC3200__include */
struct PowerCC3200_SaveRegisters PowerCC3200_SaveRegisters
struct of context registers to save on entering LPDS
struct PowerCC3200_ModuleState PowerCC3200_ModuleState
Internal module state.
uint32_t configCtrl
Definition: PowerCC3200.h:244
bool enableNetworkWakeupLPDS
Definition: PowerCC3200.h:322
uint32_t msp
Definition: PowerCC3200.h:258
void PowerCC3200_configureWakeup(PowerCC3200_Wakeup *wakeup)
Function configures wakeup for LPDS and shutdown.
uint32_t control
Definition: PowerCC3200.h:264
Definition: PowerCC3200.h:304
Internal module state.
Definition: PowerCC3200.h:226
Definition: PowerCC3200.h:279
Definition: PowerCC3200.h:293
NVIC registers that need to be save on entering LPDS.
Definition: PowerCC3200.h:238
MCU core registers that need to be save on entering LPDS.
Definition: PowerCC3200.h:257
uint8_t refCount[PowerCC3200_NUMRESOURCES]
Definition: PowerCC3200.h:233
uint32_t wakeupGPIOTypeShutdown
The GPIO trigger type for wakeup from shutdown.
Definition: PowerCC3200.h:214
Definition: PowerCC3200.h:298
Power_PolicyInitFxn policyInitFxn
Definition: PowerCC3200.h:153
Definition: List.h:131
bool enableNetworkWakeupLPDS
Definition: PowerCC3200.h:172
bool enableGPIOWakeupShutdown
Definition: PowerCC3200.h:170
#define PowerCC3200_numNVICSetEnableRegs
Definition: PowerCC3200.h:147
uint32_t primask
Definition: PowerCC3200.h:261
uint32_t wakeupGPIOTypeLPDS
Definition: PowerCC3200.h:324
Definition: PowerCC3200.h:277
uint32_t wakeupGPIOSourceShutdown
Definition: PowerCC3200.h:325
struct of context registers to save on entering LPDS
Definition: PowerCC3200.h:268
uint32_t intSetEn[PowerCC3200_numNVICSetEnableRegs]
Definition: PowerCC3200.h:252
uint32_t wakeupGPIOTypeShutdown
Definition: PowerCC3200.h:326
uint32_t systickCalib
Definition: PowerCC3200.h:251
uint32_t wakeupGPIOTypeLPDS
The GPIO trigger type for wakeup from LPDS.
Definition: PowerCC3200.h:193
Definition: PowerCC3200.h:275
void(* Power_PolicyInitFxn)(void)
Power policy initialization function pointer.
Definition: Power.h:91
Power manager interface.
Definition: PowerCC3200.h:302
uint32_t intCtrlState
Definition: PowerCC3200.h:241
uint32_t wakeupGPIOSourceShutdown
The GPIO sources for wakeup from shutdown.
Definition: PowerCC3200.h:206
Power_PolicyFxn policyFxn
Definition: PowerCC3200.h:155
uint32_t sysPri2
Definition: PowerCC3200.h:246
Definition: PowerCC3200.h:285
Definition: PowerCC3200.h:310
Definition: PowerCC3200.h:284
uint16_t dbRecords[PowerCC3200_NUMRESOURCES]
Definition: PowerCC3200.h:230
uint32_t vectorTable
Definition: PowerCC3200.h:239
Definition: PowerCC3200.h:312
void(* enterLPDSHookFxn)(void)
Definition: PowerCC3200.h:157
Definition: PowerCC3200.h:306
Definition: PowerCC3200.h:295
#define PowerCC3200_NUMRESOURCES
Definition: PowerCC3200.h:123
Definition: PowerCC3200.h:315
uint32_t sysPri1
Definition: PowerCC3200.h:245
uint32_t basepri
Definition: PowerCC3200.h:263
void PowerCC3200_sleepPolicy(void)
Definition: PowerCC3200.h:297
uint32_t sysHcrs
Definition: PowerCC3200.h:248
uint32_t appInt
Definition: PowerCC3200.h:242
void(* Power_PolicyFxn)(void)
Power policy function pointer.
Definition: Power.h:96
bool enablePolicy
Definition: PowerCC3200.h:231
Definition: PowerCC3200.h:309
Definition: PowerCC3200.h:276
Definition: PowerCC3200.h:305
uint8_t constraintCounts[PowerCC3200_NUMCONSTRAINTS]
Definition: PowerCC3200.h:234
uint32_t systickReload
Definition: PowerCC3200.h:250
Definition: PowerCC3200.h:287
struct PowerCC3200_NVICRegisters PowerCC3200_NVICRegisters
NVIC registers that need to be save on entering LPDS.
bool enableGPIOWakeupLPDS
Definition: PowerCC3200.h:168
Definition: PowerCC3200.h:299
Definition: PowerCC3200.h:313
Definition: PowerCC3200.h:289
uint32_t psr
Definition: PowerCC3200.h:260
Definition: PowerCC3200.h:286
#define PowerCC3200_numNVICIntPriority
Definition: PowerCC3200.h:148
Definition: PowerCC3200.h:278
List_List notifyList
Definition: PowerCC3200.h:227
uint32_t psp
Definition: PowerCC3200.h:259
PowerCC3200_Pin
enumeration of pins that can be parked
Definition: PowerCC3200.h:283
Definition: PowerCC3200.h:300
uint32_t wakeupGPIOSourceLPDS
The GPIO source for wakeup from LPDS.
Definition: PowerCC3200.h:185
void PowerCC3200_initPolicy(void)
PowerCC3200_ParkState
enumeration of states for parked pins
Definition: PowerCC3200.h:274
Definition: PowerCC3200.h:307
#define PowerCC3200_NUMCONSTRAINTS
Definition: PowerCC3200.h:130
Definition: PowerCC3200.h:290
struct PowerCC3200_MCURegisters PowerCC3200_MCURegisters
MCU core registers that need to be save on entering LPDS.
Definition: PowerCC3200.h:294
struct PowerCC3200_Config PowerCC3200_Config
Power global configuration.
PowerCC3200_MCURegisters m4Regs
Definition: PowerCC3200.h:269
uint32_t wakeupGPIOSourceLPDS
Definition: PowerCC3200.h:323
void PowerCC3200_parkPin(PowerCC3200_Pin pin, PowerCC3200_ParkState parkState)
struct PowerCC3200_Wakeup PowerCC3200_Wakeup
For wakeup from LPDS or shutdown configuration.
uint32_t systickCtrl
Definition: PowerCC3200.h:249
uint32_t state
Definition: PowerCC3200.h:229
bool enableGPIOWakeupShutdown
Definition: PowerCC3200.h:321
uint32_t auxCtrl
Definition: PowerCC3200.h:240
Definition: PowerCC3200.h:308
uint32_t constraintMask
Definition: PowerCC3200.h:228
Definition: PowerCC3200.h:314
Definition: PowerCC3200.h:311
void(* resumeLPDSHookFxn)(void)
Hook function called when resuming from LPDS.
Definition: PowerCC3200.h:164
Definition: PowerCC3200.h:301
Definition: PowerCC3200.h:288
bool enableGPIOWakeupLPDS
Definition: PowerCC3200.h:320
bool enablePolicy
Definition: PowerCC3200.h:166
Definition: PowerCC3200.h:296
PowerCC3200_NVICRegisters nvicRegs
Definition: PowerCC3200.h:270
uint32_t faultmask
Definition: PowerCC3200.h:262
uint32_t intPriority[PowerCC3200_numNVICIntPriority]
Definition: PowerCC3200.h:253
bool initialized
Definition: PowerCC3200.h:232
Definition: PowerCC3200.h:303
For wakeup from LPDS or shutdown configuration.
Definition: PowerCC3200.h:319
uint32_t sysPri3
Definition: PowerCC3200.h:247
Power global configuration.
Definition: PowerCC3200.h:151
uint32_t ramRetentionMaskLPDS
SRAM retention mask for LPDS.
Definition: PowerCC3200.h:222
Definition: PowerCC3200.h:292
Linked List interface for use in drivers.
Definition: PowerCC3200.h:291
uint32_t sysCtrl
Definition: PowerCC3200.h:243
Copyright 2016, Texas Instruments Incorporated