1 /* 2 * PowerSrv_API.h 3 * 4 * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 11 * * Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * * Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in 15 * the documentation and/or other materials provided with the 16 * distribution. 17 * * Neither the name Texas Instruments nor the names of its 18 * contributors may be used to endorse or promote products derived 19 * from this software without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34 /** \file powerSrv_API.h 35 * \brief This is the Power Manager module API. 36 * \author Yaron Menashe 37 */ 38 39 /**************************************************************************** 40 * * 41 * MODULE: Power Server * 42 * PURPOSE: Power Server Module API * 43 * * 44 ****************************************************************************/ 45 46 #ifndef _POWER_SRV_API_H_ 47 #define _POWER_SRV_API_H_ 48 49 #include "MacServices_api.h" 50 51 /***************************************************************************** 52 ** Constants ** 53 *****************************************************************************/ 54 55 56 /***************************************************************************** 57 ** Enumerations ** 58 *****************************************************************************/ 59 60 61 62 /***************************************************************************** 63 ** Typedefs ** 64 *****************************************************************************/ 65 /*typedef void (*powerSaveCmdResponseCB_t )(TI_HANDLE cmdResponseHandle,TI_UINT8 MboxStatus);*/ 66 typedef TPowerSaveResponseCb powerSaveCmdResponseCB_t; 67 /*typedef void (*powerSaveCmpltCB_t )(TI_HANDLE powerSaveCmpltHandle,TI_UINT8 PSMode,TI_UINT8 transStatus);*/ 68 typedef TPowerSaveCompleteCb powerSaveCmpltCB_t; 69 /***************************************************************************** 70 ** Structures ** 71 *****************************************************************************/ 72 73 74 75 76 /***************************************************************************** 77 ** External data definitions ** 78 *****************************************************************************/ 79 80 81 /***************************************************************************** 82 ** External functions definitions ** 83 *****************************************************************************/ 84 85 86 /***************************************************************************** 87 ** Public Function prototypes ** 88 *****************************************************************************/ 89 90 91 /** 92 * \author Assaf Azulay 93 * \date 20-Oct-2005\n 94 * \brief Creates the object of the power Server. 95 * 96 * Function Scope \e Public.\n 97 * Parameters:\n 98 * 1) TI_HANDLE - handle to the OS.\n 99 * Return Value: TI_HANDLE - handle to the powerSrv object.\n 100 */ 101 TI_HANDLE powerSrv_create(TI_HANDLE hOs); 102 103 104 /** 105 * \author Assaf Azulay 106 * \date 27-Apr-2005\n 107 * \brief Destroy the object of the power Server. 108 * 109 * Function Scope \e Public.\n 110 * Parameters:\n 111 * 1) TI_HANDLE - handle to the powerSrv object.\n 112 * Return Value: TI_STATUS - TI_OK on success else TI_NOK.\n 113 */ 114 TI_STATUS powerSrv_destroy(TI_HANDLE hPowerSrv); 115 116 117 /** 118 * \author Assaf Azulay 119 * \date 24-Oct-2005\n 120 * \brief Initialization of the powerSrv module. 121 * 122 * Function Scope \e Public.\n 123 * Parameters:\n 124 * 1) TI_HANDLE - handle to the powerSrv object.\n 125 * 3) TI_HANDLE - handle to the Report object.\n 126 * 2) TI_HANDLE - handle to the EventMbox object.\n 127 * 4) TI_HANDLE - handle to the CommandBuilder object.\n 128 * 5) TI_HANDLE - handle to the Timer module object.\n 129 * Return Value: TI_STATUS - TI_OK on success else TI_NOK.\n 130 */ 131 TI_STATUS powerSrv_init (TI_HANDLE hPowerSrv, 132 TI_HANDLE hReport, 133 TI_HANDLE hEventMbox, 134 TI_HANDLE hCmdBld, 135 TI_HANDLE hTimer); 136 137 138 TI_STATUS powerSrv_config(TI_HANDLE hPowerSrv, 139 TPowerSrvInitParams *pPowerSrvInitParams); 140 141 /** 142 * \author Assaf Azulay 143 * \date 24-Oct-2005\n 144 * \brief request PS by User 145 * 146 * Function Scope \e Public.\n 147 * Parameters:\n 148 * 1) hPowerSrv - handle to the PowerSrv object.\n 149 * 2) psMode - Power save/Active request.\n 150 * 3) sendNullDataOnExit - \n 151 * 4) powerSaveCompleteCBObject - handle to the Callback functin module.\n 152 * 5) powerSaveCompleteCB - Calback function - for success/faild notification.\n 153 * 6) powerSavecmdResponseCB - Calback function - for GWSI success/faild notification.\n 154 * Return Value: TI_STATUS - TI_OK / PENDING / TI_NOK.\n 155 * \b Description:\n 156 * This function is a user mode request from the Power Save Server./n 157 * it will create a Request from typ "USER_REQUEST" and will try to perform the user request for PS/Active./n 158 * this will be done in respect of priority to Driver request./n 159 */ 160 TI_STATUS powerSrv_SetPsMode (TI_HANDLE hPowerSrv, 161 E80211PsMode psMode, 162 TI_BOOL sendNullDataOnExit, 163 void * powerSaveCompleteCBObject, 164 powerSaveCmpltCB_t powerSaveCompleteCB, 165 powerSaveCmdResponseCB_t powerSavecmdResponseCB); 166 167 168 /** 169 * \author Assaf Azulay 170 * \date 24-Oct-2005\n 171 * \brief SW configure, use to override the current PowerMode (what ever it will be) to 172 * active/PS combined with awake/power-down. use for temporary change the system policy. 173 * 174 * Function Scope \e Public.\n 175 * Parameters:\n 176 * 1) TI_HANDLE - handle to the powerSrv object.\n 177 * 2) powerSrv_RequestFor_802_11_PS_e - the driver mode obliged to be in 802.11 PS or not change.\n 178 * 3) PowerCtrl_PowerLevel_e - the desired driver power level (allowed: AWAKE or POWER DOWN).\n 179 * 4) TI_HANDLE theObjectHandle - the handle the object that need the PS success/fail notification.\n 180 * 5) ps802_11_NotificationCB_t - the callback function.\n 181 * 6) char* - the clinet name that ask for driver mode.\n 182 * Return Value: TI_STATUS - if success (already in power save) then TI_OK,\n 183 * if pend (wait to ACK form AP for the null data frame) then PENDING\n 184 * if PS isn't enabled then POWER_SAVE_802_11_NOT_ALLOWED\n 185 * else TI_NOK.\n 186 * \b Description:\n 187 * enter in to configuration of the driver that in higher priority from the user.\n 188 * the configuration is:\n 189 * - to enter to802.11 PS or not (if not this isn't a request to get out from 802.11 PS).\n 190 * - to change the HW power level to awake or power-down if not already there. 191 * this is a must request.\n 192 */ 193 TI_STATUS powerSrv_ReservePS (TI_HANDLE hPowerSrv, 194 E80211PsMode psMode, 195 TI_BOOL sendNullDataOnExit, 196 void * powerSaveCBObject, 197 powerSaveCmpltCB_t powerSaveCompleteCB); 198 199 200 /** 201 * \author Assaf Azulay 202 * \date 24-Oct-2005\n 203 * \brief end the temporary change of system policy, and returns to the user system policy. 204 * 205 * Function Scope \e Public.\n 206 * Parameters:\n 207 * 1) TI_HANDLE - handle to the powerSrv object.\n 208 * 2) char* - the clinet name that ask for driver mode.\n 209 * Return Value: TI_STATUS - TI_OK on success else TI_NOK.\n 210 * \b Description:\n 211 * enter in to configuration of the driver that in higher priority from the user.\n 212 * the configuration is:\n 213 * end the user mode configuration (driver mode priority) and returns the user configuration 214 * (user mode priority). 215 */ 216 TI_STATUS powerSrv_ReleasePS( TI_HANDLE hPowerSrv, 217 TI_BOOL sendNullDataOnExit, 218 void * powerSaveCBObject, 219 powerSaveCmpltCB_t powerSaveCompleteCB); 220 221 222 /** 223 * \author Assaf Azulay 224 * \date 24-Oct-2005\n 225 * \brief reflects the actual state of the state machine 226 * 227 * Function Scope \e Public.\n 228 * Parameters:\n 229 * 1) TI_HANDLE - handle to the powerSrv object.\n 230 * Return Value:\n 231 * TI_BOOL - thre is in PS false otherwise.\n 232 */ 233 TI_BOOL powerSrv_getPsStatus(TI_HANDLE hPowerSrv); 234 235 236 /** 237 * \author Assaf Azulay 238 * \date 24-Oct-2005\n 239 * \sets the rate as got from user else sets default value.\n 240 * 241 * Function Scope \e Public.\n 242 * Parameters:\n 243 * 1) TI_HANDLE - handle to the powerSrv object.\n 244 * 2) TI_UINT16 - desierd rate .\n 245 * Return Value:\n 246 * void.\n 247 */ 248 void powerSrv_SetRateModulation(TI_HANDLE hPowerSrv, TI_UINT16 rate); 249 250 251 252 /** 253 * \author Assaf Azulay 254 * \date 9-Mar-2006\n 255 * \brief Registers a failure event callback for scan error notifications. 256 * 257 * Function Scope \e Public.\n 258 * Parameters:\n 259 * - hPowerSrv - handle to the PowerSrv object. 260 * - failureEventCB - the failure event callback function. 261 * - hFailureEventObj - handle to the object passed to the failure event callback function. 262 */ 263 void powerSrvRegisterFailureEventCB( TI_HANDLE hPowerSrv, 264 void * failureEventCB, TI_HANDLE hFailureEventObj ); 265 266 267 /** 268 * \date 03-Jul-2006\n 269 * \return the rate as it was seted by powerSrv_SetRateModulation.\n 270 * 271 * Function Scope \e Public.\n 272 * Parameters:\n 273 * 1) TI_HANDLE - handle to the powerSrv object.\n 274 * Return Value: TI_UINT16 - desierd rate .\n 275 * void.\n 276 */ 277 TI_UINT32 powerSrv_GetRateModulation(TI_HANDLE hPowerSrv); 278 279 TI_STATUS powerSrv_restart( TI_HANDLE hPowerSrv); 280 281 #endif /* _POWER_SRV_API_H_ */ 282