1/****************************************************************************
2**+-----------------------------------------------------------------------+**
3**|                                                                       |**
4**| Copyright(c) 1998 - 2008 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****************************************************************************/
35
36/****************************************************************************
37 *
38 *   MODULE:  whalParams.h
39 *   PURPOSE: Holds all the whal parameters
40 *
41 ****************************************************************************/
42
43#ifndef _WHAL_PARAMS_H
44#define _WHAL_PARAMS_H
45
46#include  "802_11Defs.h"
47#include  "whalHwDefs.h"
48#include  "whalCtrl_api.h"
49#include  "whalBus_Defs.h"
50#include  "commonTypes.h"
51
52#define MAX_FRAGMENTATION_THRESHOLD     2312
53#define MAX_SSID_SIZE       32
54
55 /* Trace Buffer Size (DebugTraceXfer Buffer)
56   Mote : The Trace Buffer Size are in UINT32 (1024 bytes,and 2048 for both buffers) */
57#define TRACE_BUFFER_MAX_SIZE 256
58
59
60#define DEFAULT_HW_RADIO_CHANNEL        11
61
62
63/* Constants */
64
65/* RSSI roaming trigger configuration */
66/* minimal amount of packets to count in average RSSI before actually reporting trigger */
67#define RSSI_DEFAULT_DEPTH  (10)
68/* the weight in % of the new packet relative to the previous average value of RSSI */
69#define RSSI_DEFAULT_WEIGHT (10)
70#define RSSI_DEFAULT_THRESHOLD  (-80)
71
72/* SNR roaming trigger configuration */
73/* minimal amount of packets to count in average SNR before actually reporting trigger */
74#define SNR_DEFAULT_DEPTH   (10)
75/* the weight in % of the new packet relative to the previous average value of SNR */
76#define SNR_DEFAULT_WEIGHT  (10)
77#define SNR_DEFAULT_THRESHOLD   (0)
78
79/* 'No beacon' roaming trigger configuration */
80/* Number of consecutive beacons (or DTIM periods) missed before
81  'Out of Sync' event is raised */
82#define OUT_OF_SYNC_DEFAULT_THRESHOLD   (10)
83/* IBSS - Number of consecutive beacons (or DTIM periods) missed before
84  'Out of Sync' event is raised */
85#define OUT_OF_SYNC_IBSS_THRESHOLD  (200)
86/* period of time between 'Out of sync' and 'No beacon' events */
87#define NO_BEACON_DEFAULT_TIMEOUT       (100) /* in tu-s*/
88
89/* Consecutive NACK roaming trigger configuration */
90#define NO_ACK_DEFAULT_THRESHOLD    (20)
91
92/* Low Rx rate roaming trigger configuration */
93#define LOW_RATE_DEFAULT_THRESHOLD  (2)
94
95typedef struct
96{
97    UINT8    rxFilterCommand;
98    filter_e rxFilterAction;
99    UINT8    rxFilterNumFieldPatterns;
100    UINT8    rxFilterLenFieldPatterns;
101    UINT8    rxFilterFieldPatterns[MAX_DATA_FILTER_SIZE];
102
103}RxFilterConfig_t;
104
105/*
106 * Dot11 params
107 * ------------
108 */
109
110
111typedef struct
112{
113    UINT16  RtsThreshold;
114    UINT8   CtsToSelf;
115    rxTimeOut_t rxTimeOut;
116    UINT16  FragmentThreshold;
117    UINT8   ListenInterval;
118    UINT16  Capabilities;
119    UINT32  MaxTxMsduLifetime;
120    UINT32  MaxRxMsduLifetime;
121    UINT8   calibrationChannel2_4;
122    UINT8   calibrationChannel5_0;
123    UINT16  Aid;
124    UINT8   CurrAntenna;
125    UINT8   TxAntenna;
126    UINT8   RxAntenna;
127    UINT8   Hw_TxAntenna;
128    UINT8   Hw_RxAntenna;
129    UINT16  CwMin;
130
131    UINT8   RateFallback;
132    UINT32  RxConfigOption;
133    UINT32  RxFilterOption;
134	UINT8	BetEnable;
135	UINT8   MaximumConsecutiveET;
136    UINT8   TxCompleteThreshold;
137    BOOL    WiFiWmmPS;
138
139    /* ARP IP Addr table*/
140    UINT32  arp_IP_ver;
141    UINT32  isArpIpFilteringEnabled ;
142    IpAddress_t arp_IP_addr;
143
144    /*mac addresses filter*/
145    UINT8 isMacAddrFilteringnabled ;
146    UINT8 numGroupAddrs;
147    macAddress_t Group_addr[MAX_MULTICAST_GROUP_ADDRS];
148
149    UINT32  FeatureOptions;
150    UINT32  FeatureDataFlowOptions;
151    UINT8   SlotTime;
152    UINT8   preamble;
153    UINT8   RadioBand;
154    UINT8   MacClock;
155    UINT8   ArmClock;
156    UINT8   Enable4x;
157    UINT8   CurrPowerSaveState;
158    SoftGeminiEnableModes_e SoftGeminiEnable;
159    SoftGeminiParam_t SoftGeminiParams;
160
161    UINT8   maxSitesFragCollect;
162    UINT8   hwAccessMethod;
163
164    UINT8   FragmentationOnHal;
165
166    UINT32  nullTemplateSize;
167
168    UINT32  beaconTemplateSize;
169
170
171    UINT32  probeRequestTemplateSize;
172    UINT32  probeResponseTemplateSize;
173    UINT32  PsPollTemplateSize;
174    UINT32  qosNullDataTemplateSize;
175
176    BOOL    RxEnergyDetection;
177    BOOL    TxEnergyDetection;
178
179    UINT8   PacketDetectionThreshold;
180    UINT8   FcsErrThrsh;
181    UINT8   UseDeviceErrorInterrupt;
182    BOOL    RetryPreemption;
183
184    UINT32  radioType;
185    UINT32  minorE2Ver;
186    UINT32  majorE2Ver;
187    UINT32  bugfixE2Ver;
188    BOOL    RxDisableBroadcast; /* this flag indicate if to discards all broadcast frames */
189    BOOL    RecoveryEnable;  /* Indicate if the recovery process is enabled */
190    BOOL    bJoin;              /* Indicate if the station is joined */
191    /* hardware ACI parameters */
192    UINT8   ACIMode;
193    UINT8   inputCCA;
194    UINT8   qualifiedCCA;
195    UINT8   stompForRx;
196    UINT8   stompForTx;
197    UINT8   txCCA;
198
199    UINT8   AntDiversity ;
200
201    acQueuesParams_t acQueuesParams[MAX_NUM_OF_AC];
202
203    /* Parameters for roaming triggers configuration */
204    whalCtrl_roamingTriggerCmd_t roamTriggers;
205
206    /* antenna diversity parameters */
207    whalCtrl_antennaDiversityOptions_t antennaDiversityOptions;
208
209    /* power control param */
210    powerAutho_PowerPolicy_e minPowerLevel;
211
212    BcnBrcOptions_t BcnBrcOptions;
213
214    UINT8           ConsecutivePsPollDeliveryFailureThreshold;
215
216    beaconFilterIETable_t beaconFilterIETable;
217    beaconFilterParams_t beaconFilterParams;
218
219    queueTrafficParams_t QtrafficParams;
220    acQosParams_t acQosParams;
221
222    /*mac preamble*/
223    UINT8 earlyWakeUp;
224
225    /* Rx Data Filter */
226    BOOL rxFilterDefaultAction;
227    filter_e rxFilterDefaultEnable;
228    RxFilterConfig_t rxFilterCgf[MAX_DATA_FILTERS];
229
230} WlanParams_T;
231
232
233/*
234 * BssInfo params
235 * --------------
236 */
237
238typedef struct
239{
240    UINT8           ReqBssType;
241    UINT8           BssType;
242    UINT16          BeaconInterval;
243    UINT8           DtimInterval;
244    UINT8           RadioChannel;
245
246    UINT8           BssId[MAC_ADDR_SIZE];
247    dot11_SSID_t    WlanElm_Ssid;
248
249    txRatePolicy_t  TxRateClassParams; /* Policy for recovery   */
250    UINT16          BasicRateSet;
251    UINT16          SupportedRateSet;
252    rate_e          txCtrlFrmRateDriverFormat;
253    UINT8           txCtrlFrmRate;
254    UINT8           txCtrlFrmModulation;
255    UINT8           Ctrl; /* Only bit 7 is currently in use , bit 7 indicates if to flash the Tx queues */
256    UINT8           txMgmtFrmRate;
257    UINT8           txMgmtFrmModulation;
258    UINT16          ATimWindow;     /* ATIM window of IBSS*/
259                                    /* Note that when ATIM window is zero the*/
260                                    /* initiated IBSS does not support powersave*/
261    UINT8           DefaultPreamble;/* Specifies the PLCP preamble type used*/
262                                    /* 0 for long preamble*/
263                                    /* 1 for short preamble*/
264
265
266
267} BssInfoParams_T;
268
269/*
270 * General params
271 * --------------
272 */
273
274typedef struct
275{
276    int     UseTxDataInterrupt;
277
278    UINT8   TraceEnable;
279    UINT8   TraceOut;
280
281    UINT32  PbccDynamicEnable;
282    UINT32  PbccDynamicInterval;
283    UINT32  PbccDynamicIgnoreMcast;
284} GenParams_T;
285
286
287/*
288 * General counters
289 * ----------------
290 */
291
292typedef struct
293{
294    UINT32  FcsErrCnt;
295} GenCounters_T;
296
297
298/*
299 * HwInfoParams_t - wlan hardware info
300 * -----------------------------------
301 */
302typedef struct
303{
304    UINT8                   SrcMacAddr[MAC_ADDR_SIZE];
305    UINT32                  Pad0;
306    UINT32                  Pad1;
307    ACXRevision_t           AcxVersion;             /* Fw version (read from the wlan hardware) */
308} HwInfo_T;
309
310
311/*
312 * queuesParam_T - Queue params for Quality Of Service
313 * ------------------------------------------
314 */
315typedef struct
316{
317    queueTrafficParams_t        queues[MAX_NUM_OF_TX_QUEUES];
318    BOOL                        isQueueConfigured[MAX_NUM_OF_TX_QUEUES];
319} QueuesParam_t;
320
321typedef struct
322{
323    acQosParams_t               ac[MAX_NUM_OF_AC];
324    BOOL                        isAcConfigured[MAX_NUM_OF_AC];
325}AcConfParam_t;
326
327typedef struct
328{
329    /* Tx Parameters */
330    UINT8               TxPowerDbm;
331
332    UINT16              txCompleteTimeout;
333    UINT8               txCompleteThreshold;
334
335    UINT8               QidToAcTable[MAX_NUM_OF_TX_QUEUES];
336    BOOL                AckPolicy[MAX_NUM_OF_AC];
337
338    /* Information Elements */
339    acQueuesParams_t    halAcQueueParams[MAX_NUM_OF_AC];
340    whaCtrl_acTrafficParams_t   halTrafficParams[MAX_NUM_OF_AC];
341
342} TxParam_t;
343
344
345/*
346 * Templates params
347 * ----------------
348 */
349
350
351
352typedef struct
353{
354    TemplateParams_T    Beacon;
355    TemplateParams_T    ProbeReq;
356    TemplateParams_T    ProbeResp;
357    TemplateParams_T    NullData;
358    TemplateParams_T    PsPoll;
359    TemplateParams_T    QosNullData;
360} TemplateListParams_T;
361
362/*
363 * ----------------------------------------------------------------
364 *                  MAIN PARAMETERS STRUCTURE
365 * ----------------------------------------------------------------
366 */
367typedef struct _WhalParams_T
368{
369    DmaParams_T             DmaParams;      /* Rx/Tx queue parameters   */
370    QueuesParam_t           QueuesParams;   /* Queues params for QOS    */
371    AcConfParam_t           AcParams;       /* AC params for QoS        */
372    TxParam_t               TxParams;       /* Tx params for QOS        */
373    WlanParams_T            WlanParams;     /* Wlan parameters          */
374    BssInfoParams_T         BssInfoParams;  /* Bss information          */
375    GenParams_T             GenParams;      /* General parameters       */
376    HwInfo_T                HwInfoParams;   /* Hw eeprom, hw versions   */
377    GenCounters_T           GenCounters;    /* General counters         */
378    TemplateListParams_T    TemplateList;   /* templates for recovery   */
379
380    TI_HANDLE hOs;
381    TI_HANDLE hReport;
382
383} WhalParams_T;
384
385/*
386 * ----------------------------------------------------------------
387 *                  WHAL pARAMS OBJECT API
388 * ----------------------------------------------------------------
389 */
390WhalParams_T *whal_params_Create(TI_HANDLE hOs, BOOL TxFlashEnable);
391int whal_params_Destroy(WhalParams_T *pWhalParams);
392int whal_params_Config (WhalParams_T *pWhalParams, TI_HANDLE hReport);
393
394/*
395 * DmaParams - Rx/Tx queue parameters
396 */
397DmaParams_T *whal_ParamsGetDmaParams(WhalParams_T *pWhalParams);
398int whal_ParamsSetDmaParams(WhalParams_T *pWhalParams);
399
400/*
401 * WlanParams api
402 */
403
404int     whal_ParamsSetRoamingParams(WhalParams_T *pWhalParams) ;
405WlanParams_T *whal_ParamsGetWlanParams(WhalParams_T *pWhalParams);
406void   whal_ParamsSetFragmentThreshold  (WhalParams_T *pWhalParams, int FragSize);
407UINT32 whal_ParamsGetFragmentThreshold  (WhalParams_T *pWhalParams);
408UINT8  whal_ParamsIsFragmentOnHal       (WhalParams_T *pWhalParams);
409void   whal_ParamsPrintFragmentThreshold(WhalParams_T *pWhalParams);
410UINT8  whal_ParamsGetMaxSitesFragCollect(WhalParams_T *pWhalParams);
411void   whal_ParamsSetRtsThreshold       (WhalParams_T *pWhalParams, int RtsSize);
412void   whal_ParamsSetListenInterval     (WhalParams_T *pWhalParams, UINT8 Val);
413UINT8  whal_ParamsGetListenInterval     (WhalParams_T *pWhalParams);
414void   whal_ParamsSetRxFilter           (WhalParams_T *pWhalParams, UINT32 RxConfigOption, UINT32 RxFilterOption);
415void   whal_ParamsGetRxFilter           (WhalParams_T *pWhalParams, UINT32* pRxConfigOption, UINT32* pRxFilterOption);
416void   whal_ParamsSetarpIpAddressesTable(WhalParams_T *pWhalParams, IpAddress_t * IP_addr, IPver_e IP_ver);
417void   whal_ParamsGetarpIpAddressesTable(WhalParams_T * pWhalParams, IpAddress_t * IP_addr, IPver_e* pIP_ver);
418void   whal_ParamsSetarpIpFilterEnabled(WhalParams_T *pWhalParams, UINT8 isEnabled);
419void   whal_ParamsGetarpIpFilterEnabled(WhalParams_T *pWhalParams, UINT8* pisEnabled);
420void   whal_ParamsSetGroupAddressesTable(WhalParams_T *pWhalParams, UINT8 isEnabled, UINT8 numGroupAddrs, macAddress_t *Group_addr);
421void   whal_ParamsGetGroupAddressesTable(WhalParams_T *pWhalParams, UINT8* pisEnabled, UINT8* pnumGroupAddrs, macAddress_t *Group_addr);
422UINT8  whal_ParamsGetCurrAntenna        (WhalParams_T *pWhalParams);
423void   whal_ParamsSetPowerSaveState(WhalParams_T *pWhalParams, UINT8 CurrPowerSaveState);
424UINT8  whal_ParamsGetPowerSaveState(WhalParams_T *pWhalParams);
425
426
427/*
428 * Bss Info Params api
429 */
430BssInfoParams_T *whal_ParamsGetBssInfoParams(WhalParams_T *pWhalParams);
431UINT8   *whal_ParamsGetBssId        (WhalParams_T *pWhalParams);
432void     whal_ParamsSetBssId        (WhalParams_T *pWhalParams, char *BssId);
433void     whal_ParamsSetSsid         (WhalParams_T *pWhalParams, char *Ssid, UINT8 SsidLength);
434dot11_SSID_t *whal_ParamsGetElm_Ssid(WhalParams_T *pWhalParams);
435void   whal_ParamsSetReqBssType     (WhalParams_T *pWhalParams, int Val);
436UINT8  whal_ParamsGetReqBssType(WhalParams_T *pWhalParams);
437void   whal_ParamsSetBssType        (WhalParams_T *pWhalParams, int Val);
438void whal_ParamsSetRadioBand(WhalParams_T *pWhalParams, int RadioBand);
439UINT8  whal_ParamsGetRadioBand(WhalParams_T *pWhalParams);
440UINT8  whal_ParamsGetBssType        (WhalParams_T *pWhalParams);
441void   whal_ParamsSetBeaconInterval (WhalParams_T *pWhalParams, UINT16 Val);
442UINT16 whal_ParamsGetBeaconInterval (WhalParams_T *pWhalParams);
443void   whal_ParamsSetDtimCount      (WhalParams_T *pWhalParams, UINT8 Val);
444UINT8  whal_ParamsGetDtimCount      (WhalParams_T *pWhalParams);
445UINT8  whal_ParamsGetRadioChannel   (WhalParams_T *pWhalParams);
446void   whal_ParamsSetRadioChannel   (WhalParams_T *pWhalParams, int Channel);
447void   whal_ParamsSetBasicRatesSet  (WhalParams_T *pWhalParams, UINT16 BasicRateSet);
448void   whal_ParamsSetSupportedRatesSet(WhalParams_T *pWhalParams, UINT16 SupportedRateSet);
449void   whal_ParamsSetHwGenTxParams  (WhalParams_T *pWhalParams, rate_e TxRate, BOOL bCtrlFrame);
450UINT8  whal_ParamsGetDefaultChannel (WhalParams_T *pWhalParams);
451void whal_ParamsSetTxRateClassParams(WhalParams_T *pWhalParams,txRatePolicy_t *pTxRatePolicy);
452txRatePolicy_t* whal_ParamsGetTxRateClassParams(WhalParams_T *pWhalParams);
453void   whal_ParamsSetAtimWindow     (WhalParams_T *pWhalParams, UINT16 ATimWindow);
454UINT16 whal_ParamsGetAtimWindow     (WhalParams_T *pWhalParams);
455void   whal_ParamsSetDefaultPreamble(WhalParams_T *pWhalParams, UINT8 DefaultPreamble);
456UINT8  whal_ParamsGetDefaultPreamble(WhalParams_T *pWhalParams);
457UINT32 whal_ParamsGetTraceBufferSize(WhalParams_T *pWhalParams);
458void   whal_ParamsGetMacPreambleParams(WhalParams_T *pWhalParams, UINT8* earlyWakeUp);
459
460
461/*
462 * general AP parameters
463 */
464GenParams_T *whal_ParamsGetGenParams    (WhalParams_T *pWhalParams);
465UINT32 whal_ParamsGetPbccDynamicEnableVal(WhalParams_T *pWhalParams);
466void   whal_ParamsSetPbccDynamicEnableVal(WhalParams_T *pWhalParams, int Val);
467
468/*
469 * Wlan hardware info params
470 */
471UINT8   *whal_ParamsGetSrcMac   (WhalParams_T *pWhalParams);
472void     whal_ParamsSetSrcMac   (WhalParams_T *pWhalParams, char *SrcMac);
473char whal_ParamsGetRadioType    (WhalParams_T *pWhalParams);
474void whal_ParamsHwNvramPrint    (WhalParams_T *pWhalParams);
475ACXRevision_t *whal_ParamsGetAcxVersion(WhalParams_T *pWhalParams);
476void whal_ParamsPrintFwVersion  (WhalParams_T *pWhalParams);
477UINT8 *whal_ParamsGetFwVersion  (WhalParams_T *pWhalParams);
478UINT8  whal_ParamsGetE2MajorVersion (WhalParams_T *pWhalParams);
479UINT8  whal_ParamsGetE2MinorVersion (WhalParams_T *pWhalParams);
480UINT8  whal_ParamsGetE2LastVersion (WhalParams_T *pWhalParams);
481UINT8  whal_ParamsGetTiInternalVer (WhalParams_T *pWhalParams);
482
483/*
484 * ----------------------------------------------------------------
485 *                          WME TX PARAMETERS
486 * ----------------------------------------------------------------
487 */
488
489int whal_ParamsSetQueueParams(WhalParams_T *pWhalParams,queueTrafficParams_t *pQtrafficParams) ;
490void whal_ParamsSetAcParams(WhalParams_T *pWhalParams,acQosParams_t *pAcQosParams);
491
492
493TxParam_t* whal_ParamsGetTxParams (WhalParams_T *pWhalParams);
494
495/*
496 *  Traffic Parameters: (IE ACX_TID_CFG)
497 */
498int whal_ParamsSetTrafficParams(WhalParams_T *pWhalParams,whaCtrl_acTrafficParams_t* pTconfParams) ;
499whaCtrl_acTrafficParams_t* whal_ParamsGetTrafficParams(WhalParams_T *pWhalParams, UINT8 AcID);
500
501/*
502 *  Access Category Parameters :(IE ACX_AC_CFG)
503 */
504int whal_ParamsSetAccessCategoryParams(WhalParams_T *pWhalParams,acQueuesParams_t* pTconfParams) ;
505
506/*
507 *  Qos Type : use in the Tx Descriptor
508 */
509BOOL whal_ParamsGetQosMode(WhalParams_T *pWhalParams);
510int   whal_ParamsSetQosMode(WhalParams_T *pWhalParams,qosProtocols_e QosType);
511
512/*
513 *  Ack Policy Parameters: use in the Tx Descriptor
514 */
515int   whal_ParamsSetAccessCategoryAckPolicy(WhalParams_T *pWhalParams,BOOL AckPolicy, UINT8 Qid);
516
517/*
518 *
519 */
520UINT8 whal_ParamsGetAcIdFromQid(WhalParams_T *pWhalParams,UINT8 Qid);
521
522#endif /*_WHAL_PARAMS_H*/
523