MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / drivers / usb / net / Zydas / zdequates.h
blobc22ec737b63ef2acb6c9431fa6c0d05cead1948b
1 /****************************************************************************
2 ** COPYRIGHT (C) 2002 ZYDAS CORPORATION **
3 ** HTTP://WWW.ZYDAS.COM.TW/ **
4 ****************************************************************************/
6 #ifndef _ZDEQUATES_H
7 #define _ZDEQUATES_H
10 //-------------------------------------------------------------------------
11 // Ethernet Frame_t Sizes
12 //-------------------------------------------------------------------------
13 #define ETHERNET_ADDRESS_LENGTH 6
14 #define ETHERNET_HEADER_SIZE 14
15 #define MINIMUM_ETHERNET_PACKET_SIZE 60
16 #define MAXIMUM_ETHERNET_PACKET_SIZE 1514
17 #if 1//fMERGE_RX_FRAME
18 #define MAX_WLAN_SIZE 4800
19 #define ZD_MAX_WLAN_SIZE 4800
20 #else
21 #define MAX_WLAN_SIZE 2432
22 #define ZD_MAX_WLAN_SIZE 1600
23 #endif
25 #define WLAN_HEADER 24
26 #define CRC32_LEN 4
27 #define IV_SIZE 4
28 #define ICV_SIZE 4
30 #if defined(HOST_IF_USB)
31 #define PLCP_HEADER 5
32 #define EXTRA_INFO_LEN 5 //8 for ZD1212
33 #else
36 #define PLCP_HEADER 4
37 #define EXTRA_INFO_LEN 4
38 #endif
40 #define EXTEND_IV_LEN 4
41 #define MIC_LENGTH 8
42 #define WDS_ADD_HEADER 6
43 #define EAPOL_TYPE 0x888e
45 #define BCN_INTERVAL_OFFSET 8
46 #define CAP_OFFSET 10
47 #define SSID_OFFSET 12
48 #define NUM_SUPPORTED_RATE 32
50 #define BSS_INFO_NUM 64
52 #define TUPLE_CACHE_SIZE 16
53 #define MAX_DEFRAG_NUM 8
56 #if defined(HOST_IF_USB)
57 #define MAX_RX_TIMEOUT (100)
58 #else
59 #define MAX_RX_TIMEOUT (512*10*1000)
60 #endif
62 #define MAXIM2_MAX_TX_PWR_SET 0x7F
63 #define MAXIM2_MIN_TX_PWR_SET 0x0
64 #define RFMD_MAX_TX_PWR_SET 0xF0
65 #define RFMD_MIN_TX_PWR_SET 0x60
67 #define GCT_MAX_TX_PWR_SET 0x3f
68 #define GCT_MIN_TX_PWR_SET 0x0
70 #define AL2210_MAX_TX_PWR_SET 0xff
71 #define AL2210_MIN_TX_PWR_SET 0x80
73 #define MAX_TX_PWR_READING 0xf0
74 #define MIN_TX_PWR_READING 0x30
76 #define AL2230_MAX_TX_PWR_SET (0x7F-1)
77 #define AL2230_MIN_TX_PWR_SET (0x00+1)
80 #define TRACKING_NUM 20//10
83 //for USB
84 #define cTX_CCK 1
85 #define cTX_OFDM 2 // 6M - 36M
86 #define cTX_48M 3
87 #define cTX_54M 4
88 #define cPWR_CTRL_GUARD 4 // CR57: 4 -> 0.5 dB
89 #define cPWR_INT_VALUE_GUARD 8 // CR31: 4 -> 1 dB; 8 -> 2 dB
90 #define cPWR_STRONG_SIG_DROP (0x18 - cPWR_INT_VALUE_GUARD)
93 #define cLBTEST_COUNT 1000
94 #define cLBTEST_PATN 0x55
97 #define cMAX_MULTI_WRITE_REG_NUM 15
98 #define cMIN_MULTI_WRITE_REG_NUM 0
99 #define cMAX_MULTI_RF_REG_NUM 28
100 #define cMAX_MULTI_READ_REG_NUM 15
103 /* Firmware Interface */
104 #define cTX_QUEUE_LEN 4
105 // make sure already Tx by HMAC (for UMAC System)
106 // 1.Host->UMAC, 2.In UMAC Queue, 3.HMAC Sent
107 #define cTX_SENT_LEN (cTX_QUEUE_LEN + 2)
108 #define cFIRMWARE_OLD_ADDR 0xEC00
109 #define cFIRMWARE_START_ADDR 0xEE00
110 #define cFIRMWARE_EXT_CODE 0x1000
111 #define cADDR_ENTRY_TABLE (cFIRMWARE_START_ADDR + 0x1D)
112 #define cBOOTCODE_START_ADDR 0xF800
113 #define cINT_VECT_ADDR 0xFFF5
114 #define cEEPROM_SIZE 0x800 // 2k word (4k byte)
117 // in word (16 bit width)
118 #define cLOAD_CODE_LEN 0xE
119 #define cLOAD_VECT_LEN (0x10000 - 0xFFF7)
120 #define cEPDATA_OFFSET (cLOAD_CODE_LEN + cLOAD_VECT_LEN)
121 #define USB_BASE_ADDR_EEPROM 0x9900
122 #ifdef ZD1211B
123 #define USB_BASE_ADDR_HOST 0x9F00
124 #elif defined(ZD1211)
125 #define USB_BASE_ADDR_HOST 0x9B00
126 #else
127 #error "***** You Need To Specified ZD1211 or ZD1211B *****"
128 #endif
129 #define BASE_ADDR_MASK_HOST (~0x00FF)
130 #define cFIRMWARE_EEPROM_OFFSET (cBOOTCODE_START_ADDR + cEPDATA_OFFSET)
131 //end of USB
134 // For Rate Adaption
135 #define FALL_RATE 0x0
136 #define RISE_RATE 0x1
138 #define PS_CAM 0x0
139 #define PS_PSM 0x1
141 #define ACC_1 0x0
142 #define ACC_2 0x1
144 // MAC_PA_STATE
145 #define MAC_INI 0x0
146 #define MAC_OPERATION 0x1
147 #define MAC_PS_OPERATION 0x1
148 #define MAC_PS_SLEEP 0x2
152 // RF TYPE
153 #define UW2451_RF 0x2
154 #define uChip_RF 0x3
155 #define AL2230_RF 0x4
156 #define AL2210MPVB_RF 0x4
157 #define AL7230B_RF 0x5 //a,b,g RF
158 #define THETA_RF 0x6
159 #define AL2210_RF 0x7
160 #define MAXIM_NEW_RF 0x8
161 #define UW2453_RF 0x9
162 #define AL2230S_RF 0xA
163 #define RALINK_RF 0xB
164 #define INTERSIL_RF 0xC
165 #define RFMD_RF 0xD
168 #define MAXIM_NEW_RF2 0xE
169 #define PHILIPS_RF 0xF
172 #define ELEID_SSID 0
175 #define ELEID_SUPRATES 1
176 #define ELEID_DSPARMS 3
177 #define ELEID_TIM 5
178 #define ELEID_ERP_INFO 42
179 #define ELEID_EXT_RATES 50
180 //-------------------------------------------------------------------------
181 //- Miscellaneous Equates
182 //-------------------------------------------------------------------------
183 #ifndef FALSE
184 #define FALSE 0
185 #define TRUE 1
186 #endif
188 #define DRIVER_NULL ((u32)0xffffffff)
190 //-------------------------------------------------------------------------
191 // Bit Mask definitions
192 //-------------------------------------------------------------------------
193 #define BIT_0 0x0001
194 #define BIT_1 0x0002
195 #define BIT_2 0x0004
196 #define BIT_3 0x0008
197 #define BIT_4 0x0010
198 #define BIT_5 0x0020
199 #define BIT_6 0x0040
200 #define BIT_7 0x0080
201 #define BIT_8 0x0100
202 #define BIT_9 0x0200
203 #define BIT_10 0x0400
204 #define BIT_11 0x0800
205 #define BIT_12 0x1000
206 #define BIT_13 0x2000
207 #define BIT_14 0x4000
208 #define BIT_15 0x8000
209 #define BIT_16 0x00010000
210 #define BIT_17 0x00020000
211 #define BIT_18 0x00040000
212 #define BIT_19 0x00080000
213 #define BIT_20 0x00100000
214 #define BIT_21 0x00200000
215 #define BIT_22 0x00400000
216 #define BIT_23 0x00800000
217 #define BIT_24 0x01000000
218 #define BIT_25 0x02000000
219 #define BIT_26 0x04000000
220 #define BIT_27 0x08000000
221 #define BIT_28 0x10000000
222 #define BIT_29 0x20000000
223 #define BIT_30 0x40000000
224 #define BIT_31 0x80000000
226 #define BIT_0_1 0x0003
227 #define BIT_0_2 0x0007
228 #define BIT_0_3 0x000F
229 #define BIT_0_4 0x001F
230 #define BIT_0_5 0x003F
231 #define BIT_0_6 0x007F
232 #define BIT_0_7 0x00FF
233 #define BIT_0_8 0x01FF
234 #define BIT_0_13 0x3FFF
235 #define BIT_0_15 0xFFFF
236 #define BIT_1_2 0x0006
237 #define BIT_1_3 0x000E
238 #define BIT_2_5 0x003C
239 #define BIT_3_4 0x0018
240 #define BIT_4_5 0x0030
241 #define BIT_4_6 0x0070
242 #define BIT_4_7 0x00F0
243 #define BIT_5_7 0x00E0
244 #define BIT_5_9 0x03E0
245 #define BIT_5_12 0x1FE0
246 #define BIT_5_15 0xFFE0
247 #define BIT_6_7 0x00c0
248 #define BIT_7_11 0x0F80
249 #define BIT_8_10 0x0700
250 #define BIT_9_13 0x3E00
251 #define BIT_12_15 0xF000
253 #define BIT_16_20 0x001F0000
254 #define BIT_21_25 0x03E00000
255 #define BIT_26_27 0x0C000000
257 #define RANDOM 0x0
258 #define INCREMENT 0x1
262 // Device Bus-Master (Tx) state
263 #define TX_IDLE 0x00
264 #define TX_READ_TBD 0x01
265 #define TX_READ_DATA0 0x02
266 #define TX_READ_DATA1 0x03
267 #define TX_CHK_TBD_CNT 0x04
268 #define TX_READ_TCB 0x05
269 #define TX_CHK_TCB 0x06
270 #define TX_WAIT_DATA 0x07
271 #define TX_RETRYFAILURE 0x08
272 #define TX_REDOWNLOAD 0x09
274 // Device Bus-Master (Rx) state
275 #define RX_IDLE 0x00
276 #define RX_WAIT_DATA 0x10
277 #define RX_DATA0 0x20
278 #define RX_DATA1 0x30
279 #define RX_READ_RCB 0x50
281 #define RX_CHK_RCB 0x60
282 #define RX_WAIT_STS 0x70
283 #define RX_FRM_ERR 0x80
284 #define RX_CHK_DATA 0x90
287 #define MAX_SSID_LEN 32
289 #define HOST_PEND BIT_31
290 #define CAM_WRITE BIT_31
291 #define MAC_LENGTH 6
292 #define RX_MIC_ERROR_IND BIT_4 // Bit4 of ExtraInfo[6], its Bit3-Bit0 indicates the encryption type.
293 #define RX_HW_MIC_ENABLE BIT_25 // The subfield of ZD_SnifferOn
295 #define MIC_FINISH BIT_0
297 #define RX_MIC_ERROR_IND BIT_4
298 #define HW_MIC_ENABLE BIT_25
301 enum Frame_Control_Bit {
302 TO_DS = BIT_0,
303 FROM_DS = BIT_1,
304 MORE_FRAG = BIT_2,
305 RETRY_BIT = BIT_3,
306 PWR_BIT = BIT_4,
307 MORE_DATA = BIT_5,
308 ENCRY_BIT = BIT_6,
309 ODER_BIT = BIT_7
315 #define MAX_USER 40
316 #define MAX_KEY_LENGTH 16
317 #define ENCRY_TYPE_START_ADDR 60
318 #define DEFAULT_ENCRY_TYPE 65
319 #define KEY_START_ADDR 66
320 #define STA_KEY_START_ADDR 386
321 #define COUNTER_START_ADDR 418
322 #define STA_COUNTER_START_ADDR 423
324 #define EXTENDED_IV BIT_5
325 #define QoS_DATA BIT_7
326 #define TO_DS_FROM_DS BIT_0_1
328 #define AP_MODE BIT_24
329 #define IBSS_MODE BIT_25
330 #define POWER_MNT BIT_26
331 #define STA_PS BIT_27
333 #define NON_ERP_PRESENT_BIT BIT_0
335 #define USE_PROTECTION_BIT BIT_1
336 #define BARKER_PREAMBLE_BIT BIT_2
338 #define HOST_BIG_ENDIAN BIT_0
340 #define MEMBER_ZD1202 BIT_0
341 #define MEMBER_OTHERS BIT_1
342 #define BEACON_TIME 1
343 #define REG_MAX_WAIT 500
345 //for UART support
348 * These are the definitions for the Line Control Register
350 #define UART_LCR_SBC BIT_6 /* Set break control */
351 #define UART_LCR_DLAB BIT_7 /* Divisor latch access bit */
354 * These are the definitions for the Line Status Register
356 #define UART_LSR_DR BIT_0 /* Receiver data ready */
357 #define UART_LSR_OE BIT_1 /* Overrun error indicator */
358 #define UART_LSR_BI BIT_4 /* Break interrupt indicator */
359 #define UART_LSR_THRE BIT_5 /* Transmit-hold-register empty */
360 #define UART_LSR_TEMT BIT_6 /* Transmitter empty */
363 * These are the definitions for the Interrupt Identification Register
365 #define UART_IIR_ID_MASK 0x0E /* Mask for the interrupt ID */
366 #define UART_IIR_MSI 0x00 /* Modem status interrupt */
367 #define UART_IIR_NO_INT BIT_0 /* No interrupts pending */
368 #define UART_IIR_THRI BIT_1 /* Transmitter holding register empty */
369 #define UART_IIR_RDI BIT_2 /* Receiver data interrupt */
370 #define UART_IIR_RLSI 0x06 /* Receiver line status interrupt */
371 #define UART_IIR_RX_TIMEOUT 0x0C /* Rx timeout interrupt */
376 * These are the definitions for the Interrupt Enable Register
378 #define UART_IER_RDI BIT_0 /* Enable receiver data interrupt */
379 #define UART_IER_THRI BIT_1 /* Enable Transmitter holding register int. */
380 #define UART_IER_RLSI BIT_2 /* Enable receiver line status interrupt */
381 #define UART_IER_MSI BIT_3 /* Enable Modem status interrupt */
384 * These are the definitions for the Modem Control Register
386 #define UART_MCR_DTR BIT_0 /* DTR complement */
387 #define UART_MCR_RTS BIT_1 /* RTS complement */
388 #define UART_MCR_TAFC BIT_5 /* Tx auto flow control */
389 #define UART_MCR_RAFC BIT_6 /* Rx auot flow control */
392 * These are the definitions for the Modem Status Register
394 #define UART_MSR_DCTS BIT_0 /* Delta CTS */
395 #define UART_MSR_DDCD BIT_3 /* Delta DCD */
396 #define UART_MSR_CTS BIT_4 /* Clear to Send */
397 #define UART_MSR_DCD BIT_7 /* Data Carrier Detect */
398 #define UART_MSR_ANY_DELTA 0x09 /* Any of the delta bits! */
401 * These are the definitions for the FIFO Control Register
404 #define UART_FCR_CLEAR_RCVR BIT_1 /* Clear the RCVR FIFO */
405 #define UART_FCR_CLEAR_XMIT BIT_2 /* Clear the XMIT FIFO */
406 #define UART_FCR_TX_TRIGGER_1 0x00 /* Mask for tx trigger set at 1 */
407 #define UART_FCR_TX_TRIGGER_2 0x10 /* Mask for tx trigger set at 2 */
408 #define UART_FCR_TX_TRIGGER_4 0x20 /* Mask for tx trigger set at 4 */
409 #define UART_FCR_TX_TRIGGER_8 0x30 /* Mask for tx trigger set at 8 */
410 #define UART_FCR_RX_TRIGGER_1 0x00 /* Mask for rx trigger set at 1 */
411 #define UART_FCR_RX_TRIGGER_4 0x40 /* Mask for rx trigger set at 4 */
412 #define UART_FCR_RX_TRIGGER_8 0x80 /* Mask for rx trigger set at 8 */
413 #define UART_FCR_RX_TRIGGER_14 0xC0 /* Mask for rx trigger set at 14 */
416 //Extra Control register
417 #define UART_ECR_BREAK_LEN_11_BAUD 0x00 /* Break length 11 baud clocks */
418 #define UART_ECR_BREAK_LEN_12_BAUD 0x01 /* Break length 12 baud clocks */
419 #define UART_ECR_BREAK_LEN_23_BAUD 0x02 /* Break length 23 baud clocks */
420 #define UART_ECR_BREAK_LEN_25_BAUD 0x03 /* Break length 25 baud clocks */
421 #define UART_ECR_BREAK_DETECTION BIT_2 /* Break detection */
422 #define UART_ECR_BREAK_ENABLE BIT_3 /* Break enable */
423 #define UART_ECR_RX_TOUT_10_BAUD 0x00 /* Rx fifo timeout 10 baud cloacks */
424 #define UART_ECR_RX_TOUT_20_BAUD 0x10 /* Rx fifo timeout 20 baud cloacks */
425 #define UART_ECR_RX_TOUT_40_BAUD 0x20 /* Rx fifo timeout 40 baud cloacks */
426 #define UART_ECR_RX_TOUT_80_BAUD 0x30 /* Rx fifo timeout 80 baud cloacks */
427 #define UART_ECR_ENABLE BIT_7 /* UART enable */
429 //Baud rate definition
430 #define BAUD_RATE_2400 0xBF
431 #define BAUD_RATE_4800 0x5F
432 #define BAUD_RATE_9600 0x2F
433 #define BAUD_RATE_19200 0x17
434 #define BAUD_RATE_38400 0x0B
435 #define BAUD_RATE_57600 0x07
436 #define BAUD_RATE_115200 0x03
437 #define BAUD_RATE_230400 0x01
438 #define BAUD_RATE_460800 0x00
440 // for EEPROM support
441 #define EEPROM_BASE_ADDRESS 0x900
442 #define EEPROM_WRITE_ACCESS BIT_15
443 #define EEPROM_BUSY_FLAG BIT_15
444 #define EEPROM_ACCESS_WRITE 0x01
445 #define EEPROM_ACCESS_READ 0x00
448 #define mBIT(b) (1 << (b))
449 #define mMASK(w) (mBIT(w) - 1)
450 #define mSET_MASK(a, b) ((a) | (b))
451 #define mCLR_MASK(a, b) ((a) & (~(b)))
452 #define mSET_BIT(a, b) mSET_MASK(a, mBIT(b))
453 #define mCLR_BIT(a, b) mCLR_MASK(a, mBIT(b))
454 #define mCHK_BIT1(a, b) ((a) & mBIT(b))
455 #define mTEST_BIT(a, b) mCHK_BIT1(a, b)
458 #endif // _EQUATES_H