• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** \file	smeSm.h
2  *  \brief SME SM internal header file
3  *
4  *  \see smeSm.c
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 /***************************************************************************/
42 /*																			*/
43 /*	  MODULE:	smeSm.h														*/
44 /*    PURPOSE:	SME SM internal header file									*/
45 /*																			*/
46 /***************************************************************************/
47 #ifndef __SME_SM_H__
48 #define __SME_SM_H__
49 
50 #include "osTIType.h"
51 #include "paramOut.h"
52 #include "paramIn.h"
53 #include "fsm.h"
54 #include "802_11Defs.h"
55 #include "ScanCncnApi.h"
56 
57 #define IBSS_INTER_SCAN_PERIOD			20
58 #define SCAN_ATTAMEPTS_HISTOGRAM_SIZE	8
59 #define SCAN_RESULT_HISTOGRAM_SIZE		16
60 
61 /* SME SM definitions */
62 typedef enum
63 {
64 	SME_SM_STATE_IDLE 				     = 0,
65 	SME_SM_STATE_SCANNING			     = 1,
66 	SME_SM_STATE_SELECTING			     = 2,
67 	SME_SM_STATE_CONNECTING 		     = 3,
68 	SME_SM_STATE_CONNECTED 		  	     = 4,
69 	SME_SM_STATE_DISCONNECTING		     = 5,
70 	SME_SM_STATE_INTER_SCAN		         = 6,
71 	SME_SM_NUM_STATES                    = 7
72 } sme_sm_states_e;
73 
74 
75 typedef enum
76 {
77 	SME_SM_EVENT_START						= 0,
78 	SME_SM_EVENT_STOP						= 1,
79 	SME_SM_EVENT_SCAN_COMPLETE			    = 2,
80 	SME_SM_EVENT_SELECT_SUCCESS				= 3,
81 	SME_SM_EVENT_SELECT_FAILURE				= 4,
82 	SME_SM_EVENT_CONN_SUCCESS				= 5,
83 	SME_SM_EVENT_CONN_FAILURE				= 6,
84 	SME_SM_EVENT_RESELECT					= 7,
85 	SME_SM_EVENT_DISCONNECT					= 8,
86 	SME_SM_NUM_EVENTS                       = 9
87 } sme_sm_events_e;
88 
89 
90 typedef struct
91 {
92 	mgmtStatus_e			mgmtStatus;		/* Contains the last DisAssociation reason towards upper layer					*/
93 	UINT32					uStatusCode;	/* Extra information to the reason. i.e. packet status code or roaming trigger  */
94 } DisAssocReason_t;
95 
96 typedef struct
97 {
98 	BOOL				RadioStandByEnable;
99 	radioStandByState_t	lastRadioStandByState;
100 	UINT16				radioStandByBitNumber;
101 	BOOL				GPIO13_debug;
102 } sme_radioDisableParameters_t;
103 
104 #ifdef TI_DBG
105 typedef struct
106 {
107 	UINT8	currentNumberOfScanResults;
108 	UINT32	scanResulCountHistogram[ SCAN_RESULT_HISTOGRAM_SIZE ];
109 	UINT8	currentNumberOfScanAttempts;
110 	UINT32	scanAttemptsForConnectionHistogram[ SCAN_ATTAMEPTS_HISTOGRAM_SIZE ];
111 } smeSmStats_t;
112 #endif
113 
114 /* SME SM handle */
115 typedef struct
116 {
117 	UINT8				state;
118 	DisAssocReason_t	DisAssoc;
119 	fsm_stateMachine_t	*pFsm;
120 	scanEnabledOptions_e scanEnabled;
121 	BOOL				reScanFlag;
122 	BOOL				dualBandReScanFlag;
123 	radioBand_e     	currBand;
124 	BOOL				bSendDisAssocEvent;
125 	TI_HANDLE			hConn;
126 	TI_HANDLE			hScanCncn;
127 	TI_HANDLE			hSiteMgr;
128 	TI_HANDLE			hHalCtrl;
129 	TI_HANDLE			hRegulatoryDomain;
130     TI_HANDLE           hPowerMgr;
131 	TI_HANDLE			hReport;
132 	TI_HANDLE			hOs;
133 	TI_HANDLE			hEvHandler;
134 	TI_HANDLE			hScr;
135 	TI_HANDLE			hApConn;
136 	TI_HANDLE			hCurrBss;
137 
138 	void				*interScanTimeoutTimer;
139 	UINT32				interScanTimeout;
140 	UINT32				interScanTimeoutMin;
141 	UINT32				interScanTimeoutMax;
142 	UINT32				interScanTimeoutDelta;
143     sme_scan_Params_t   scanParamsBG;
144     sme_scan_Params_t   scanParamsA;
145 	BOOL 				radioOn;
146     BOOL                immediateShutdownRequired; /* Flag to indicate whether DISASSOC packet should be sent to AP or not - used to instruct AP-Conn when stopping */
147 	BOOL 				connectEnabled;
148 	scan_Params_t 		scanParams; /* 	Though this is a temporary command, we keep it as
149 										class member to avoid stack overflow. */
150     UINT8               shutDownStatus; /* Internal shutdown status - used to indicate SME move to IDLE during unload process */
151 #ifdef TI_DBG
152 	smeSmStats_t		smeStats;
153 #endif
154 } smeSm_t;
155 
156 
157 fsm_stateMachine_t *smeSm_smCreate(TI_HANDLE hOs);
158 
159 TI_STATUS smeSm_smConfig(smeSm_t *pSmeSm);
160 
161 TI_STATUS smeSm_smUnLoad(TI_HANDLE hOs, fsm_stateMachine_t *pFsm);
162 
163 TI_STATUS smeSm_SMEvent(UINT8 *currentState, UINT8 event, TI_HANDLE hSmeSm);
164 
165 TI_STATUS sme_startScan(void *pData);
166 
167 #endif /* __SME_SM_H__ */
168 
169 
170