1 //------------------------------------------------------------------------------
2 // <copyright file="testcmd.h" company="Atheros">
3 //    Copyright (c) 2004-2010 Atheros Corporation.  All rights reserved.
4 //
5 //
6 // Permission to use, copy, modify, and/or distribute this software for any
7 // purpose with or without fee is hereby granted, provided that the above
8 // copyright notice and this permission notice appear in all copies.
9 //
10 // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 //
18 //
19 //------------------------------------------------------------------------------
20 //==============================================================================
21 // Author(s): ="Atheros"
22 //==============================================================================
23 
24 #ifndef  TESTCMD_H_
25 #define  TESTCMD_H_
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 #ifdef AR6002_REV2
32 #define TCMD_MAX_RATES 12
33 #else
34 #define TCMD_MAX_RATES 28
35 #endif
36 
37 typedef enum {
38     ZEROES_PATTERN = 0,
39     ONES_PATTERN,
40     REPEATING_10,
41     PN7_PATTERN,
42     PN9_PATTERN,
43     PN15_PATTERN
44 }TX_DATA_PATTERN;
45 
46 /* Continuous tx
47    mode : TCMD_CONT_TX_OFF - Disabling continuous tx
48           TCMD_CONT_TX_SINE - Enable continuous unmodulated tx
49           TCMD_CONT_TX_FRAME- Enable continuous modulated tx
50    freq : Channel freq in Mhz. (e.g 2412 for channel 1 in 11 g)
51 dataRate: 0 - 1 Mbps
52           1 - 2 Mbps
53           2 - 5.5 Mbps
54           3 - 11 Mbps
55           4 - 6 Mbps
56           5 - 9 Mbps
57           6 - 12 Mbps
58           7 - 18 Mbps
59           8 - 24 Mbps
60           9 - 36 Mbps
61          10 - 28 Mbps
62          11 - 54 Mbps
63   txPwr: Tx power in dBm[5 -11] for unmod Tx, [5-14] for mod Tx
64 antenna:  1 - one antenna
65           2 - two antenna
66 Note : Enable/disable continuous tx test cmd works only when target is awake.
67 */
68 
69 typedef enum {
70     TCMD_CONT_TX_OFF = 0,
71     TCMD_CONT_TX_SINE,
72     TCMD_CONT_TX_FRAME,
73     TCMD_CONT_TX_TX99,
74     TCMD_CONT_TX_TX100
75 } TCMD_CONT_TX_MODE;
76 
77 typedef enum {
78     TCMD_WLAN_MODE_NOHT = 0,
79     TCMD_WLAN_MODE_HT20 = 1,
80     TCMD_WLAN_MODE_HT40PLUS = 2,
81     TCMD_WLAN_MODE_HT40MINUS = 3,
82 } TCMD_WLAN_MODE;
83 
84 typedef PREPACK struct {
85     u32 testCmdId;
86     u32 mode;
87     u32 freq;
88     u32 dataRate;
89     s32 txPwr;
90     u32 antenna;
91     u32 enANI;
92     u32 scramblerOff;
93     u32 aifsn;
94     u16 pktSz;
95     u16 txPattern;
96     u32 shortGuard;
97     u32 numPackets;
98     u32 wlanMode;
99 } POSTPACK TCMD_CONT_TX;
100 
101 #define TCMD_TXPATTERN_ZERONE                 0x1
102 #define TCMD_TXPATTERN_ZERONE_DIS_SCRAMBLE    0x2
103 
104 /* Continuous Rx
105  act: TCMD_CONT_RX_PROMIS - promiscuous mode (accept all incoming frames)
106       TCMD_CONT_RX_FILTER - filter mode (accept only frames with dest
107                                              address equal specified
108                                              mac address (set via act =3)
109       TCMD_CONT_RX_REPORT  off mode  (disable cont rx mode and get the
110                                           report from the last cont
111                                           Rx test)
112 
113      TCMD_CONT_RX_SETMAC - set MacAddr mode (sets the MAC address for the
114                                                  target. This Overrides
115                                                  the default MAC address.)
116 
117 */
118 typedef enum {
119     TCMD_CONT_RX_PROMIS =0,
120     TCMD_CONT_RX_FILTER,
121     TCMD_CONT_RX_REPORT,
122     TCMD_CONT_RX_SETMAC,
123     TCMD_CONT_RX_SET_ANT_SWITCH_TABLE
124 } TCMD_CONT_RX_ACT;
125 
126 typedef PREPACK struct {
127     u32 testCmdId;
128     u32 act;
129     u32 enANI;
130     PREPACK union {
131         struct PREPACK TCMD_CONT_RX_PARA {
132             u32 freq;
133             u32 antenna;
134             u32 wlanMode;
135         } POSTPACK para;
136         struct PREPACK TCMD_CONT_RX_REPORT {
137             u32 totalPkt;
138             s32 rssiInDBm;
139             u32 crcErrPkt;
140             u32 secErrPkt;
141             u16 rateCnt[TCMD_MAX_RATES];
142             u16 rateCntShortGuard[TCMD_MAX_RATES];
143         } POSTPACK report;
144         struct PREPACK TCMD_CONT_RX_MAC {
145             u8    addr[ATH_MAC_LEN];
146         } POSTPACK mac;
147         struct PREPACK TCMD_CONT_RX_ANT_SWITCH_TABLE {
148             u32 antswitch1;
149             u32 antswitch2;
150         }POSTPACK antswitchtable;
151     } POSTPACK u;
152 } POSTPACK TCMD_CONT_RX;
153 
154 /* Force sleep/wake  test cmd
155  mode: TCMD_PM_WAKEUP - Wakeup the target
156        TCMD_PM_SLEEP - Force the target to sleep.
157  */
158 typedef enum {
159     TCMD_PM_WAKEUP = 1, /* be consistent with target */
160     TCMD_PM_SLEEP,
161     TCMD_PM_DEEPSLEEP
162 } TCMD_PM_MODE;
163 
164 typedef PREPACK struct {
165     u32 testCmdId;
166     u32 mode;
167 } POSTPACK TCMD_PM;
168 
169 typedef enum {
170     TCMD_CONT_TX_ID,
171     TCMD_CONT_RX_ID,
172     TCMD_PM_ID
173 } TCMD_ID;
174 
175 typedef PREPACK union {
176           TCMD_CONT_TX contTx;
177           TCMD_CONT_RX contRx;
178           TCMD_PM pm;
179 } POSTPACK TEST_CMD;
180 
181 #ifdef __cplusplus
182 }
183 #endif
184 
185 #endif /* TESTCMD_H_ */
186