1/*
2 * TWDriverInternal.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
35
36/** \file TWDriverInternal.h
37 *  \brief TWD Driver internal common internal declarations
38 *
39 *  \see TWDriver.h
40 */
41
42
43#ifndef TWDRIVERINTERNAL_H
44#define TWDRIVERINTERNAL_H
45
46
47#include "TWDriver.h"
48#include "Device.h"
49
50
51/* Shift factor to conver between TU (1024 uSec) and uSec. */
52#define SHIFT_BETWEEN_TU_AND_USEC       10
53
54/* keep-alive templates definitions */
55#define KLV_MAX_TMPL_NUM                4
56
57/* Definitions for Rx Filter MIB */
58
59/* Set A�Enable: Forward all frames to host driver */
60#define MIB_RX_FILTER_PROMISCOUS_SET    0x01
61/* Cleared A� Disable: Do not orward all frames to the host driver */
62#define MIB_RX_FILTER_PROMISCOUS_CLEAR  0x00
63/* Set A�filter enabled: receive only those frames that match the BSSID given in the Join command */
64#define MIB_RX_FILTER_BSSID_SET         0x02
65/* Cleared A�filter disabled: ignore BSSID in receiving */
66#define MIB_RX_FILTER_BSSID_CLEAR       0x00
67
68/* Asynchronous init mode callback function type */
69typedef void (*fnotify_t)(TI_HANDLE module, TI_STATUS status);
70
71        /* Callback function definition for EndOfRecovery */
72typedef void (*TEndOfRecoveryCb) (TI_HANDLE handle);
73
74
75/* TWD Driver Structure */
76typedef struct
77{
78    TI_HANDLE           hOs;
79    TI_HANDLE           hUser;
80    TI_HANDLE           hReport;
81    TI_HANDLE           hTimer;
82    TI_HANDLE           hContext;
83    TI_HANDLE           hMacServices;
84    TI_HANDLE           hTxCtrlBlk;
85    TI_HANDLE           hTxHwQueue;
86    TI_HANDLE           hHwIntr;
87    TI_HANDLE           hHealthMonitor;
88    TI_HANDLE           hTwIf;
89    TI_HANDLE           hTxnQ;
90    TI_HANDLE           hCmdQueue;
91    TI_HANDLE           hCmdBld;
92    TI_HANDLE           hTxXfer;
93    TI_HANDLE           hTxResult;
94    TI_HANDLE           hRxXfer;
95    TI_HANDLE           hFwEvent;
96    TI_HANDLE           hHwInit;
97    TI_HANDLE           hCmdMbox;
98    TI_HANDLE           hEventMbox;
99    TI_HANDLE           hFwDbg;
100    TI_HANDLE           hRxQueue;
101
102    /* If true it means that we are in recovery process */
103    TI_BOOL             bRecoveryEnabled;
104
105    /* Init success flag */
106    TI_BOOL             bInitSuccess;
107
108    ReadWriteCommand_t  tPrintRegsBuf;
109
110    /* Init/Recovery/Stop callbacks */
111    TTwdCallback        fInitHwCb;
112    TTwdCallback        fInitFwCb;
113    TTwdCallback        fConfigFwCb;
114    TTwdCallback        fStopCb;
115    TTwdCallback        fInitFailCb;
116
117    TFailureEventCb     fFailureEventCb;
118    TI_HANDLE          	hFailureEventCb;
119
120    TI_UINT32           uNumMboxFailures;
121
122#ifdef TI_DBG  /* Just for debug. */
123    /* Packets sequence counter (common for all queues). */
124    TI_UINT32           dbgPktSeqNum;
125    /* Tx counters per queue:*/
126    /* Count packets sent from upper driver. */
127    TI_UINT32           dbgCountSentPackets[MAX_NUM_OF_AC];
128    /* Count packets sent and queue not busy. */
129    TI_UINT32           dbgCountQueueAvailable[MAX_NUM_OF_AC];
130    /* Count XferDone return values from Xfer. */
131    TI_UINT32           dbgCountXferDone[MAX_NUM_OF_AC];
132    /* Count Success return values from Xfer. */
133    TI_UINT32           dbgCountXferSuccess[MAX_NUM_OF_AC];
134    /* Count Pending return value from Xfer. */
135    TI_UINT32           dbgCountXferPending[MAX_NUM_OF_AC];
136    /* Count Error return value from Xfer. */
137    TI_UINT32           dbgCountXferError[MAX_NUM_OF_AC];
138    /* Count XferDone callback calls. */
139    TI_UINT32           dbgCountXferDoneCB[MAX_NUM_OF_AC];
140    /* Count TxComplete callback calls. */
141    TI_UINT32           dbgCountTxCompleteCB[MAX_NUM_OF_AC];
142
143    MemoryMap_t         MemMap;
144    ACXStatistics_t     acxStatistic;
145#endif
146
147	TTestCmdCB	fRadioCb;
148	void		*pRadioCb;
149	TI_HANDLE	hRadioCb;
150	TTestCmd 	testCmd;
151
152} TTwd;
153
154
155/* External Functions Prototypes */
156
157void  SendPacketTransfer (TI_HANDLE         hUser,
158                          TI_UINT32         aPacketId);
159void  SendPacketComplete (TI_HANDLE         hUser,
160                          TI_STATUS         aStatus,
161                          TI_UINT32         aPacketId,
162                          TI_UINT32         aRate,
163                          TI_UINT8          aAckFailures,
164                          TI_UINT32         durationInAir,
165                          TI_UINT32         fwHandlingTime,
166                          TI_UINT32         mediumDelay);
167
168
169
170
171#endif /* TNETW_DRIVER_H */
172
173