TI-RTOS for SimpleLink Wireless MCUs  2.14.02.22
Power.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  */
55 #ifndef ti_drivers_Power__include
56 #define ti_drivers_Power__include
57 
58 #include <stdint.h>
59 #include <ti/drivers/utils/List.h>
60 
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64 
65 /* Power latency types */
66 #define Power_TOTAL 1
67 #define Power_RESUME 2
69 /* Power notify responses */
70 #define Power_NOTIFYDONE 0
71 #define Power_NOTIFYERROR 1
73 /* Power status */
74 #define Power_SOK 0
75 #define Power_EFAIL 1
76 #define Power_EINVALIDPOINTER 2
77 #define Power_ECHANGE_NOT_ALLOWED 3
78 #define Power_EBUSY 4
80 /* Power transition states */
81 #define Power_ACTIVE 1
82 #define Power_ENTERING_SLEEP 2
83 #define Power_EXITING_SLEEP 3
84 #define Power_ENTERING_SHUTDOWN 4
85 #define Power_CHANGING_PERF_LEVEL 5
91 typedef void (*Power_PolicyInitFxn)(void);
92 
96 typedef void (*Power_PolicyFxn)(void);
97 
101 typedef int (*Power_NotifyFxn)(unsigned int eventType, uintptr_t eventArg,
102  uintptr_t clientArg);
103 
112 typedef struct Power_NotifyObj {
113  List_Elem link;
114  unsigned int eventTypes;
116  uintptr_t clientArg;
118 
138 void Power_enablePolicy(void);
139 
162 unsigned int Power_getConstraintMask(void);
163 
180 unsigned int Power_getDependencyCount(unsigned int resourceId);
181 
194 unsigned int Power_getPerformanceLevel(void);
195 
217 uint32_t Power_getTransitionLatency(unsigned int sleepState, unsigned int type);
218 
230 unsigned int Power_getTransitionState(void);
231 
242 void Power_idleFunc(void);
243 
252 void Power_init(void);
253 
313 unsigned int Power_registerNotify(Power_NotifyObj *pNotifyObj,
314  unsigned int eventTypes,
315  Power_NotifyFxn notifyFxn,
316  uintptr_t clientArg);
317 
344 void Power_releaseConstraint(unsigned int constraintId);
345 
360 void Power_releaseDependency(unsigned int resourceId);
361 
381 void Power_setConstraint(unsigned int constraintId);
382 
410 void Power_setDependency(unsigned int resourceId);
411 
446 unsigned int Power_setPerformanceLevel(unsigned int level);
447 
489 unsigned int Power_shutdown(unsigned int shutdownState, uint32_t shutdownTime);
490 
510 unsigned int Power_sleep(unsigned int sleepState);
511 
523 void Power_unregisterNotify(Power_NotifyObj *pNotifyObj);
524 
525 #ifdef __cplusplus
526 }
527 #endif
528 
529 #endif /* ti_drivers_Power__include */
int(* Power_NotifyFxn)(unsigned int eventType, uintptr_t eventArg, uintptr_t clientArg)
Power notify function pointer.
Definition: Power.h:101
void Power_releaseDependency(unsigned int resourceId)
Release a previously declared dependency.
unsigned int Power_setPerformanceLevel(unsigned int level)
Set the MCU performance level.
void Power_releaseConstraint(unsigned int constraintId)
Release a previously declared constraint.
unsigned int Power_sleep(unsigned int sleepState)
Transition the device into a sleep state.
Power_NotifyFxn notifyFxn
Definition: Power.h:115
unsigned int eventTypes
Definition: Power.h:114
unsigned int Power_getPerformanceLevel(void)
Get the current performance level.
void(* Power_PolicyFxn)(void)
Power policy function pointer.
Definition: Power.h:96
uintptr_t clientArg
Definition: Power.h:116
unsigned int Power_getDependencyCount(unsigned int resourceId)
Get the current dependency count for a resource.
Power notify object structure.
Definition: Power.h:112
void Power_setConstraint(unsigned int constraintId)
Declare an operational constraint.
void Power_init(void)
Power initialization function.
void Power_unregisterNotify(Power_NotifyObj *pNotifyObj)
Unregister previously registered notifications.
struct Power_NotifyObj Power_NotifyObj
Power notify object structure.
List_Elem link
Definition: Power.h:113
void Power_enablePolicy(void)
Enable the configured power policy to run when the CPU is idle.
unsigned int Power_getTransitionState(void)
Get the current transition state of the Power manager.
uint32_t Power_getTransitionLatency(unsigned int sleepState, unsigned int type)
Get the hardware transition latency for a sleep state.
void Power_idleFunc(void)
Power function to be added to the application idle loop.
void Power_setDependency(unsigned int resourceId)
Declare a dependency upon a resource.
unsigned int Power_shutdown(unsigned int shutdownState, uint32_t shutdownTime)
Put the device into a shutdown state.
unsigned int Power_getConstraintMask(void)
Get the constraints that have been declared with Power.
unsigned int Power_registerNotify(Power_NotifyObj *pNotifyObj, unsigned int eventTypes, Power_NotifyFxn notifyFxn, uintptr_t clientArg)
Register a function to be called upon a specific power event.
Copyright 2015, Texas Instruments Incorporated