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:  whalTrace.h
39 *   PURPOSE: Trace on Rx/Tx packets
40 *
41 ****************************************************************************/
42
43#ifndef _WHAL_TRACE_H
44#define _WHAL_TRACE_H
45
46#include "whalCommon.h"
47#include "whalHwDefs.h"
48
49
50#ifndef TIWLN_WINCE30
51#define TRACER_MAX_EVENTS		2000
52#else
53#define TRACER_MAX_EVENTS		10
54#endif
55
56#define TRACER_MAX_ACT_LEN		5
57#define TRACER_MAX_OBJ_LEN		3
58#define TRACER_HDR_LEN			2
59#define TRACER_MAX_STR_LEN		70
60
61
62
63typedef enum
64{
65	NUM_FREE_DESCRIPTOR,
66	DESCRIPTOR_OCCUPIED,
67	CLEAR_DESCRIPTORS,
68	FREE_BLOCKS,
69} varSetType_e;
70
71typedef struct
72{
73	UINT32			time;
74	UINT16			MpduLen;
75	UINT8			Ctl;
76	UINT16			Rate;
77	UINT8			Status[4];
78	dot11_header_t	FrameHeader;
79	int				FrameData;
80} TRACER_DATA;
81
82typedef struct
83{
84	char			String[TRACER_MAX_STR_LEN];
85	int				IntValue;
86} TRACER_CTRL;
87
88typedef struct
89{
90	UINT32			TimStamp;
91	char			Action[TRACER_MAX_ACT_LEN];
92	char			Object[TRACER_MAX_OBJ_LEN];
93
94	union
95	{
96		TRACER_DATA		TrcData;
97		TRACER_CTRL		TrcCtrl;
98	}Info;
99
100} TRACER_EVENT;
101
102typedef struct _WhalTrace_T
103{
104	int Enable;
105	int Idx;
106	int Num;
107#ifdef TNETW_MASTER_MODE
108	TRACER_EVENT Evt[TRACER_MAX_EVENTS];
109#endif
110	void *hProtect;
111	short traceMask;
112
113	UINT8			MinNumDescriptorFree;
114	UINT8			MacOccupiedDescriptor;
115	UINT8			MaxClearDescriptor;
116	UINT8			MaxFreeBlks;
117	UINT8			BugCounter;
118	UINT8			reBug;
119
120
121	TI_HANDLE		hTNETWIF;
122
123	TI_HANDLE hOs;
124	TI_HANDLE hReport;
125} WhalTrace_T;
126
127extern WhalTrace_T *whal_traceCreate(TI_HANDLE hOs);
128extern int whal_traceDestroy(WhalTrace_T *pTrc);
129extern int whal_traceConfig(WhalTrace_T *pTrc, TI_HANDLE hTNETWIF, TI_HANDLE hReport);
130#ifdef TNETW_MASTER_MODE
131extern int  whal_traceAddTx(WhalTrace_T *pTrc, HwTxDesc_T *pHwTxDesc, char *Action);
132#endif
133extern int  whal_traceIsEnable(WhalTrace_T *pTrc);
134extern void whal_traceEnable(WhalTrace_T *pTrc, int val);
135
136#endif
137