This source file includes following definitions.
- vnt_mac_set_filter
- vnt_mac_shutdown
- vnt_mac_set_bb_type
- vnt_mac_disable_keyentry
- vnt_mac_set_keyentry
- vnt_mac_reg_bits_off
- vnt_mac_reg_bits_on
- vnt_mac_write_word
- vnt_mac_set_bssid_addr
- vnt_mac_enable_protect_mode
- vnt_mac_disable_protect_mode
- vnt_mac_enable_barker_preamble_mode
- vnt_mac_disable_barker_preamble_mode
- vnt_mac_set_beacon_interval
- vnt_mac_set_led
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 #include <linux/etherdevice.h>
20
21 #include "desc.h"
22 #include "mac.h"
23 #include "usbpipe.h"
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38 void vnt_mac_set_filter(struct vnt_private *priv, u64 mc_filter)
39 {
40 __le64 le_mc = cpu_to_le64(mc_filter);
41
42 vnt_control_out(priv, MESSAGE_TYPE_WRITE, MAC_REG_MAR0,
43 MESSAGE_REQUEST_MACREG, sizeof(le_mc), (u8 *)&le_mc);
44 }
45
46
47
48
49
50
51
52
53
54
55
56
57 void vnt_mac_shutdown(struct vnt_private *priv)
58 {
59 vnt_control_out(priv, MESSAGE_TYPE_MACSHUTDOWN, 0, 0, 0, NULL);
60 }
61
62 void vnt_mac_set_bb_type(struct vnt_private *priv, u8 type)
63 {
64 u8 data[2];
65
66 data[0] = type;
67 data[1] = EnCFG_BBType_MASK;
68
69 vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, MAC_REG_ENCFG0,
70 MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data);
71 }
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87 void vnt_mac_disable_keyentry(struct vnt_private *priv, u8 entry_idx)
88 {
89 vnt_control_out(priv, MESSAGE_TYPE_CLRKEYENTRY, 0, 0,
90 sizeof(entry_idx), &entry_idx);
91 }
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107 void vnt_mac_set_keyentry(struct vnt_private *priv, u16 key_ctl, u32 entry_idx,
108 u32 key_idx, u8 *addr, u8 *key)
109 {
110 struct vnt_mac_set_key set_key;
111 u16 offset;
112
113 offset = MISCFIFO_KEYETRY0;
114 offset += entry_idx * MISCFIFO_KEYENTRYSIZE;
115
116 set_key.u.write.key_ctl = cpu_to_le16(key_ctl);
117 ether_addr_copy(set_key.u.write.addr, addr);
118
119
120 swap(set_key.u.swap[0], set_key.u.swap[1]);
121
122 memcpy(set_key.key, key, WLAN_KEY_LEN_CCMP);
123
124 dev_dbg(&priv->usb->dev, "offset %d key ctl %d set key %24ph\n",
125 offset, key_ctl, (u8 *)&set_key);
126
127 vnt_control_out(priv, MESSAGE_TYPE_SETKEY, offset,
128 (u16)key_idx, sizeof(struct vnt_mac_set_key),
129 (u8 *)&set_key);
130 }
131
132 int vnt_mac_reg_bits_off(struct vnt_private *priv, u8 reg_ofs, u8 bits)
133 {
134 u8 data[2];
135
136 data[0] = 0;
137 data[1] = bits;
138
139 return vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, reg_ofs,
140 MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data);
141 }
142
143 int vnt_mac_reg_bits_on(struct vnt_private *priv, u8 reg_ofs, u8 bits)
144 {
145 u8 data[2];
146
147 data[0] = bits;
148 data[1] = bits;
149
150 return vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, reg_ofs,
151 MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data);
152 }
153
154 void vnt_mac_write_word(struct vnt_private *priv, u8 reg_ofs, u16 word)
155 {
156 u8 data[2];
157
158 data[0] = (u8)(word & 0xff);
159 data[1] = (u8)(word >> 8);
160
161 vnt_control_out(priv, MESSAGE_TYPE_WRITE, reg_ofs,
162 MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data);
163 }
164
165 void vnt_mac_set_bssid_addr(struct vnt_private *priv, u8 *addr)
166 {
167 vnt_control_out(priv, MESSAGE_TYPE_WRITE, MAC_REG_BSSID0,
168 MESSAGE_REQUEST_MACREG, ETH_ALEN, addr);
169 }
170
171 void vnt_mac_enable_protect_mode(struct vnt_private *priv)
172 {
173 u8 data[2];
174
175 data[0] = EnCFG_ProtectMd;
176 data[1] = EnCFG_ProtectMd;
177
178 vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, MAC_REG_ENCFG0,
179 MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data);
180 }
181
182 void vnt_mac_disable_protect_mode(struct vnt_private *priv)
183 {
184 u8 data[2];
185
186 data[0] = 0;
187 data[1] = EnCFG_ProtectMd;
188
189 vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, MAC_REG_ENCFG0,
190 MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data);
191 }
192
193 void vnt_mac_enable_barker_preamble_mode(struct vnt_private *priv)
194 {
195 u8 data[2];
196
197 data[0] = EnCFG_BarkerPream;
198 data[1] = EnCFG_BarkerPream;
199
200 vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, MAC_REG_ENCFG2,
201 MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data);
202 }
203
204 void vnt_mac_disable_barker_preamble_mode(struct vnt_private *priv)
205 {
206 u8 data[2];
207
208 data[0] = 0;
209 data[1] = EnCFG_BarkerPream;
210
211 vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, MAC_REG_ENCFG2,
212 MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data);
213 }
214
215 void vnt_mac_set_beacon_interval(struct vnt_private *priv, u16 interval)
216 {
217 u8 data[2];
218
219 data[0] = (u8)(interval & 0xff);
220 data[1] = (u8)(interval >> 8);
221
222 vnt_control_out(priv, MESSAGE_TYPE_WRITE, MAC_REG_BI,
223 MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data);
224 }
225
226 int vnt_mac_set_led(struct vnt_private *priv, u8 state, u8 led)
227 {
228 u8 data[2];
229
230 data[0] = led;
231 data[1] = state;
232
233 return vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, MAC_REG_PAPEDELAY,
234 MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data);
235 }