162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci *	Copyright (c) 2004, 2005 Jeroen Vreeken (pe1rxq@amsat.org)
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci *	Parts of this driver have been derived from a wlan-ng version
662306a36Sopenharmony_ci *	modified by ZyDAS.
762306a36Sopenharmony_ci *	Copyright (C) 1999 AbsoluteValue Systems, Inc.  All Rights Reserved.
862306a36Sopenharmony_ci */
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci#ifndef _INCLUDE_ZD1201_H_
1162306a36Sopenharmony_ci#define _INCLUDE_ZD1201_H_
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#define ZD1201_NUMKEYS		4
1462306a36Sopenharmony_ci#define ZD1201_MAXKEYLEN	13
1562306a36Sopenharmony_ci#define ZD1201_MAXMULTI		16
1662306a36Sopenharmony_ci#define ZD1201_FRAGMAX		2500
1762306a36Sopenharmony_ci#define ZD1201_FRAGMIN		256
1862306a36Sopenharmony_ci#define ZD1201_RTSMAX		2500
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci#define ZD1201_RXSIZE		3000
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_cistruct zd1201 {
2362306a36Sopenharmony_ci	struct usb_device	*usb;
2462306a36Sopenharmony_ci	int			removed;
2562306a36Sopenharmony_ci	struct net_device	*dev;
2662306a36Sopenharmony_ci	struct iw_statistics	iwstats;
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci	int			endp_in;
2962306a36Sopenharmony_ci	int			endp_out;
3062306a36Sopenharmony_ci	int			endp_out2;
3162306a36Sopenharmony_ci	struct urb		*rx_urb;
3262306a36Sopenharmony_ci	struct urb		*tx_urb;
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci	unsigned char 		rxdata[ZD1201_RXSIZE];
3562306a36Sopenharmony_ci	int			rxlen;
3662306a36Sopenharmony_ci	wait_queue_head_t	rxdataq;
3762306a36Sopenharmony_ci	int			rxdatas;
3862306a36Sopenharmony_ci	struct hlist_head	fraglist;
3962306a36Sopenharmony_ci	unsigned char		txdata[ZD1201_RXSIZE];
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci	int			ap;
4262306a36Sopenharmony_ci	char			essid[IW_ESSID_MAX_SIZE+1];
4362306a36Sopenharmony_ci	int			essidlen;
4462306a36Sopenharmony_ci	int			mac_enabled;
4562306a36Sopenharmony_ci	int			was_enabled;
4662306a36Sopenharmony_ci	int			monitor;
4762306a36Sopenharmony_ci	int			encode_enabled;
4862306a36Sopenharmony_ci	int			encode_restricted;
4962306a36Sopenharmony_ci	unsigned char		encode_keys[ZD1201_NUMKEYS][ZD1201_MAXKEYLEN];
5062306a36Sopenharmony_ci	int			encode_keylen[ZD1201_NUMKEYS];
5162306a36Sopenharmony_ci};
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_cistruct zd1201_frag {
5462306a36Sopenharmony_ci	struct hlist_node	fnode;
5562306a36Sopenharmony_ci	int			seq;
5662306a36Sopenharmony_ci	struct sk_buff		*skb;
5762306a36Sopenharmony_ci};
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ci#define ZD1201SIWHOSTAUTH SIOCIWFIRSTPRIV
6062306a36Sopenharmony_ci#define ZD1201GIWHOSTAUTH ZD1201SIWHOSTAUTH+1
6162306a36Sopenharmony_ci#define ZD1201SIWAUTHSTA SIOCIWFIRSTPRIV+2
6262306a36Sopenharmony_ci#define ZD1201SIWMAXASSOC SIOCIWFIRSTPRIV+4
6362306a36Sopenharmony_ci#define ZD1201GIWMAXASSOC ZD1201SIWMAXASSOC+1
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci#define ZD1201_FW_TIMEOUT	(1000)
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci#define ZD1201_TX_TIMEOUT	(2000)
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ci#define ZD1201_USB_CMDREQ	0
7062306a36Sopenharmony_ci#define ZD1201_USB_RESREQ	1
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_ci#define	ZD1201_CMDCODE_INIT	0x00
7362306a36Sopenharmony_ci#define ZD1201_CMDCODE_ENABLE	0x01
7462306a36Sopenharmony_ci#define ZD1201_CMDCODE_DISABLE	0x02
7562306a36Sopenharmony_ci#define ZD1201_CMDCODE_ALLOC	0x0a
7662306a36Sopenharmony_ci#define ZD1201_CMDCODE_INQUIRE	0x11
7762306a36Sopenharmony_ci#define ZD1201_CMDCODE_SETRXRID	0x17
7862306a36Sopenharmony_ci#define ZD1201_CMDCODE_ACCESS	0x21
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_ci#define ZD1201_PACKET_EVENTSTAT	0x0
8162306a36Sopenharmony_ci#define ZD1201_PACKET_RXDATA	0x1
8262306a36Sopenharmony_ci#define ZD1201_PACKET_INQUIRE	0x2
8362306a36Sopenharmony_ci#define ZD1201_PACKET_RESOURCE	0x3
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_ci#define ZD1201_ACCESSBIT	0x0100
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_ci#define ZD1201_RID_CNFPORTTYPE		0xfc00
8862306a36Sopenharmony_ci#define ZD1201_RID_CNFOWNMACADDR	0xfc01
8962306a36Sopenharmony_ci#define ZD1201_RID_CNFDESIREDSSID	0xfc02
9062306a36Sopenharmony_ci#define ZD1201_RID_CNFOWNCHANNEL	0xfc03
9162306a36Sopenharmony_ci#define ZD1201_RID_CNFOWNSSID		0xfc04
9262306a36Sopenharmony_ci#define ZD1201_RID_CNFMAXDATALEN	0xfc07
9362306a36Sopenharmony_ci#define ZD1201_RID_CNFPMENABLED		0xfc09
9462306a36Sopenharmony_ci#define ZD1201_RID_CNFPMEPS		0xfc0a
9562306a36Sopenharmony_ci#define ZD1201_RID_CNFMAXSLEEPDURATION	0xfc0c
9662306a36Sopenharmony_ci#define ZD1201_RID_CNFDEFAULTKEYID	0xfc23
9762306a36Sopenharmony_ci#define ZD1201_RID_CNFDEFAULTKEY0	0xfc24
9862306a36Sopenharmony_ci#define ZD1201_RID_CNFDEFAULTKEY1	0xfc25
9962306a36Sopenharmony_ci#define ZD1201_RID_CNFDEFAULTKEY2	0xfc26
10062306a36Sopenharmony_ci#define ZD1201_RID_CNFDEFAULTKEY3	0xfc27
10162306a36Sopenharmony_ci#define ZD1201_RID_CNFWEBFLAGS		0xfc28
10262306a36Sopenharmony_ci#define ZD1201_RID_CNFAUTHENTICATION	0xfc2a
10362306a36Sopenharmony_ci#define ZD1201_RID_CNFMAXASSOCSTATIONS	0xfc2b
10462306a36Sopenharmony_ci#define ZD1201_RID_CNFHOSTAUTH		0xfc2e
10562306a36Sopenharmony_ci#define ZD1201_RID_CNFGROUPADDRESS	0xfc80
10662306a36Sopenharmony_ci#define ZD1201_RID_CNFFRAGTHRESHOLD	0xfc82
10762306a36Sopenharmony_ci#define ZD1201_RID_CNFRTSTHRESHOLD	0xfc83
10862306a36Sopenharmony_ci#define ZD1201_RID_TXRATECNTL		0xfc84
10962306a36Sopenharmony_ci#define ZD1201_RID_PROMISCUOUSMODE	0xfc85
11062306a36Sopenharmony_ci#define ZD1201_RID_CNFBASICRATES	0xfcb3
11162306a36Sopenharmony_ci#define ZD1201_RID_AUTHENTICATESTA	0xfce3
11262306a36Sopenharmony_ci#define ZD1201_RID_CURRENTBSSID		0xfd42
11362306a36Sopenharmony_ci#define ZD1201_RID_COMMSQUALITY		0xfd43
11462306a36Sopenharmony_ci#define ZD1201_RID_CURRENTTXRATE	0xfd44
11562306a36Sopenharmony_ci#define ZD1201_RID_CNFMAXTXBUFFERNUMBER	0xfda0
11662306a36Sopenharmony_ci#define ZD1201_RID_CURRENTCHANNEL	0xfdc1
11762306a36Sopenharmony_ci
11862306a36Sopenharmony_ci#define ZD1201_INQ_SCANRESULTS		0xf101
11962306a36Sopenharmony_ci
12062306a36Sopenharmony_ci#define ZD1201_INF_LINKSTATUS		0xf200
12162306a36Sopenharmony_ci#define ZD1201_INF_ASSOCSTATUS		0xf201
12262306a36Sopenharmony_ci#define ZD1201_INF_AUTHREQ		0xf202
12362306a36Sopenharmony_ci
12462306a36Sopenharmony_ci#define ZD1201_ASSOCSTATUS_STAASSOC	0x1
12562306a36Sopenharmony_ci#define ZD1201_ASSOCSTATUS_REASSOC	0x2
12662306a36Sopenharmony_ci#define ZD1201_ASSOCSTATUS_DISASSOC	0x3
12762306a36Sopenharmony_ci#define ZD1201_ASSOCSTATUS_ASSOCFAIL	0x4
12862306a36Sopenharmony_ci#define ZD1201_ASSOCSTATUS_AUTHFAIL	0x5
12962306a36Sopenharmony_ci
13062306a36Sopenharmony_ci#define ZD1201_PORTTYPE_IBSS		0
13162306a36Sopenharmony_ci#define ZD1201_PORTTYPE_BSS		1
13262306a36Sopenharmony_ci#define ZD1201_PORTTYPE_WDS		2
13362306a36Sopenharmony_ci#define ZD1201_PORTTYPE_PSEUDOIBSS	3
13462306a36Sopenharmony_ci#define ZD1201_PORTTYPE_AP		6
13562306a36Sopenharmony_ci
13662306a36Sopenharmony_ci#define ZD1201_RATEB1	1
13762306a36Sopenharmony_ci#define ZD1201_RATEB2	2
13862306a36Sopenharmony_ci#define ZD1201_RATEB5	4	/* 5.5 really, but 5 is shorter :) */
13962306a36Sopenharmony_ci#define ZD1201_RATEB11	8
14062306a36Sopenharmony_ci
14162306a36Sopenharmony_ci#define ZD1201_CNFAUTHENTICATION_OPENSYSTEM	0x0001
14262306a36Sopenharmony_ci#define ZD1201_CNFAUTHENTICATION_SHAREDKEY	0x0002
14362306a36Sopenharmony_ci
14462306a36Sopenharmony_ci#endif /* _INCLUDE_ZD1201_H_ */
145