18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *	Copyright (c) 2004, 2005 Jeroen Vreeken (pe1rxq@amsat.org)
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *	Parts of this driver have been derived from a wlan-ng version
68c2ecf20Sopenharmony_ci *	modified by ZyDAS.
78c2ecf20Sopenharmony_ci *	Copyright (C) 1999 AbsoluteValue Systems, Inc.  All Rights Reserved.
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#ifndef _INCLUDE_ZD1201_H_
118c2ecf20Sopenharmony_ci#define _INCLUDE_ZD1201_H_
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#define ZD1201_NUMKEYS		4
148c2ecf20Sopenharmony_ci#define ZD1201_MAXKEYLEN	13
158c2ecf20Sopenharmony_ci#define ZD1201_MAXMULTI		16
168c2ecf20Sopenharmony_ci#define ZD1201_FRAGMAX		2500
178c2ecf20Sopenharmony_ci#define ZD1201_FRAGMIN		256
188c2ecf20Sopenharmony_ci#define ZD1201_RTSMAX		2500
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#define ZD1201_RXSIZE		3000
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_cistruct zd1201 {
238c2ecf20Sopenharmony_ci	struct usb_device	*usb;
248c2ecf20Sopenharmony_ci	int			removed;
258c2ecf20Sopenharmony_ci	struct net_device	*dev;
268c2ecf20Sopenharmony_ci	struct iw_statistics	iwstats;
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci	int			endp_in;
298c2ecf20Sopenharmony_ci	int			endp_out;
308c2ecf20Sopenharmony_ci	int			endp_out2;
318c2ecf20Sopenharmony_ci	struct urb		*rx_urb;
328c2ecf20Sopenharmony_ci	struct urb		*tx_urb;
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci	unsigned char 		rxdata[ZD1201_RXSIZE];
358c2ecf20Sopenharmony_ci	int			rxlen;
368c2ecf20Sopenharmony_ci	wait_queue_head_t	rxdataq;
378c2ecf20Sopenharmony_ci	int			rxdatas;
388c2ecf20Sopenharmony_ci	struct hlist_head	fraglist;
398c2ecf20Sopenharmony_ci	unsigned char		txdata[ZD1201_RXSIZE];
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci	int			ap;
428c2ecf20Sopenharmony_ci	char			essid[IW_ESSID_MAX_SIZE+1];
438c2ecf20Sopenharmony_ci	int			essidlen;
448c2ecf20Sopenharmony_ci	int			mac_enabled;
458c2ecf20Sopenharmony_ci	int			was_enabled;
468c2ecf20Sopenharmony_ci	int			monitor;
478c2ecf20Sopenharmony_ci	int			encode_enabled;
488c2ecf20Sopenharmony_ci	int			encode_restricted;
498c2ecf20Sopenharmony_ci	unsigned char		encode_keys[ZD1201_NUMKEYS][ZD1201_MAXKEYLEN];
508c2ecf20Sopenharmony_ci	int			encode_keylen[ZD1201_NUMKEYS];
518c2ecf20Sopenharmony_ci};
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_cistruct zd1201_frag {
548c2ecf20Sopenharmony_ci	struct hlist_node	fnode;
558c2ecf20Sopenharmony_ci	int			seq;
568c2ecf20Sopenharmony_ci	struct sk_buff		*skb;
578c2ecf20Sopenharmony_ci};
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci#define ZD1201SIWHOSTAUTH SIOCIWFIRSTPRIV
608c2ecf20Sopenharmony_ci#define ZD1201GIWHOSTAUTH ZD1201SIWHOSTAUTH+1
618c2ecf20Sopenharmony_ci#define ZD1201SIWAUTHSTA SIOCIWFIRSTPRIV+2
628c2ecf20Sopenharmony_ci#define ZD1201SIWMAXASSOC SIOCIWFIRSTPRIV+4
638c2ecf20Sopenharmony_ci#define ZD1201GIWMAXASSOC ZD1201SIWMAXASSOC+1
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci#define ZD1201_FW_TIMEOUT	(1000)
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci#define ZD1201_TX_TIMEOUT	(2000)
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci#define ZD1201_USB_CMDREQ	0
708c2ecf20Sopenharmony_ci#define ZD1201_USB_RESREQ	1
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci#define	ZD1201_CMDCODE_INIT	0x00
738c2ecf20Sopenharmony_ci#define ZD1201_CMDCODE_ENABLE	0x01
748c2ecf20Sopenharmony_ci#define ZD1201_CMDCODE_DISABLE	0x02
758c2ecf20Sopenharmony_ci#define ZD1201_CMDCODE_ALLOC	0x0a
768c2ecf20Sopenharmony_ci#define ZD1201_CMDCODE_INQUIRE	0x11
778c2ecf20Sopenharmony_ci#define ZD1201_CMDCODE_SETRXRID	0x17
788c2ecf20Sopenharmony_ci#define ZD1201_CMDCODE_ACCESS	0x21
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci#define ZD1201_PACKET_EVENTSTAT	0x0
818c2ecf20Sopenharmony_ci#define ZD1201_PACKET_RXDATA	0x1
828c2ecf20Sopenharmony_ci#define ZD1201_PACKET_INQUIRE	0x2
838c2ecf20Sopenharmony_ci#define ZD1201_PACKET_RESOURCE	0x3
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci#define ZD1201_ACCESSBIT	0x0100
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci#define ZD1201_RID_CNFPORTTYPE		0xfc00
888c2ecf20Sopenharmony_ci#define ZD1201_RID_CNFOWNMACADDR	0xfc01
898c2ecf20Sopenharmony_ci#define ZD1201_RID_CNFDESIREDSSID	0xfc02
908c2ecf20Sopenharmony_ci#define ZD1201_RID_CNFOWNCHANNEL	0xfc03
918c2ecf20Sopenharmony_ci#define ZD1201_RID_CNFOWNSSID		0xfc04
928c2ecf20Sopenharmony_ci#define ZD1201_RID_CNFMAXDATALEN	0xfc07
938c2ecf20Sopenharmony_ci#define ZD1201_RID_CNFPMENABLED		0xfc09
948c2ecf20Sopenharmony_ci#define ZD1201_RID_CNFPMEPS		0xfc0a
958c2ecf20Sopenharmony_ci#define ZD1201_RID_CNFMAXSLEEPDURATION	0xfc0c
968c2ecf20Sopenharmony_ci#define ZD1201_RID_CNFDEFAULTKEYID	0xfc23
978c2ecf20Sopenharmony_ci#define ZD1201_RID_CNFDEFAULTKEY0	0xfc24
988c2ecf20Sopenharmony_ci#define ZD1201_RID_CNFDEFAULTKEY1	0xfc25
998c2ecf20Sopenharmony_ci#define ZD1201_RID_CNFDEFAULTKEY2	0xfc26
1008c2ecf20Sopenharmony_ci#define ZD1201_RID_CNFDEFAULTKEY3	0xfc27
1018c2ecf20Sopenharmony_ci#define ZD1201_RID_CNFWEBFLAGS		0xfc28
1028c2ecf20Sopenharmony_ci#define ZD1201_RID_CNFAUTHENTICATION	0xfc2a
1038c2ecf20Sopenharmony_ci#define ZD1201_RID_CNFMAXASSOCSTATIONS	0xfc2b
1048c2ecf20Sopenharmony_ci#define ZD1201_RID_CNFHOSTAUTH		0xfc2e
1058c2ecf20Sopenharmony_ci#define ZD1201_RID_CNFGROUPADDRESS	0xfc80
1068c2ecf20Sopenharmony_ci#define ZD1201_RID_CNFFRAGTHRESHOLD	0xfc82
1078c2ecf20Sopenharmony_ci#define ZD1201_RID_CNFRTSTHRESHOLD	0xfc83
1088c2ecf20Sopenharmony_ci#define ZD1201_RID_TXRATECNTL		0xfc84
1098c2ecf20Sopenharmony_ci#define ZD1201_RID_PROMISCUOUSMODE	0xfc85
1108c2ecf20Sopenharmony_ci#define ZD1201_RID_CNFBASICRATES	0xfcb3
1118c2ecf20Sopenharmony_ci#define ZD1201_RID_AUTHENTICATESTA	0xfce3
1128c2ecf20Sopenharmony_ci#define ZD1201_RID_CURRENTBSSID		0xfd42
1138c2ecf20Sopenharmony_ci#define ZD1201_RID_COMMSQUALITY		0xfd43
1148c2ecf20Sopenharmony_ci#define ZD1201_RID_CURRENTTXRATE	0xfd44
1158c2ecf20Sopenharmony_ci#define ZD1201_RID_CNFMAXTXBUFFERNUMBER	0xfda0
1168c2ecf20Sopenharmony_ci#define ZD1201_RID_CURRENTCHANNEL	0xfdc1
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_ci#define ZD1201_INQ_SCANRESULTS		0xf101
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci#define ZD1201_INF_LINKSTATUS		0xf200
1218c2ecf20Sopenharmony_ci#define ZD1201_INF_ASSOCSTATUS		0xf201
1228c2ecf20Sopenharmony_ci#define ZD1201_INF_AUTHREQ		0xf202
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_ci#define ZD1201_ASSOCSTATUS_STAASSOC	0x1
1258c2ecf20Sopenharmony_ci#define ZD1201_ASSOCSTATUS_REASSOC	0x2
1268c2ecf20Sopenharmony_ci#define ZD1201_ASSOCSTATUS_DISASSOC	0x3
1278c2ecf20Sopenharmony_ci#define ZD1201_ASSOCSTATUS_ASSOCFAIL	0x4
1288c2ecf20Sopenharmony_ci#define ZD1201_ASSOCSTATUS_AUTHFAIL	0x5
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_ci#define ZD1201_PORTTYPE_IBSS		0
1318c2ecf20Sopenharmony_ci#define ZD1201_PORTTYPE_BSS		1
1328c2ecf20Sopenharmony_ci#define ZD1201_PORTTYPE_WDS		2
1338c2ecf20Sopenharmony_ci#define ZD1201_PORTTYPE_PSEUDOIBSS	3
1348c2ecf20Sopenharmony_ci#define ZD1201_PORTTYPE_AP		6
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ci#define ZD1201_RATEB1	1
1378c2ecf20Sopenharmony_ci#define ZD1201_RATEB2	2
1388c2ecf20Sopenharmony_ci#define ZD1201_RATEB5	4	/* 5.5 really, but 5 is shorter :) */
1398c2ecf20Sopenharmony_ci#define ZD1201_RATEB11	8
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci#define ZD1201_CNFAUTHENTICATION_OPENSYSTEM	0x0001
1428c2ecf20Sopenharmony_ci#define ZD1201_CNFAUTHENTICATION_SHAREDKEY	0x0002
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_ci#endif /* _INCLUDE_ZD1201_H_ */
145