• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** \file ScanCncnDrvSM.h
2  *  \brief This file include definitions for the scan concentrator Driver SM module.
3  *  \author Ronen Kalish
4  *  \date 02-Jan-2005
5  */
6  /****************************************************************************
7 **+-----------------------------------------------------------------------+**
8 **|                                                                       |**
9 **| Copyright(c) 1998 - 2008 Texas Instruments. All rights reserved.      |**
10 **| All rights reserved.                                                  |**
11 **|                                                                       |**
12 **| Redistribution and use in source and binary forms, with or without    |**
13 **| modification, are permitted provided that the following conditions    |**
14 **| are met:                                                              |**
15 **|                                                                       |**
16 **|  * Redistributions of source code must retain the above copyright     |**
17 **|    notice, this list of conditions and the following disclaimer.      |**
18 **|  * Redistributions in binary form must reproduce the above copyright  |**
19 **|    notice, this list of conditions and the following disclaimer in    |**
20 **|    the documentation and/or other materials provided with the         |**
21 **|    distribution.                                                      |**
22 **|  * Neither the name Texas Instruments nor the names of its            |**
23 **|    contributors may be used to endorse or promote products derived    |**
24 **|    from this software without specific prior written permission.      |**
25 **|                                                                       |**
26 **| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   |**
27 **| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     |**
28 **| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |**
29 **| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  |**
30 **| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |**
31 **| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT      |**
32 **| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |**
33 **| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |**
34 **| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   |**
35 **| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |**
36 **| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  |**
37 **|                                                                       |**
38 **+-----------------------------------------------------------------------+**
39 ****************************************************************************/
40 
41 #ifndef __SCANCNCNDRVSM_H__
42 #define __SCANCNCNDRVSM_H__
43 
44 #include "osApi.h"
45 #include "ScanCncn.h"
46 #include "fsm.h"
47 
48 /*
49  ***********************************************************************
50  *	Constant definitions.
51  ***********************************************************************
52  */
53 
54 /*
55  ***********************************************************************
56  *	Enums.
57  ***********************************************************************
58  */
59 
60 /** \enum scan_drvSMEvents_e
61  * \brief enumerates the different driver scan SM events
62  */
63 typedef enum
64 {
65     DRV_SCAN_EVENT_START_SCAN = 0,
66     DRV_SCAN_EVENT_SCR_PEND,
67     DRV_SCAN_EVENT_SCR_REJECT,
68     DRV_SCAN_EVENT_PASSIVE_SCAN,
69     DRV_SCAN_EVENT_ACTIVE_SCAN,
70     DRV_SCAN_EVENT_ABORT_SCAN,
71     DRV_SCAN_EVENT_FW_RESET,
72     DRV_SCAN_EVENT_STOP_SCAN,
73     DRV_SCAN_EVENT_SCAN_COMPLETE,
74     DRV_SCAN_NUM_OF_EVENTS
75 } scan_drvSMEvents_e;
76 
77 /** \enum scan_drvSMEvents_e
78  * \brief enumerates the different driver scan SM states
79  */
80 typedef enum
81 {
82     DRV_SCAN_STATE_IDLE = 0,
83     DRV_SCAN_STATE_SCR_REQUEST,
84     DRV_SCAN_STATE_SCR_WAIT,
85     DRV_SCAN_STATE_PASSIVE_SCANNING,
86     DRV_SCAN_STATE_ACTIVE_SCANNING,
87     DRV_SCAN_STATE_STOPPING,
88     DRV_SCAN_NUM_OF_STATES
89 } scan_drvSMStates_e;
90 
91 /*
92  ***********************************************************************
93  *	Typedefs.
94  ***********************************************************************
95  */
96 
97 /*
98  ***********************************************************************
99  *	Structure definitions.
100  ***********************************************************************
101  */
102 
103 /*
104  ***********************************************************************
105  *	External data definitions.
106  ***********************************************************************
107  */
108 
109 /*
110  ***********************************************************************
111  *	External functions definitions
112  ***********************************************************************
113  */
114 
115 /**
116  * \author Ronen Kalish\n
117  * \date 02-Jan-2005\n
118  * \brief Initialize the scan concentrator driver SM.
119  *
120  * Function Scope \e Public.\n
121  * \param hScanCncn - handle to the scan concentrator object.\n
122  * \return OK if successful, NOK otherwise.\n
123  */
124 TI_STATUS scanConcentratorDrvSM_init( TI_HANDLE hScanCncn );
125 
126 /**
127  * \author Ronen Kalish\n
128  * \date 02-Jan-2005\n
129  * \brief Processes an event.
130  *
131  * Function Scope \e Public.\n
132  * \param hScanCncn - handle to the scan concentrator object.\n
133  * \param currentState - the current driver SM state.\n
134  * \param event - the event to handle.\n
135  * \return OK if successful, NOK otherwise.\n
136  */
137 TI_STATUS scanConcentratorDrvSM_SMEvent( TI_HANDLE hScanCncn, scan_drvSMStates_e* currentState,
138                                          scan_drvSMEvents_e event );
139 
140 /**
141  * \author Ronen Kalish\n
142  * \date 02-Jan-2005\n
143  * \brief SM action - handles a start scan event (by requesting the SCR)
144  *
145  * Function Scope \e Public.\n
146  * \param hScanCncn - handle to the scan concentrator object.\n
147  * \return OK if successful, NOK otherwise.\n
148  */
149 TI_STATUS scanConcentratorDrvSM_requestSCR( TI_HANDLE hScanCncn );
150 
151 /**
152  * \author Ronen Kalish\n
153  * \date 02-Jan-2005\n
154  * \brief SM action - handles a FW reset event (by calling the complete CB)
155  *
156  * Function Scope \e Public.\n
157  * \param hScanCncn - handle to the scan concentrator object.\n
158  * \return OK if successful, NOK otherwise.\n
159  */
160 TI_STATUS scanConcentratorDrvSM_callCompleteCB( TI_HANDLE hScanCncn );
161 
162 /**
163  * \author Ronen Kalish\n
164  * \date 02-Jan-2005\n
165  * \brief SM action - handles a passive scan event (by starting a passive scan)
166  *
167  * Function Scope \e Public.\n
168  * \param hScanCncn - handle to the scan concentrator object.\n
169  * \return OK if successful, NOK otherwise.\n
170  */
171 TI_STATUS scanConcentratorDrvSM_passiveScan( TI_HANDLE hScanCncn );
172 
173 /**
174  * \author Ronen Kalish\n
175  * \date 02-Jan-2005\n
176  * \brief SM action - handles an active scan event (by starting an active scan)
177  *
178  * Function Scope \e Public.\n
179  * \param hScanCncn - handle to the scan concentrator object.\n
180  * \return OK if successful, NOK otherwise.\n
181  */
182 TI_STATUS scanConcentratorDrvSM_activeScan( TI_HANDLE hScanCncn );
183 
184 /**
185  * \author Ronen Kalish\n
186  * \date 02-Jan-2005\n
187  * \brief SM action - handles an abort scan or stop scan event (by stopping the actual scan)
188  *
189  * Function Scope \e Public.\n
190  * \param hScanCncn - handle to the scan concentrator object.\n
191  * \return OK if successful, NOK otherwise.\n
192  */
193 TI_STATUS scanConcentratorDrvSM_abortScan( TI_HANDLE hScanCncn );
194 
195 /**
196  * \author Ronen Kalish\n
197  * \date 10-July-2005\n
198  * \brief SM action - handles a recovery event (calls the scan SRV abort on FW reset and than finishes scan)
199  *
200  * Function Scope \e Public.\n
201  * \param hScanCncn - handle to the scan concentrator object.\n
202  * \return OK if successful, NOK otherwise.\n
203  */
204 TI_STATUS scanConcentratorDrvSM_recoveryDuringScan( TI_HANDLE hScanCncn );
205 
206 /**
207  * \author Ronen Kalish\n
208  * \date 02-Jan-2005\n
209  * \brief SM action - handles a scan complete event (by releasing the SCR and calling the scan complete CB)
210  *
211  * Function Scope \e Public.\n
212  * \param hScanCncn - handle to the scan concentrator object.\n
213  * \return OK if successful, NOK otherwise.\n
214  */
215 TI_STATUS scanConcentratorDrvSM_scanComplete( TI_HANDLE hScanCncn );
216 
217 /**
218  * \author Ronen Kalish\n
219  * \date 02-Jan-2005\n
220  * \brief SM action - handles a scan reject event (abort scan before scan acrually started)\n
221  *
222  * Function Scope \e Public.\n
223  * \param hScanCncn - handle to the scan concentrator object.\n
224  * \return OK if successful, NOK otherwise.\n
225  */
226 TI_STATUS scanConcentratorDrvSM_scanRejected( TI_HANDLE hScanCncn );
227 
228 /**
229  * \author Ronen Kalish\n
230  * \date 09-Jan-2005\n
231  * \brief Determines the next event to send to the driver SM (when a scan can be run)\n
232  *
233  * Function Scope \e Private.\n
234  * \param hScanCncn - handle to the scan concentrator object.\n
235  * \return the next event to use with the driver SM.\n
236  */
237 scan_drvSMEvents_e scanConcentrator_getNextDriverEvent( TI_HANDLE hScanCncn );
238 
239 /**
240  * \author Ronen Kalish\n
241  * \date 07-Feb-2005\n
242  * \brief Handles an error during scan operation
243  *
244  * Function Scope \e Private.\n
245  * \param hScanCncn - handle to the scan concentrator object.\n
246  */
247 void scanConcentratorDrvSM_handleScanError( TI_HANDLE hScanCncn );
248 
249 #endif /* __SCANCNCNDRVSM_H__ */
250 
251