1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37 #include <dev/ic/if_wi_hostap.h>
38
39 struct wi_softc {
40 struct device sc_dev;
41 struct ieee80211com sc_ic;
42 struct ifmedia sc_media;
43 bus_space_handle_t wi_bhandle;
44 bus_space_tag_t wi_btag;
45 bus_space_handle_t wi_lhandle;
46 bus_space_tag_t wi_ltag;
47 bus_size_t wi_cor_offset;
48 int wi_tx_data_id;
49 int wi_tx_mgmt_id;
50 int wi_flags;
51 int wi_if_flags;
52 int wi_cmd_count;
53 u_int16_t wi_procframe;
54 u_int16_t wi_ptype;
55 u_int16_t wi_portnum;
56 u_int16_t wi_max_data_len;
57 u_int16_t wi_rts_thresh;
58 u_int16_t wi_ap_density;
59 u_int16_t wi_tx_rate;
60 u_int16_t wi_create_ibss;
61 u_int16_t wi_channel;
62 u_int16_t wi_pm_enabled;
63 u_int16_t wi_mor_enabled;
64 u_int16_t wi_max_sleep;
65 u_int16_t wi_authtype;
66 u_int16_t wi_roaming;
67 u_int16_t wi_supprates;
68 u_int16_t wi_diversity;
69
70 u_int8_t wi_rxbuf[1596];
71 u_int8_t wi_txbuf[1596];
72 u_int8_t wi_scanbuf[1596];
73 int wi_scan_lock;
74 struct timeout wi_scan_timeout;
75
76 u_int8_t wi_scanbuf_len;
77
78 struct ieee80211_nwid wi_node_name;
79 struct ieee80211_nwid wi_net_name;
80 struct ieee80211_nwid wi_ibss_name;
81
82 int wi_use_wep;
83 int wi_enh_security;
84 int wi_crypto_algorithm;
85 int wi_tx_key;
86 struct wi_ltv_keys wi_keys;
87 struct wi_counters wi_stats;
88 void *sc_ih;
89 struct timeout sc_timo;
90 int sc_firmware_type;
91 int sc_sta_firmware_ver;
92 int sc_pci;
93 struct wihap_info wi_hostap_info;
94 u_int32_t wi_icv;
95 int wi_icv_flag;
96 int wi_ibss_port;
97 int16_t wi_txpower;
98
99 struct {
100 u_int16_t wi_sleep;
101 u_int16_t wi_delaysupp;
102 u_int16_t wi_txsupp;
103 u_int16_t wi_monitor;
104 u_int16_t wi_ledtest;
105 u_int16_t wi_ledtest_param0;
106 u_int16_t wi_ledtest_param1;
107 u_int16_t wi_conttx;
108 u_int16_t wi_conttx_param0;
109 u_int16_t wi_contrx;
110 u_int16_t wi_sigstate;
111 u_int16_t wi_sigstate_param0;
112 u_int16_t wi_confbits;
113 u_int16_t wi_confbits_param0;
114 } wi_debug;
115 void *sc_sdhook;
116 struct wi_usb_softc *wi_usb_cdata;
117
118 struct wi_funcs *sc_funcs;
119 };
120 #define wi_cmd sc->sc_funcs->f_cmd
121 #define wi_read_record sc->sc_funcs->f_read_record
122 #define wi_write_record sc->sc_funcs->f_write_record
123 #define wi_alloc_nicmem sc->sc_funcs->f_alloc_nicmem
124 #define wi_read_data sc->sc_funcs->f_read_data
125 #define wi_write_data sc->sc_funcs->f_write_data
126 #define wi_get_fid sc->sc_funcs->f_get_fid
127 #define wi_init sc->sc_funcs->f_init
128
129
130 #define WI_FLAGS_ATTACHED 0x0001
131 #define WI_FLAGS_INITIALIZED 0x0002
132 #define WI_FLAGS_HAS_WEP 0x0004
133 #define WI_FLAGS_HAS_IBSS 0x0008
134 #define WI_FLAGS_HAS_CREATE_IBSS 0x0010
135 #define WI_FLAGS_HAS_MOR 0x0020
136 #define WI_FLAGS_HAS_ROAMING 0x0040
137 #define WI_FLAGS_HAS_DIVERSITY 0x0080
138 #define WI_FLAGS_HAS_HOSTAP 0x0100
139 #define WI_FLAGS_BUS_PCMCIA 0x0200
140 #define WI_FLAGS_BUS_USB 0x0400
141 #define WI_FLAGS_HAS_ENH_SECURITY 0x0800
142 #define WI_FLAGS_TXPOWER 0x1000
143
144 #define WI_PRT_FMT "%s"
145 #define WI_PRT_ARG(sc) (sc)->sc_dev.dv_xname
146
147 struct wi_funcs {
148 int (*f_cmd)(struct wi_softc *sc, int cmd, int val0, int val1,
149 int val2);
150 int (*f_read_record)(struct wi_softc *sc, struct wi_ltv_gen *ltv);
151 int (*f_write_record)(struct wi_softc *sc,
152 struct wi_ltv_gen *ltv);
153 int (*f_alloc_nicmem)(struct wi_softc *sc, int len, int *id);
154 int (*f_read_data)(struct wi_softc *sc, int id, int off,
155 caddr_t buf, int len);
156 int (*f_write_data)(struct wi_softc *sc, int id, int off,
157 caddr_t buf, int len);
158 int (*f_get_fid)(struct wi_softc *sc, int fid);
159 void (*f_init)(struct wi_softc *sc);
160
161 void (*f_start)(struct ifnet *ifp);
162 int (*f_ioctl)(struct ifnet *, u_long, caddr_t);
163 void (*f_watchdog)(struct ifnet *ifp);
164 void (*f_inquire)(void *xsc);
165 };
166
167 extern struct wi_funcs wi_func_io;
168
169 int wi_attach(struct wi_softc *, struct wi_funcs *);
170 void wi_detach(struct wi_softc *);
171 int wi_intr(void *);
172 void wi_stop(struct wi_softc *);
173 void wi_cor_reset(struct wi_softc *);
174 int wi_mgmt_xmit(struct wi_softc *, caddr_t, int);
175
176 void wi_update_stats(struct wi_softc *sc);
177 void wi_rxeof(struct wi_softc *sc);
178 void wi_txeof(struct wi_softc *sc, int status);