Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License along |
| 16 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 18 | * |
| 19 | * |
| 20 | * File: mac.c |
| 21 | * |
| 22 | * Purpose: MAC routines |
| 23 | * |
| 24 | * Author: Tevin Chen |
| 25 | * |
| 26 | * Date: May 21, 1996 |
| 27 | * |
| 28 | * Functions: |
| 29 | * |
| 30 | * Revision History: |
| 31 | */ |
| 32 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 33 | #include "tmacro.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 34 | #include "tether.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 35 | #include "desc.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 36 | #include "mac.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 37 | #include "80211hdr.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 38 | #include "rndis.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 39 | #include "control.h" |
Jim Lieb | 9d26d60 | 2009-08-12 14:54:08 -0700 | [diff] [blame] | 40 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 41 | /*--------------------- Static Definitions -------------------------*/ |
| 42 | //static int msglevel =MSG_LEVEL_DEBUG; |
| 43 | static int msglevel =MSG_LEVEL_INFO; |
| 44 | /*--------------------- Static Classes ----------------------------*/ |
| 45 | |
| 46 | /*--------------------- Static Variables --------------------------*/ |
| 47 | |
| 48 | /*--------------------- Static Functions --------------------------*/ |
| 49 | |
| 50 | /*--------------------- Export Variables --------------------------*/ |
| 51 | |
| 52 | /*--------------------- Export Functions --------------------------*/ |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | /* |
| 59 | * Description: |
| 60 | * Set this hash index into multicast address register bit |
| 61 | * |
| 62 | * Parameters: |
| 63 | * In: |
| 64 | * byHashIdx - Hash index to set |
| 65 | * Out: |
| 66 | * none |
| 67 | * |
| 68 | * Return Value: none |
| 69 | * |
| 70 | */ |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 71 | void MACvSetMultiAddrByHash(struct vnt_private *pDevice, u8 byHashIdx) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 72 | { |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 73 | u8 uByteIdx; |
| 74 | u8 byBitMask; |
| 75 | u8 pbyData[2]; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 76 | |
| 77 | |
| 78 | // calculate byte position |
| 79 | uByteIdx = byHashIdx / 8; |
| 80 | |
| 81 | // calculate bit position |
| 82 | byBitMask = 1; |
| 83 | byBitMask <<= (byHashIdx % 8); |
| 84 | // turn on the bit |
| 85 | |
| 86 | pbyData[0] = byBitMask; |
| 87 | pbyData[1] = byBitMask; |
| 88 | |
| 89 | CONTROLnsRequestOut(pDevice, |
| 90 | MESSAGE_TYPE_WRITE_MASK, |
| 91 | (WORD) (MAC_REG_MAR0 + uByteIdx), |
| 92 | MESSAGE_REQUEST_MACREG, |
| 93 | 2, |
| 94 | pbyData); |
| 95 | } |
| 96 | |
| 97 | |
| 98 | |
| 99 | /* |
| 100 | * Description: |
| 101 | * Write MAC Multicast Address Mask |
| 102 | * |
| 103 | * Parameters: |
| 104 | * In: |
| 105 | * uByteidx - Index of Mask |
| 106 | * byData - Mask Value to write |
| 107 | * Out: |
| 108 | * none |
| 109 | * |
| 110 | * Return Value: none |
| 111 | * |
| 112 | */ |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 113 | void MACvWriteMultiAddr(struct vnt_private *pDevice, u32 uByteIdx, u8 byData) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 114 | { |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 115 | u8 byData1; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 116 | |
| 117 | byData1 = byData; |
| 118 | CONTROLnsRequestOut(pDevice, |
| 119 | MESSAGE_TYPE_WRITE, |
| 120 | (WORD) (MAC_REG_MAR0 + uByteIdx), |
| 121 | MESSAGE_REQUEST_MACREG, |
| 122 | 1, |
| 123 | &byData1); |
| 124 | } |
| 125 | |
| 126 | |
| 127 | /* |
| 128 | * Description: |
| 129 | * Shut Down MAC |
| 130 | * |
| 131 | * Parameters: |
| 132 | * In: |
| 133 | * Out: |
| 134 | * none |
| 135 | * |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 136 | * |
| 137 | */ |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 138 | void MACbShutdown(struct vnt_private *pDevice) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 139 | { |
| 140 | CONTROLnsRequestOutAsyn(pDevice, |
| 141 | MESSAGE_TYPE_MACSHUTDOWN, |
| 142 | 0, |
| 143 | 0, |
| 144 | 0, |
| 145 | NULL |
| 146 | ); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 147 | } |
| 148 | |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 149 | void MACvSetBBType(struct vnt_private *pDevice, u8 byType) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 150 | { |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 151 | u8 pbyData[2]; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 152 | |
| 153 | |
| 154 | pbyData[0] = byType; |
| 155 | pbyData[1] = EnCFG_BBType_MASK; |
| 156 | |
| 157 | CONTROLnsRequestOut(pDevice, |
| 158 | MESSAGE_TYPE_WRITE_MASK, |
| 159 | MAC_REG_ENCFG0, |
| 160 | MESSAGE_REQUEST_MACREG, |
| 161 | 2, |
| 162 | pbyData |
| 163 | ); |
| 164 | } |
| 165 | |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 166 | void MACvSetMISCFifo(struct vnt_private *pDevice, u16 wOffset, u32 dwData) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 167 | { |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 168 | u8 pbyData[4]; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 169 | |
| 170 | if (wOffset > 273) |
| 171 | return; |
| 172 | pbyData[0] = (BYTE)dwData; |
| 173 | pbyData[1] = (BYTE)(dwData>>8); |
| 174 | pbyData[2] = (BYTE)(dwData>>16); |
| 175 | pbyData[3] = (BYTE)(dwData>>24); |
| 176 | |
| 177 | CONTROLnsRequestOut(pDevice, |
| 178 | MESSAGE_TYPE_WRITE_MISCFF, |
| 179 | wOffset, |
| 180 | 0, |
| 181 | 4, |
| 182 | pbyData |
| 183 | ); |
| 184 | } |
| 185 | |
| 186 | /* |
| 187 | * Description: |
| 188 | * Disable the Key Entry by MISCFIFO |
| 189 | * |
| 190 | * Parameters: |
| 191 | * In: |
| 192 | * dwIoBase - Base Address for MAC |
| 193 | * |
| 194 | * Out: |
| 195 | * none |
| 196 | * |
| 197 | * Return Value: none |
| 198 | * |
| 199 | */ |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 200 | void MACvDisableKeyEntry(struct vnt_private *pDevice, u32 uEntryIdx) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 201 | { |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 202 | u16 wOffset; |
| 203 | u8 byData; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 204 | |
| 205 | |
| 206 | byData = (BYTE) uEntryIdx; |
| 207 | |
| 208 | wOffset = MISCFIFO_KEYETRY0; |
| 209 | wOffset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE); |
| 210 | |
| 211 | //VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset); |
| 212 | //VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, 0); |
| 213 | //VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); |
| 214 | |
| 215 | //issue write misc fifo command to device |
| 216 | CONTROLnsRequestOut(pDevice, |
| 217 | MESSAGE_TYPE_CLRKEYENTRY, |
| 218 | 0, |
| 219 | 0, |
| 220 | 1, |
| 221 | &byData |
| 222 | ); |
| 223 | } |
| 224 | |
| 225 | |
| 226 | /* |
| 227 | * Description: |
| 228 | * Set the Key by MISCFIFO |
| 229 | * |
| 230 | * Parameters: |
| 231 | * In: |
| 232 | * dwIoBase - Base Address for MAC |
| 233 | * |
| 234 | * Out: |
| 235 | * none |
| 236 | * |
| 237 | * Return Value: none |
| 238 | * |
| 239 | */ |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 240 | void MACvSetKeyEntry(struct vnt_private *pDevice, u16 wKeyCtl, u32 uEntryIdx, |
| 241 | u32 uKeyIdx, u8 *pbyAddr, u32 *pdwKey) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 242 | { |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 243 | u8 *pbyKey; |
| 244 | u16 wOffset; |
| 245 | u32 dwData1, dwData2; |
| 246 | int ii; |
| 247 | u8 pbyData[24]; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 248 | |
Malcolm Priestley | 14c5ef5 | 2013-01-17 23:19:37 +0000 | [diff] [blame^] | 249 | if (pDevice->byLocalID <= MAC_REVISION_A1) |
| 250 | if (pDevice->vnt_mgmt.byCSSPK == KEY_CTL_CCMP) |
| 251 | return; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 252 | |
| 253 | wOffset = MISCFIFO_KEYETRY0; |
| 254 | wOffset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE); |
| 255 | |
| 256 | dwData1 = 0; |
| 257 | dwData1 |= wKeyCtl; |
| 258 | dwData1 <<= 16; |
| 259 | dwData1 |= MAKEWORD(*(pbyAddr+4), *(pbyAddr+5)); |
| 260 | |
Malcolm Priestley | b4dc03a | 2012-11-11 15:45:52 +0000 | [diff] [blame] | 261 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"1. wOffset: %d, Data: %X,"\ |
| 262 | " KeyCtl:%X\n", wOffset, dwData1, wKeyCtl); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 263 | |
| 264 | //VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset); |
| 265 | //VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData); |
| 266 | //VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); |
| 267 | |
| 268 | //wOffset++; |
| 269 | |
| 270 | dwData2 = 0; |
| 271 | dwData2 |= *(pbyAddr+3); |
| 272 | dwData2 <<= 8; |
| 273 | dwData2 |= *(pbyAddr+2); |
| 274 | dwData2 <<= 8; |
| 275 | dwData2 |= *(pbyAddr+1); |
| 276 | dwData2 <<= 8; |
| 277 | dwData2 |= *(pbyAddr+0); |
| 278 | |
Malcolm Priestley | b4dc03a | 2012-11-11 15:45:52 +0000 | [diff] [blame] | 279 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"2. wOffset: %d, Data: %X\n", |
| 280 | wOffset, dwData2); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 281 | |
| 282 | //VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset); |
| 283 | //VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData); |
| 284 | //VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); |
| 285 | |
| 286 | //wOffset++; |
| 287 | |
| 288 | //wOffset += (uKeyIdx * 4); |
| 289 | /* for (ii=0;ii<4;ii++) { |
| 290 | // alway push 128 bits |
| 291 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"3.(%d) wOffset: %d, Data: %lX\n", ii, wOffset+ii, *pdwKey); |
| 292 | VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset+ii); |
| 293 | VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, *pdwKey++); |
| 294 | VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); |
| 295 | } |
| 296 | */ |
| 297 | pbyKey = (PBYTE)pdwKey; |
| 298 | |
| 299 | pbyData[0] = (BYTE)dwData1; |
| 300 | pbyData[1] = (BYTE)(dwData1>>8); |
| 301 | pbyData[2] = (BYTE)(dwData1>>16); |
| 302 | pbyData[3] = (BYTE)(dwData1>>24); |
| 303 | pbyData[4] = (BYTE)dwData2; |
| 304 | pbyData[5] = (BYTE)(dwData2>>8); |
| 305 | pbyData[6] = (BYTE)(dwData2>>16); |
| 306 | pbyData[7] = (BYTE)(dwData2>>24); |
Andres More | 33d33e42 | 2010-05-19 23:50:00 -0300 | [diff] [blame] | 307 | for (ii = 8; ii < 24; ii++) |
| 308 | pbyData[ii] = *pbyKey++; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 309 | |
| 310 | CONTROLnsRequestOut(pDevice, |
| 311 | MESSAGE_TYPE_SETKEY, |
| 312 | wOffset, |
| 313 | (WORD)uKeyIdx, |
| 314 | 24, |
| 315 | pbyData |
| 316 | ); |
| 317 | |
| 318 | |
| 319 | } |
| 320 | |
| 321 | |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 322 | void MACvRegBitsOff(struct vnt_private *pDevice, u8 byRegOfs, u8 byBits) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 323 | { |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 324 | u8 pbyData[2]; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 325 | |
| 326 | pbyData[0] = 0; |
| 327 | pbyData[1] = byBits; |
| 328 | |
| 329 | CONTROLnsRequestOut(pDevice, |
| 330 | MESSAGE_TYPE_WRITE_MASK, |
| 331 | byRegOfs, |
| 332 | MESSAGE_REQUEST_MACREG, |
| 333 | 2, |
| 334 | pbyData |
| 335 | ); |
| 336 | } |
| 337 | |
| 338 | |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 339 | void MACvRegBitsOn(struct vnt_private *pDevice, u8 byRegOfs, u8 byBits) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 340 | { |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 341 | u8 pbyData[2]; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 342 | |
| 343 | |
| 344 | pbyData[0] = byBits; |
| 345 | pbyData[1] = byBits; |
| 346 | |
| 347 | CONTROLnsRequestOut(pDevice, |
| 348 | MESSAGE_TYPE_WRITE_MASK, |
| 349 | byRegOfs, |
| 350 | MESSAGE_REQUEST_MACREG, |
| 351 | 2, |
| 352 | pbyData |
| 353 | ); |
| 354 | } |
| 355 | |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 356 | void MACvWriteWord(struct vnt_private *pDevice, u8 byRegOfs, u16 wData) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 357 | { |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 358 | u8 pbyData[2]; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 359 | |
| 360 | |
| 361 | pbyData[0] = (BYTE)(wData & 0xff); |
| 362 | pbyData[1] = (BYTE)(wData >> 8); |
| 363 | |
| 364 | CONTROLnsRequestOut(pDevice, |
| 365 | MESSAGE_TYPE_WRITE, |
| 366 | byRegOfs, |
| 367 | MESSAGE_REQUEST_MACREG, |
| 368 | 2, |
| 369 | pbyData |
| 370 | ); |
| 371 | |
| 372 | } |
| 373 | |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 374 | void MACvWriteBSSIDAddress(struct vnt_private *pDevice, u8 *pbyEtherAddr) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 375 | { |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 376 | u8 pbyData[6]; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 377 | |
| 378 | |
| 379 | pbyData[0] = *((PBYTE)pbyEtherAddr); |
| 380 | pbyData[1] = *((PBYTE)pbyEtherAddr+1); |
| 381 | pbyData[2] = *((PBYTE)pbyEtherAddr+2); |
| 382 | pbyData[3] = *((PBYTE)pbyEtherAddr+3); |
| 383 | pbyData[4] = *((PBYTE)pbyEtherAddr+4); |
| 384 | pbyData[5] = *((PBYTE)pbyEtherAddr+5); |
| 385 | |
| 386 | CONTROLnsRequestOut(pDevice, |
| 387 | MESSAGE_TYPE_WRITE, |
| 388 | MAC_REG_BSSID0, |
| 389 | MESSAGE_REQUEST_MACREG, |
| 390 | 6, |
| 391 | pbyData |
| 392 | ); |
| 393 | } |
| 394 | |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 395 | void MACvEnableProtectMD(struct vnt_private *pDevice) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 396 | { |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 397 | u8 pbyData[2]; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 398 | |
| 399 | |
| 400 | pbyData[0] = EnCFG_ProtectMd; |
| 401 | pbyData[1] = EnCFG_ProtectMd; |
| 402 | |
| 403 | CONTROLnsRequestOut(pDevice, |
| 404 | MESSAGE_TYPE_WRITE_MASK, |
| 405 | MAC_REG_ENCFG0, |
| 406 | MESSAGE_REQUEST_MACREG, |
| 407 | 2, |
| 408 | pbyData |
| 409 | ); |
| 410 | } |
| 411 | |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 412 | void MACvDisableProtectMD(struct vnt_private *pDevice) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 413 | { |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 414 | u8 pbyData[2]; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 415 | |
| 416 | |
| 417 | pbyData[0] = 0; |
| 418 | pbyData[1] = EnCFG_ProtectMd; |
| 419 | |
| 420 | CONTROLnsRequestOut(pDevice, |
| 421 | MESSAGE_TYPE_WRITE_MASK, |
| 422 | MAC_REG_ENCFG0, |
| 423 | MESSAGE_REQUEST_MACREG, |
| 424 | 2, |
| 425 | pbyData |
| 426 | ); |
| 427 | } |
| 428 | |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 429 | void MACvEnableBarkerPreambleMd(struct vnt_private *pDevice) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 430 | { |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 431 | u8 pbyData[2]; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 432 | |
| 433 | |
| 434 | pbyData[0] = EnCFG_BarkerPream; |
| 435 | pbyData[1] = EnCFG_BarkerPream; |
| 436 | |
| 437 | CONTROLnsRequestOut(pDevice, |
| 438 | MESSAGE_TYPE_WRITE_MASK, |
| 439 | MAC_REG_ENCFG2, |
| 440 | MESSAGE_REQUEST_MACREG, |
| 441 | 2, |
| 442 | pbyData |
| 443 | ); |
| 444 | } |
| 445 | |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 446 | void MACvDisableBarkerPreambleMd(struct vnt_private *pDevice) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 447 | { |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 448 | u8 pbyData[2]; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 449 | |
| 450 | |
| 451 | pbyData[0] = 0; |
| 452 | pbyData[1] = EnCFG_BarkerPream; |
| 453 | |
| 454 | CONTROLnsRequestOut(pDevice, |
| 455 | MESSAGE_TYPE_WRITE_MASK, |
| 456 | MAC_REG_ENCFG2, |
| 457 | MESSAGE_REQUEST_MACREG, |
| 458 | 2, |
| 459 | pbyData |
| 460 | ); |
| 461 | } |
| 462 | |
| 463 | |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 464 | void MACvWriteBeaconInterval(struct vnt_private *pDevice, u16 wInterval) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 465 | { |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 466 | u8 pbyData[2]; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 467 | |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 468 | pbyData[0] = (u8)(wInterval & 0xff); |
| 469 | pbyData[1] = (u8)(wInterval >> 8); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 470 | |
| 471 | CONTROLnsRequestOut(pDevice, |
Clelia V. Korol | b411f12 | 2010-09-16 15:00:19 -0300 | [diff] [blame] | 472 | MESSAGE_TYPE_WRITE, |
| 473 | MAC_REG_BI, |
| 474 | MESSAGE_REQUEST_MACREG, |
| 475 | 2, |
| 476 | pbyData |
| 477 | ); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 478 | } |