1 /* 2 * ScanSrvSM.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 ScanSrvSM.h 35 * \brief This file include definitions for the scan SRV SM module. 36 * \author Ronen Kalish 37 * \date 10-Jan-2005 38 */ 39 40 #ifndef __SCANSRVSM_H__ 41 #define __SCANSRVSM_H__ 42 43 #include "fsm.h" 44 45 /* 46 *********************************************************************** 47 * Constant definitions. 48 *********************************************************************** 49 */ 50 51 /* 52 *********************************************************************** 53 * Enums. 54 *********************************************************************** 55 */ 56 57 /** \enum scan_SRVSMEvents_e 58 * \brief enumerates the different scan SRV SM events 59 */ 60 typedef enum 61 { 62 SCAN_SRV_EVENT_REQUEST_PS = 0, 63 SCAN_SRV_EVENT_PS_FAIL, 64 SCAN_SRV_EVENT_PS_SUCCESS, 65 SCAN_SRV_EVENT_PS_PEND, 66 SCAN_SRV_EVENT_STOP_SCAN, 67 SCAN_SRV_EVENT_FW_RESET, 68 SCAN_SRV_EVENT_TIMER_EXPIRED, 69 SCAN_SRV_EVENT_SCAN_COMPLETE, 70 SCAN_SRV_NUM_OF_EVENTS 71 } scan_SRVSMEvents_e; 72 73 /** \enum scan_SRVSMStates_e 74 * \brief enumerates the different scan SRV SM states 75 */ 76 typedef enum 77 { 78 SCAN_SRV_STATE_IDLE = 0, 79 SCAN_SRV_STATE_PS_WAIT, 80 SCAN_SRV_STATE_SCANNING, 81 SCAN_SRV_STATE_STOPPING, 82 SCAN_SRV_STATE_PS_EXIT, 83 SCAN_SRV_NUM_OF_STATES 84 } scan_SRVSMStates_e; 85 86 /* 87 *********************************************************************** 88 * Typedefs. 89 *********************************************************************** 90 */ 91 92 /* 93 *********************************************************************** 94 * Structure definitions. 95 *********************************************************************** 96 */ 97 98 /* 99 *********************************************************************** 100 * External data definitions. 101 *********************************************************************** 102 */ 103 104 /* 105 *********************************************************************** 106 * External functions definitions 107 *********************************************************************** 108 */ 109 110 /** 111 * \author Ronen Kalish\n 112 * \date 10-Jan-2005\n 113 * \brief Initialize the scan SRV SM. 114 * 115 * Function Scope \e Public.\n 116 * \param hScanSrv - handle to the scan SRV object.\n 117 * \return TI_OK if successful, TI_NOK otherwise.\n 118 */ 119 TI_STATUS scanSRVSM_init( TI_HANDLE hScanSrv ); 120 121 /** 122 * \author Ronen Kalish\n 123 * \date 10-Jan-2005\n 124 * \brief Processes an event. 125 * 126 * Function Scope \e Public.\n 127 * \param hScanSrv - handle to the scan SRV object.\n 128 * \param currentState - the current scan SRV SM state.\n 129 * \param event - the event to handle.\n 130 * \return TI_OK if successful, TI_NOK otherwise.\n 131 */ 132 TI_STATUS scanSRVSM_SMEvent( TI_HANDLE hScanSrv, scan_SRVSMStates_e* currentState, 133 scan_SRVSMEvents_e event ); 134 135 /** 136 * \author Ronen Kalish\n 137 * \date 10-Jan-2005\n 138 * \brief Request to enter driver mode from the power manager module.\n 139 * 140 * Function Scope \e Private.\n 141 * \param hScanSrv - handle to the scan SRV object.\n 142 * \return TI_OK if successful, TI_NOK otherwise.\n 143 */ 144 TI_STATUS scanSRVSM_requestPS( TI_HANDLE hScanSrv ); 145 146 /** 147 * \author Yuval Adler\n 148 * \date 6-Oct-2005\n 149 * \brief Request to release PS mode from the PowerSRV , and wait for answer.\n 150 * 151 * Function Scope \e Private.\n 152 * \param hScanSrv - handle to the scan SRV object.\n 153 * \return TI_OK if successful, TI_NOK otherwise.\n 154 */ 155 TI_STATUS scanSRVSM_releasePS( TI_HANDLE hScanSrv ); 156 157 /** 158 * \author Ronen Kalish\n 159 * \date 10-Jan-2005\n 160 * \brief Send the scan command to the firmware.\n 161 * 162 * Function Scope \e Private.\n 163 * \param hScanSrv - handle to the scan SRV object.\n 164 * \return TI_OK if successful, TI_NOK otherwise.\n 165 */ 166 TI_STATUS scanSRVSM_startActualScan( TI_HANDLE hScanSrv ); 167 168 /** 169 * \author Ronen Kalish\n 170 * \date 10-Jan-2005\n 171 * \brief Send a stop scan command to the firmware.\n 172 * 173 * Function Scope \e Private.\n 174 * \param hScanSrv - handle to the scan SRV object.\n 175 * \return TI_OK if successful, TI_NOK otherwise.\n 176 */ 177 TI_STATUS scanSRVSM_stopActualScan( TI_HANDLE hScanSrv ); 178 179 /** 180 * \author Ronen Kalish\n 181 * \date 10-Jan-2005\n 182 * \brief Notifies scan complete to upper layer.\n 183 * 184 * Function Scope \e Private.\n 185 * \param hScanSrv - handle to the scan SRV object.\n 186 * \return TI_OK if successful, TI_NOK otherwise.\n 187 */ 188 TI_STATUS scanSRVSM_notifyScanComplete( TI_HANDLE hScanSrv ); 189 190 /** 191 * \author Ronen Kalish\n 192 * \date 10-Jan-2005\n 193 * \brief Handles a timer expiry event - starts a recovery process. 194 * 195 * Function Scope \e Private.\n 196 * \param hScanSrv - handle to the scan SRV object.\n 197 * \return TI_OK if successful, TI_NOK otherwise.\n 198 */ 199 TI_STATUS scanSRVSM_handleTimerExpiry( TI_HANDLE hScanSrv ); 200 201 /** 202 * \author Ronen Kalish\n 203 * \date 17-Jan-2005\n 204 * \brief Handles a FW reset event (one that was detected outside the scan SRV) by stopping the timer. 205 * 206 * Function Scope \e Private.\n 207 * \param hScanSrv - handle to the scan SRV object.\n 208 * \return TI_OK if successful, TI_NOK otherwise.\n 209 */ 210 TI_STATUS scanSRVSM_handleRecovery( TI_HANDLE hScanSrv ); 211 212 #endif /* __SCANSRVSM_H__ */ 213