ISF  1.1
Intelligent Sensing Framework
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines
Include/isf_pm.h
Go to the documentation of this file.
00001 /*
00002  * 
00003  * Copyright (c) 2012, Freescale Semiconductor, Inc.
00004  * 
00005 */
00006 
00007 
00008 /*!
00009  * @file isf_pm.h
00010  * 
00011  * @brief isf_pm.h describes the API definitions, types, and macros for the Intelligent Sensing
00012  * Framework (ISF) Power Manager (PM).
00013  *
00014 */
00015 
00016 #ifndef ISF_PM_H_
00017 #define ISF_PM_H_
00018 
00019 
00020 
00021 // Byte alignment used for structures.
00022 #pragma pack(push)
00023 #pragma pack(1)
00024 
00025 
00026 /*******************
00027 ** Macro Definitions 
00028 */
00029 
00030 
00031 
00032 /**************
00033 ** Enumerations
00034 */
00035 
00036 /*!  
00037  *  @brief ISF power management settings.
00038 */
00039 typedef enum
00040 {
00041 
00042   /*! At the normal power level, the CPU and clocks are active.  */ 
00043   ISF_POWER_NORMAL                   = 1, 
00044 
00045   /*! At the low power level, the CPU stops and the peripheral clocks 
00046    * continue to run at full speed.  The system is awakened by interrupts.
00047    */ 
00048   ISF_POWER_LOW                      = 2,  
00049 
00050   /*! At the very lowest power level, the CPU stops and the internal clocks 
00051    * run at reduced speed.  The system is awakened by interrupts.
00052    */
00053   ISF_POWER_LOWEST                   = 3,  
00054   
00055   /*! At the sleep level, the CPU and clocks are stopped.  The system is 
00056    * awakened by host access to the slave port or the external interrupt pin.
00057    */
00058   ISF_POWER_SLEEP                    = 4
00059   
00060 } pm_power_level_enum;
00061 
00062 
00063 /*********************
00064 ** Struct and Typedefs
00065 */
00066 
00067 /*! @brief Type for the power levels supported by the Power Manager. */  
00068 typedef pm_power_level_enum  power_level_t;
00069 
00070 
00071 /*********************
00072 ** Function Prototypes
00073 */
00074 
00075 
00076 
00077 /*! @brief This API initializes the Power Manager.
00078  *   
00079  *   @details The Power Manager requires a one-time initialization at system
00080  *   startup performed by this API call.  It creates and initializes 
00081  *   internal variables, and installs an interrupt service routine for 
00082  *   the digital frame interrupt.
00083  *
00084  *  @return         ::isf_status_t pm_init() returns a value of type 
00085  *                    ::isf_status_t indicating the status of the 
00086  *                    initialization operation.
00087  *                  
00088  *  @retval         ::ISF_SUCCESS The initialization completes successfully.
00089  *                    
00090  *  @retval         ::ISF_ERR_LIB_INIT The interrupt service routine for the 
00091  *                    FXLC95000 digital frame interrupt could not be installed.
00092  *                            
00093  * @Constraints     None
00094  *                       
00095  *  @Reentrant      No
00096  *                       
00097  *  @Libs           isf_core.lib
00098  *
00099  */
00100 isf_status_t pm_init(void);
00101 
00102 
00103 
00104 /*! @brief This API sets the requested power level for power management.
00105  *
00106  *  @details The Power Manager provides the capability to automatically 
00107  *   control the power mode when the system is idle.  Part of the power 
00108  *   management is an idle task running at the lowest system priority.  
00109  *   When all higher-priority tasks are blocked waiting for events, the 
00110  *   idle task is executed.  In the idle task, the system power state is 
00111  *   set to one of the states described by the ::pm_power_level_enum values
00112  *   as specified as the argument to this API call.
00113  *     
00114  *   The user may retrieves the current power level setting by invoking 
00115  *   ::isf_power_get().
00116  *   
00117  *  @param[in]      aLevel  Power level of type ::power_level_t to set in 
00118  *                    the Power Manager.
00119  *
00120  *  @return         isf_power_set() returns a value of type ::power_level_t 
00121  *                    indicating the aLevel power setting.  If aLevel is 
00122  *                    invalid, then the current power setting is returned.
00123  *
00124  * @Constraints     The following constraints must be observed when using 
00125  *                  this function. If these constraints are not met, this 
00126  *                  API returns an error.
00127  *                  @li pm_init() must be invoked prior to using this function.
00128  *                                   
00129  *  @Reentrant      Yes
00130  *                       
00131  *  @Libs           isf_core.lib
00132  *  
00133  *  @see            isf_power_get(), power_level_t
00134  *
00135  *
00136  */
00137 power_level_t isf_power_set(power_level_t aLevel);
00138 
00139 
00140 /*! @brief This API returns the current power level for power management.
00141  *
00142  *  @details The current power level setting of the Power Manager is returned.
00143  *     
00144  *  @return         isf_power_get() returns a value of type ::power_level_t 
00145  *                    indicating the current power setting.
00146  *
00147  * @Constraints     The following constraints must be observed when using 
00148  *                  this function. If these constraints are not met, this 
00149  *                  API returns an error.
00150  *                  @li pm_init() must be invoked prior to using this function.
00151  *                                              
00152  *  @Reentrant      Yes
00153  *                       
00154  *  @Libs           isf_core.lib
00155  *  
00156  *  @see            isf_power_set(), power_level_t
00157  *
00158  */
00159 power_level_t isf_power_get(void);
00160 
00161 
00162 
00163 
00164 
00165 #pragma pack(pop)
00166 
00167 
00168 
00169 #endif // ISF_PM_H_