Forest Bond | 5449c68 | 2009-04-25 10:30:44 -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.h |
| 21 | * |
| 22 | * Purpose: MAC routines |
| 23 | * |
| 24 | * Author: Tevin Chen |
| 25 | * |
| 26 | * Date: May 21, 1996 |
Jim Lieb | 612822f | 2009-08-12 14:54:03 -0700 | [diff] [blame] | 27 | * |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 28 | * Revision History: |
| 29 | * 07-01-2003 Bryan YC Fan: Re-write codes to support VT3253 spec. |
| 30 | * 08-25-2003 Kyle Hsu: Porting MAC functions from sim53. |
| 31 | * 09-03-2003 Bryan YC Fan: Add MACvDisableProtectMD & MACvEnableProtectMD |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 32 | */ |
| 33 | |
| 34 | #ifndef __MAC_H__ |
| 35 | #define __MAC_H__ |
| 36 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 37 | #include "tmacro.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 38 | #include "upc.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 39 | |
| 40 | /*--------------------- Export Definitions -------------------------*/ |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 41 | /* Registers in the MAC */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 42 | #define MAC_MAX_CONTEXT_SIZE_PAGE0 256 |
| 43 | #define MAC_MAX_CONTEXT_SIZE_PAGE1 128 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 44 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 45 | /* Registers not related to 802.11b */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 46 | #define MAC_REG_BCFG0 0x00 |
| 47 | #define MAC_REG_BCFG1 0x01 |
| 48 | #define MAC_REG_FCR0 0x02 |
| 49 | #define MAC_REG_FCR1 0x03 |
| 50 | #define MAC_REG_BISTCMD 0x04 |
| 51 | #define MAC_REG_BISTSR0 0x05 |
| 52 | #define MAC_REG_BISTSR1 0x06 |
| 53 | #define MAC_REG_BISTSR2 0x07 |
| 54 | #define MAC_REG_I2MCSR 0x08 |
| 55 | #define MAC_REG_I2MTGID 0x09 |
| 56 | #define MAC_REG_I2MTGAD 0x0A |
| 57 | #define MAC_REG_I2MCFG 0x0B |
| 58 | #define MAC_REG_I2MDIPT 0x0C |
| 59 | #define MAC_REG_I2MDOPT 0x0E |
| 60 | #define MAC_REG_PMC0 0x10 |
| 61 | #define MAC_REG_PMC1 0x11 |
| 62 | #define MAC_REG_STICKHW 0x12 |
| 63 | #define MAC_REG_LOCALID 0x14 |
| 64 | #define MAC_REG_TESTCFG 0x15 |
| 65 | #define MAC_REG_JUMPER0 0x16 |
| 66 | #define MAC_REG_JUMPER1 0x17 |
| 67 | #define MAC_REG_TMCTL0 0x18 |
| 68 | #define MAC_REG_TMCTL1 0x19 |
| 69 | #define MAC_REG_TMDATA0 0x1C |
Emrys Bayliss | 0d12e05 | 2015-01-16 03:29:26 +1100 | [diff] [blame] | 70 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 71 | /* MAC Parameter related */ |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 72 | #define MAC_REG_LRT 0x20 |
| 73 | #define MAC_REG_SRT 0x21 |
| 74 | #define MAC_REG_SIFS 0x22 |
| 75 | #define MAC_REG_DIFS 0x23 |
| 76 | #define MAC_REG_EIFS 0x24 |
| 77 | #define MAC_REG_SLOT 0x25 |
| 78 | #define MAC_REG_BI 0x26 |
| 79 | #define MAC_REG_CWMAXMIN0 0x28 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 80 | #define MAC_REG_LINKOFFTOTM 0x2A |
| 81 | #define MAC_REG_SWTMOT 0x2B |
| 82 | #define MAC_REG_MIBCNTR 0x2C |
| 83 | #define MAC_REG_RTSOKCNT 0x2C |
| 84 | #define MAC_REG_RTSFAILCNT 0x2D |
| 85 | #define MAC_REG_ACKFAILCNT 0x2E |
| 86 | #define MAC_REG_FCSERRCNT 0x2F |
Emrys Bayliss | 0d12e05 | 2015-01-16 03:29:26 +1100 | [diff] [blame] | 87 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 88 | /* TSF Related */ |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 89 | #define MAC_REG_TSFCNTR 0x30 |
| 90 | #define MAC_REG_NEXTTBTT 0x38 |
| 91 | #define MAC_REG_TSFOFST 0x40 |
| 92 | #define MAC_REG_TFTCTL 0x48 |
Emrys Bayliss | 0d12e05 | 2015-01-16 03:29:26 +1100 | [diff] [blame] | 93 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 94 | /* WMAC Control/Status Related */ |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 95 | #define MAC_REG_ENCFG 0x4C |
| 96 | #define MAC_REG_PAGE1SEL 0x4F |
| 97 | #define MAC_REG_CFG 0x50 |
| 98 | #define MAC_REG_TEST 0x52 |
| 99 | #define MAC_REG_HOSTCR 0x54 |
| 100 | #define MAC_REG_MACCR 0x55 |
| 101 | #define MAC_REG_RCR 0x56 |
| 102 | #define MAC_REG_TCR 0x57 |
| 103 | #define MAC_REG_IMR 0x58 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 104 | #define MAC_REG_ISR 0x5C |
Emrys Bayliss | 0d12e05 | 2015-01-16 03:29:26 +1100 | [diff] [blame] | 105 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 106 | /* Power Saving Related */ |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 107 | #define MAC_REG_PSCFG 0x60 |
| 108 | #define MAC_REG_PSCTL 0x61 |
| 109 | #define MAC_REG_PSPWRSIG 0x62 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 110 | #define MAC_REG_BBCR13 0x63 |
| 111 | #define MAC_REG_AIDATIM 0x64 |
| 112 | #define MAC_REG_PWBT 0x66 |
| 113 | #define MAC_REG_WAKEOKTMR 0x68 |
| 114 | #define MAC_REG_CALTMR 0x69 |
| 115 | #define MAC_REG_SYNSPACCNT 0x6A |
| 116 | #define MAC_REG_WAKSYNOPT 0x6B |
Emrys Bayliss | 0d12e05 | 2015-01-16 03:29:26 +1100 | [diff] [blame] | 117 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 118 | /* Baseband/IF Control Group */ |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 119 | #define MAC_REG_BBREGCTL 0x6C |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 120 | #define MAC_REG_CHANNEL 0x6D |
| 121 | #define MAC_REG_BBREGADR 0x6E |
| 122 | #define MAC_REG_BBREGDATA 0x6F |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 123 | #define MAC_REG_IFREGCTL 0x70 |
| 124 | #define MAC_REG_IFDATA 0x71 |
| 125 | #define MAC_REG_ITRTMSET 0x74 |
Jim Lieb | 612822f | 2009-08-12 14:54:03 -0700 | [diff] [blame] | 126 | #define MAC_REG_PAPEDELAY 0x77 |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 127 | #define MAC_REG_SOFTPWRCTL 0x78 |
| 128 | #define MAC_REG_GPIOCTL0 0x7A |
| 129 | #define MAC_REG_GPIOCTL1 0x7B |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 130 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 131 | /* MAC DMA Related Group */ |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 132 | #define MAC_REG_TXDMACTL0 0x7C |
| 133 | #define MAC_REG_TXDMAPTR0 0x80 |
| 134 | #define MAC_REG_AC0DMACTL 0x84 |
| 135 | #define MAC_REG_AC0DMAPTR 0x88 |
| 136 | #define MAC_REG_BCNDMACTL 0x8C |
| 137 | #define MAC_REG_BCNDMAPTR 0x90 |
| 138 | #define MAC_REG_RXDMACTL0 0x94 |
| 139 | #define MAC_REG_RXDMAPTR0 0x98 |
| 140 | #define MAC_REG_RXDMACTL1 0x9C |
| 141 | #define MAC_REG_RXDMAPTR1 0xA0 |
| 142 | #define MAC_REG_SYNCDMACTL 0xA4 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 143 | #define MAC_REG_SYNCDMAPTR 0xA8 |
| 144 | #define MAC_REG_ATIMDMACTL 0xAC |
| 145 | #define MAC_REG_ATIMDMAPTR 0xB0 |
Emrys Bayliss | 0d12e05 | 2015-01-16 03:29:26 +1100 | [diff] [blame] | 146 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 147 | /* MiscFF PIO related */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 148 | #define MAC_REG_MISCFFNDEX 0xB4 |
| 149 | #define MAC_REG_MISCFFCTL 0xB6 |
| 150 | #define MAC_REG_MISCFFDATA 0xB8 |
Emrys Bayliss | 0d12e05 | 2015-01-16 03:29:26 +1100 | [diff] [blame] | 151 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 152 | /* Extend SW Timer */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 153 | #define MAC_REG_TMDATA1 0xBC |
Emrys Bayliss | 0d12e05 | 2015-01-16 03:29:26 +1100 | [diff] [blame] | 154 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 155 | /* WOW Related Group */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 156 | #define MAC_REG_WAKEUPEN0 0xC0 |
| 157 | #define MAC_REG_WAKEUPEN1 0xC1 |
| 158 | #define MAC_REG_WAKEUPSR0 0xC2 |
| 159 | #define MAC_REG_WAKEUPSR1 0xC3 |
| 160 | #define MAC_REG_WAKE128_0 0xC4 |
| 161 | #define MAC_REG_WAKE128_1 0xD4 |
| 162 | #define MAC_REG_WAKE128_2 0xE4 |
| 163 | #define MAC_REG_WAKE128_3 0xF4 |
| 164 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 165 | /************** Page 1 ******************/ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 166 | #define MAC_REG_CRC_128_0 0x04 |
| 167 | #define MAC_REG_CRC_128_1 0x06 |
| 168 | #define MAC_REG_CRC_128_2 0x08 |
| 169 | #define MAC_REG_CRC_128_3 0x0A |
Emrys Bayliss | 0d12e05 | 2015-01-16 03:29:26 +1100 | [diff] [blame] | 170 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 171 | /* MAC Configuration Group */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 172 | #define MAC_REG_PAR0 0x0C |
| 173 | #define MAC_REG_PAR4 0x10 |
| 174 | #define MAC_REG_BSSID0 0x14 |
| 175 | #define MAC_REG_BSSID4 0x18 |
| 176 | #define MAC_REG_MAR0 0x1C |
| 177 | #define MAC_REG_MAR4 0x20 |
Emrys Bayliss | 0d12e05 | 2015-01-16 03:29:26 +1100 | [diff] [blame] | 178 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 179 | /* MAC RSPPKT INFO Group */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 180 | #define MAC_REG_RSPINF_B_1 0x24 |
| 181 | #define MAC_REG_RSPINF_B_2 0x28 |
| 182 | #define MAC_REG_RSPINF_B_5 0x2C |
| 183 | #define MAC_REG_RSPINF_B_11 0x30 |
| 184 | #define MAC_REG_RSPINF_A_6 0x34 |
| 185 | #define MAC_REG_RSPINF_A_9 0x36 |
| 186 | #define MAC_REG_RSPINF_A_12 0x38 |
| 187 | #define MAC_REG_RSPINF_A_18 0x3A |
| 188 | #define MAC_REG_RSPINF_A_24 0x3C |
| 189 | #define MAC_REG_RSPINF_A_36 0x3E |
| 190 | #define MAC_REG_RSPINF_A_48 0x40 |
| 191 | #define MAC_REG_RSPINF_A_54 0x42 |
| 192 | #define MAC_REG_RSPINF_A_72 0x44 |
| 193 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 194 | /* 802.11h relative */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 195 | #define MAC_REG_QUIETINIT 0x60 |
| 196 | #define MAC_REG_QUIETGAP 0x62 |
| 197 | #define MAC_REG_QUIETDUR 0x64 |
| 198 | #define MAC_REG_MSRCTL 0x66 |
| 199 | #define MAC_REG_MSRBBSTS 0x67 |
| 200 | #define MAC_REG_MSRSTART 0x68 |
| 201 | #define MAC_REG_MSRDURATION 0x70 |
| 202 | #define MAC_REG_CCAFRACTION 0x72 |
| 203 | #define MAC_REG_PWRCCK 0x73 |
| 204 | #define MAC_REG_PWROFDM 0x7C |
| 205 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 206 | /* Bits in the BCFG0 register */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 207 | #define BCFG0_PERROFF 0x40 |
| 208 | #define BCFG0_MRDMDIS 0x20 |
| 209 | #define BCFG0_MRDLDIS 0x10 |
| 210 | #define BCFG0_MWMEN 0x08 |
| 211 | #define BCFG0_VSERREN 0x02 |
| 212 | #define BCFG0_LATMEN 0x01 |
| 213 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 214 | /* Bits in the BCFG1 register */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 215 | #define BCFG1_CFUNOPT 0x80 |
| 216 | #define BCFG1_CREQOPT 0x40 |
| 217 | #define BCFG1_DMA8 0x10 |
| 218 | #define BCFG1_ARBITOPT 0x08 |
| 219 | #define BCFG1_PCIMEN 0x04 |
| 220 | #define BCFG1_MIOEN 0x02 |
| 221 | #define BCFG1_CISDLYEN 0x01 |
| 222 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 223 | /* Bits in RAMBIST registers */ |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 224 | #define BISTCMD_TSTPAT5 0x00 |
| 225 | #define BISTCMD_TSTPATA 0x80 |
| 226 | #define BISTCMD_TSTERR 0x20 |
| 227 | #define BISTCMD_TSTPATF 0x18 |
| 228 | #define BISTCMD_TSTPAT0 0x10 |
| 229 | #define BISTCMD_TSTMODE 0x04 |
| 230 | #define BISTCMD_TSTITTX 0x03 |
| 231 | #define BISTCMD_TSTATRX 0x02 |
| 232 | #define BISTCMD_TSTATTX 0x01 |
| 233 | #define BISTCMD_TSTRX 0x00 |
| 234 | #define BISTSR0_BISTGO 0x01 |
| 235 | #define BISTSR1_TSTSR 0x01 |
| 236 | #define BISTSR2_CMDPRTEN 0x02 |
| 237 | #define BISTSR2_RAMTSTEN 0x01 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 238 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 239 | /* Bits in the I2MCFG EEPROM register */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 240 | #define I2MCFG_BOUNDCTL 0x80 |
| 241 | #define I2MCFG_WAITCTL 0x20 |
| 242 | #define I2MCFG_SCLOECTL 0x10 |
| 243 | #define I2MCFG_WBUSYCTL 0x08 |
| 244 | #define I2MCFG_NORETRY 0x04 |
| 245 | #define I2MCFG_I2MLDSEQ 0x02 |
| 246 | #define I2MCFG_I2CMFAST 0x01 |
| 247 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 248 | /* Bits in the I2MCSR EEPROM register */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 249 | #define I2MCSR_EEMW 0x80 |
| 250 | #define I2MCSR_EEMR 0x40 |
| 251 | #define I2MCSR_AUTOLD 0x08 |
| 252 | #define I2MCSR_NACK 0x02 |
| 253 | #define I2MCSR_DONE 0x01 |
| 254 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 255 | /* Bits in the PMC1 register */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 256 | #define SPS_RST 0x80 |
| 257 | #define PCISTIKY 0x40 |
| 258 | #define PME_OVR 0x02 |
| 259 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 260 | /* Bits in the STICKYHW register */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 261 | #define STICKHW_DS1_SHADOW 0x02 |
| 262 | #define STICKHW_DS0_SHADOW 0x01 |
| 263 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 264 | /* Bits in the TMCTL register */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 265 | #define TMCTL_TSUSP 0x04 |
| 266 | #define TMCTL_TMD 0x02 |
| 267 | #define TMCTL_TE 0x01 |
| 268 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 269 | /* Bits in the TFTCTL register */ |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 270 | #define TFTCTL_HWUTSF 0x80 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 271 | #define TFTCTL_TBTTSYNC 0x40 |
| 272 | #define TFTCTL_HWUTSFEN 0x20 |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 273 | #define TFTCTL_TSFCNTRRD 0x10 |
| 274 | #define TFTCTL_TBTTSYNCEN 0x08 |
| 275 | #define TFTCTL_TSFSYNCEN 0x04 |
| 276 | #define TFTCTL_TSFCNTRST 0x02 |
| 277 | #define TFTCTL_TSFCNTREN 0x01 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 278 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 279 | /* Bits in the EnhanceCFG register */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 280 | #define EnCFG_BarkerPream 0x00020000 |
| 281 | #define EnCFG_NXTBTTCFPSTR 0x00010000 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 282 | #define EnCFG_BcnSusClr 0x00000200 |
| 283 | #define EnCFG_BcnSusInd 0x00000100 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 284 | #define EnCFG_CFP_ProtectEn 0x00000040 |
| 285 | #define EnCFG_ProtectMd 0x00000020 |
| 286 | #define EnCFG_HwParCFP 0x00000010 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 287 | #define EnCFG_CFNULRSP 0x00000004 |
| 288 | #define EnCFG_BBType_MASK 0x00000003 |
| 289 | #define EnCFG_BBType_g 0x00000002 |
| 290 | #define EnCFG_BBType_b 0x00000001 |
| 291 | #define EnCFG_BBType_a 0x00000000 |
| 292 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 293 | /* Bits in the Page1Sel register */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 294 | #define PAGE1_SEL 0x01 |
| 295 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 296 | /* Bits in the CFG register */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 297 | #define CFG_TKIPOPT 0x80 |
| 298 | #define CFG_RXDMAOPT 0x40 |
| 299 | #define CFG_TMOT_SW 0x20 |
| 300 | #define CFG_TMOT_HWLONG 0x10 |
| 301 | #define CFG_TMOT_HW 0x00 |
| 302 | #define CFG_CFPENDOPT 0x08 |
| 303 | #define CFG_BCNSUSEN 0x04 |
| 304 | #define CFG_NOTXTIMEOUT 0x02 |
| 305 | #define CFG_NOBUFOPT 0x01 |
| 306 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 307 | /* Bits in the TEST register */ |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 308 | #define TEST_LBEXT 0x80 |
| 309 | #define TEST_LBINT 0x40 |
| 310 | #define TEST_LBNONE 0x00 |
| 311 | #define TEST_SOFTINT 0x20 |
| 312 | #define TEST_CONTTX 0x10 |
| 313 | #define TEST_TXPE 0x08 |
| 314 | #define TEST_NAVDIS 0x04 |
| 315 | #define TEST_NOCTS 0x02 |
| 316 | #define TEST_NOACK 0x01 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 317 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 318 | /* Bits in the HOSTCR register */ |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 319 | #define HOSTCR_TXONST 0x80 |
| 320 | #define HOSTCR_RXONST 0x40 |
Emrys Bayliss | 060b505 | 2015-01-16 03:29:24 +1100 | [diff] [blame] | 321 | #define HOSTCR_ADHOC 0x20 /* Network Type 1 = Ad-hoc */ |
| 322 | #define HOSTCR_AP 0x10 /* Port Type 1 = AP */ |
| 323 | #define HOSTCR_TXON 0x08 /* 0000 1000 */ |
| 324 | #define HOSTCR_RXON 0x04 /* 0000 0100 */ |
| 325 | #define HOSTCR_MACEN 0x02 /* 0000 0010 */ |
| 326 | #define HOSTCR_SOFTRST 0x01 /* 0000 0001 */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 327 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 328 | /* Bits in the MACCR register */ |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 329 | #define MACCR_SYNCFLUSHOK 0x04 |
| 330 | #define MACCR_SYNCFLUSH 0x02 |
| 331 | #define MACCR_CLRNAV 0x01 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 332 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 333 | /* Bits in the MAC_REG_GPIOCTL0 register */ |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 334 | #define LED_ACTSET 0x01 |
| 335 | #define LED_RFOFF 0x02 |
| 336 | #define LED_NOCONNECT 0x04 |
Emrys Bayliss | 0d12e05 | 2015-01-16 03:29:26 +1100 | [diff] [blame] | 337 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 338 | /* Bits in the RCR register */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 339 | #define RCR_SSID 0x80 |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 340 | #define RCR_RXALLTYPE 0x40 |
| 341 | #define RCR_UNICAST 0x20 |
| 342 | #define RCR_BROADCAST 0x10 |
| 343 | #define RCR_MULTICAST 0x08 |
| 344 | #define RCR_WPAERR 0x04 |
| 345 | #define RCR_ERRCRC 0x02 |
| 346 | #define RCR_BSSID 0x01 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 347 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 348 | /* Bits in the TCR register */ |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 349 | #define TCR_SYNCDCFOPT 0x02 |
Emrys Bayliss | 060b505 | 2015-01-16 03:29:24 +1100 | [diff] [blame] | 350 | #define TCR_AUTOBCNTX 0x01 /* Beacon automatically transmit enable */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 351 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 352 | /* Bits in the IMR register */ |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 353 | #define IMR_MEASURESTART 0x80000000 |
| 354 | #define IMR_QUIETSTART 0x20000000 |
| 355 | #define IMR_RADARDETECT 0x10000000 |
| 356 | #define IMR_MEASUREEND 0x08000000 |
| 357 | #define IMR_SOFTTIMER1 0x00200000 |
Emrys Bayliss | 060b505 | 2015-01-16 03:29:24 +1100 | [diff] [blame] | 358 | #define IMR_RXDMA1 0x00001000 /* 0000 0000 0001 0000 0000 0000 */ |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 359 | #define IMR_RXNOBUF 0x00000800 |
| 360 | #define IMR_MIBNEARFULL 0x00000400 |
| 361 | #define IMR_SOFTINT 0x00000200 |
| 362 | #define IMR_FETALERR 0x00000100 |
| 363 | #define IMR_WATCHDOG 0x00000080 |
| 364 | #define IMR_SOFTTIMER 0x00000040 |
| 365 | #define IMR_GPIO 0x00000020 |
| 366 | #define IMR_TBTT 0x00000010 |
| 367 | #define IMR_RXDMA0 0x00000008 |
| 368 | #define IMR_BNTX 0x00000004 |
| 369 | #define IMR_AC0DMA 0x00000002 |
| 370 | #define IMR_TXDMA0 0x00000001 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 371 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 372 | /* Bits in the ISR register */ |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 373 | #define ISR_MEASURESTART 0x80000000 |
| 374 | #define ISR_QUIETSTART 0x20000000 |
| 375 | #define ISR_RADARDETECT 0x10000000 |
| 376 | #define ISR_MEASUREEND 0x08000000 |
| 377 | #define ISR_SOFTTIMER1 0x00200000 |
Emrys Bayliss | 060b505 | 2015-01-16 03:29:24 +1100 | [diff] [blame] | 378 | #define ISR_RXDMA1 0x00001000 /* 0000 0000 0001 0000 0000 0000 */ |
| 379 | #define ISR_RXNOBUF 0x00000800 /* 0000 0000 0000 1000 0000 0000 */ |
| 380 | #define ISR_MIBNEARFULL 0x00000400 /* 0000 0000 0000 0100 0000 0000 */ |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 381 | #define ISR_SOFTINT 0x00000200 |
| 382 | #define ISR_FETALERR 0x00000100 |
| 383 | #define ISR_WATCHDOG 0x00000080 |
| 384 | #define ISR_SOFTTIMER 0x00000040 |
| 385 | #define ISR_GPIO 0x00000020 |
| 386 | #define ISR_TBTT 0x00000010 |
| 387 | #define ISR_RXDMA0 0x00000008 |
| 388 | #define ISR_BNTX 0x00000004 |
| 389 | #define ISR_AC0DMA 0x00000002 |
| 390 | #define ISR_TXDMA0 0x00000001 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 391 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 392 | /* Bits in the PSCFG register */ |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 393 | #define PSCFG_PHILIPMD 0x40 |
| 394 | #define PSCFG_WAKECALEN 0x20 |
| 395 | #define PSCFG_WAKETMREN 0x10 |
| 396 | #define PSCFG_BBPSPROG 0x08 |
| 397 | #define PSCFG_WAKESYN 0x04 |
| 398 | #define PSCFG_SLEEPSYN 0x02 |
| 399 | #define PSCFG_AUTOSLEEP 0x01 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 400 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 401 | /* Bits in the PSCTL register */ |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 402 | #define PSCTL_WAKEDONE 0x20 |
| 403 | #define PSCTL_PS 0x10 |
| 404 | #define PSCTL_GO2DOZE 0x08 |
| 405 | #define PSCTL_LNBCN 0x04 |
| 406 | #define PSCTL_ALBCN 0x02 |
| 407 | #define PSCTL_PSEN 0x01 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 408 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 409 | /* Bits in the PSPWSIG register */ |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 410 | #define PSSIG_WPE3 0x80 |
| 411 | #define PSSIG_WPE2 0x40 |
| 412 | #define PSSIG_WPE1 0x20 |
| 413 | #define PSSIG_WRADIOPE 0x10 |
| 414 | #define PSSIG_SPE3 0x08 |
| 415 | #define PSSIG_SPE2 0x04 |
| 416 | #define PSSIG_SPE1 0x02 |
| 417 | #define PSSIG_SRADIOPE 0x01 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 418 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 419 | /* Bits in the BBREGCTL register */ |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 420 | #define BBREGCTL_DONE 0x04 |
| 421 | #define BBREGCTL_REGR 0x02 |
| 422 | #define BBREGCTL_REGW 0x01 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 423 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 424 | /* Bits in the IFREGCTL register */ |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 425 | #define IFREGCTL_DONE 0x04 |
| 426 | #define IFREGCTL_IFRF 0x02 |
| 427 | #define IFREGCTL_REGW 0x01 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 428 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 429 | /* Bits in the SOFTPWRCTL register */ |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 430 | #define SOFTPWRCTL_RFLEOPT 0x0800 |
| 431 | #define SOFTPWRCTL_TXPEINV 0x0200 |
| 432 | #define SOFTPWRCTL_SWPECTI 0x0100 |
| 433 | #define SOFTPWRCTL_SWPAPE 0x0020 |
| 434 | #define SOFTPWRCTL_SWCALEN 0x0010 |
| 435 | #define SOFTPWRCTL_SWRADIO_PE 0x0008 |
| 436 | #define SOFTPWRCTL_SWPE2 0x0004 |
| 437 | #define SOFTPWRCTL_SWPE1 0x0002 |
| 438 | #define SOFTPWRCTL_SWPE3 0x0001 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 439 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 440 | /* Bits in the GPIOCTL1 register */ |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 441 | #define GPIO1_DATA1 0x20 |
| 442 | #define GPIO1_MD1 0x10 |
| 443 | #define GPIO1_DATA0 0x02 |
| 444 | #define GPIO1_MD0 0x01 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 445 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 446 | /* Bits in the DMACTL register */ |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 447 | #define DMACTL_CLRRUN 0x00080000 |
| 448 | #define DMACTL_RUN 0x00000008 |
| 449 | #define DMACTL_WAKE 0x00000004 |
| 450 | #define DMACTL_DEAD 0x00000002 |
| 451 | #define DMACTL_ACTIVE 0x00000001 |
Emrys Bayliss | 0d12e05 | 2015-01-16 03:29:26 +1100 | [diff] [blame] | 452 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 453 | /* Bits in the RXDMACTL0 register */ |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 454 | #define RX_PERPKT 0x00000100 |
| 455 | #define RX_PERPKTCLR 0x01000000 |
Emrys Bayliss | 0d12e05 | 2015-01-16 03:29:26 +1100 | [diff] [blame] | 456 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 457 | /* Bits in the BCNDMACTL register */ |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 458 | #define BEACON_READY 0x01 |
Emrys Bayliss | 0d12e05 | 2015-01-16 03:29:26 +1100 | [diff] [blame] | 459 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 460 | /* Bits in the MISCFFCTL register */ |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 461 | #define MISCFFCTL_WRITE 0x0001 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 462 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 463 | /* Bits in WAKEUPEN0 */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 464 | #define WAKEUPEN0_DIRPKT 0x10 |
| 465 | #define WAKEUPEN0_LINKOFF 0x08 |
| 466 | #define WAKEUPEN0_ATIMEN 0x04 |
| 467 | #define WAKEUPEN0_TIMEN 0x02 |
| 468 | #define WAKEUPEN0_MAGICEN 0x01 |
| 469 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 470 | /* Bits in WAKEUPEN1 */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 471 | #define WAKEUPEN1_128_3 0x08 |
| 472 | #define WAKEUPEN1_128_2 0x04 |
| 473 | #define WAKEUPEN1_128_1 0x02 |
| 474 | #define WAKEUPEN1_128_0 0x01 |
| 475 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 476 | /* Bits in WAKEUPSR0 */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 477 | #define WAKEUPSR0_DIRPKT 0x10 |
| 478 | #define WAKEUPSR0_LINKOFF 0x08 |
| 479 | #define WAKEUPSR0_ATIMEN 0x04 |
| 480 | #define WAKEUPSR0_TIMEN 0x02 |
| 481 | #define WAKEUPSR0_MAGICEN 0x01 |
| 482 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 483 | /* Bits in WAKEUPSR1 */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 484 | #define WAKEUPSR1_128_3 0x08 |
| 485 | #define WAKEUPSR1_128_2 0x04 |
| 486 | #define WAKEUPSR1_128_1 0x02 |
| 487 | #define WAKEUPSR1_128_0 0x01 |
| 488 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 489 | /* Bits in the MAC_REG_GPIOCTL register */ |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 490 | #define GPIO0_MD 0x01 |
| 491 | #define GPIO0_DATA 0x02 |
| 492 | #define GPIO0_INTMD 0x04 |
| 493 | #define GPIO1_MD 0x10 |
| 494 | #define GPIO1_DATA 0x20 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 495 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 496 | /* Bits in the MSRCTL register */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 497 | #define MSRCTL_FINISH 0x80 |
| 498 | #define MSRCTL_READY 0x40 |
| 499 | #define MSRCTL_RADARDETECT 0x20 |
| 500 | #define MSRCTL_EN 0x10 |
| 501 | #define MSRCTL_QUIETTXCHK 0x08 |
| 502 | #define MSRCTL_QUIETRPT 0x04 |
| 503 | #define MSRCTL_QUIETINT 0x02 |
| 504 | #define MSRCTL_QUIETEN 0x01 |
Emrys Bayliss | 0d12e05 | 2015-01-16 03:29:26 +1100 | [diff] [blame] | 505 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 506 | /* Bits in the MSRCTL1 register */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 507 | #define MSRCTL1_TXPWR 0x08 |
| 508 | #define MSRCTL1_CSAPAREN 0x04 |
| 509 | #define MSRCTL1_TXPAUSE 0x01 |
| 510 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 511 | /* Loopback mode */ |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 512 | #define MAC_LB_EXT 0x02 |
| 513 | #define MAC_LB_INTERNAL 0x01 |
| 514 | #define MAC_LB_NONE 0x00 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 515 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 516 | #define Default_BI 0x200 |
| 517 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 518 | /* MiscFIFO Offset */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 519 | #define MISCFIFO_KEYETRY0 32 |
| 520 | #define MISCFIFO_KEYENTRYSIZE 22 |
| 521 | #define MISCFIFO_SYNINFO_IDX 10 |
| 522 | #define MISCFIFO_SYNDATA_IDX 11 |
| 523 | #define MISCFIFO_SYNDATASIZE 21 |
| 524 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 525 | /* enabled mask value of irq */ |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 526 | #define IMR_MASK_VALUE (IMR_SOFTTIMER1 | \ |
| 527 | IMR_RXDMA1 | \ |
| 528 | IMR_RXNOBUF | \ |
| 529 | IMR_MIBNEARFULL | \ |
| 530 | IMR_SOFTINT | \ |
| 531 | IMR_FETALERR | \ |
| 532 | IMR_WATCHDOG | \ |
| 533 | IMR_SOFTTIMER | \ |
| 534 | IMR_GPIO | \ |
| 535 | IMR_TBTT | \ |
| 536 | IMR_RXDMA0 | \ |
| 537 | IMR_BNTX | \ |
| 538 | IMR_AC0DMA | \ |
| 539 | IMR_TXDMA0) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 540 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 541 | /* max time out delay time */ |
Emrys Bayliss | 818b555 | 2015-01-16 03:29:22 +1100 | [diff] [blame] | 542 | #define W_MAX_TIMEOUT 0xFFF0U |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 543 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 544 | /* wait time within loop */ |
Emrys Bayliss | 060b505 | 2015-01-16 03:29:24 +1100 | [diff] [blame] | 545 | #define CB_DELAY_LOOP_WAIT 10 /* 10ms */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 546 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 547 | /* revision id */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 548 | #define REV_ID_VT3253_A0 0x00 |
| 549 | #define REV_ID_VT3253_A1 0x01 |
| 550 | #define REV_ID_VT3253_B0 0x08 |
| 551 | #define REV_ID_VT3253_B1 0x09 |
| 552 | |
| 553 | /*--------------------- Export Types ------------------------------*/ |
| 554 | |
| 555 | /*--------------------- Export Macros ------------------------------*/ |
| 556 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 557 | #define MACvRegBitsOn(dwIoBase, byRegOfs, byBits) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 558 | do { \ |
| 559 | unsigned char byData; \ |
| 560 | VNSvInPortB(dwIoBase + byRegOfs, &byData); \ |
| 561 | VNSvOutPortB(dwIoBase + byRegOfs, byData | (byBits)); \ |
| 562 | } while (0) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 563 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 564 | #define MACvWordRegBitsOn(dwIoBase, byRegOfs, wBits) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 565 | do { \ |
| 566 | unsigned short wData; \ |
| 567 | VNSvInPortW(dwIoBase + byRegOfs, &wData); \ |
| 568 | VNSvOutPortW(dwIoBase + byRegOfs, wData | (wBits)); \ |
| 569 | } while (0) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 570 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 571 | #define MACvDWordRegBitsOn(dwIoBase, byRegOfs, dwBits) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 572 | do { \ |
| 573 | unsigned long dwData; \ |
| 574 | VNSvInPortD(dwIoBase + byRegOfs, &dwData); \ |
| 575 | VNSvOutPortD(dwIoBase + byRegOfs, dwData | (dwBits)); \ |
| 576 | } while (0) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 577 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 578 | #define MACvRegBitsOnEx(dwIoBase, byRegOfs, byMask, byBits) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 579 | do { \ |
| 580 | unsigned char byData; \ |
| 581 | VNSvInPortB(dwIoBase + byRegOfs, &byData); \ |
| 582 | byData &= byMask; \ |
| 583 | VNSvOutPortB(dwIoBase + byRegOfs, byData | (byBits)); \ |
| 584 | } while (0) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 585 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 586 | #define MACvRegBitsOff(dwIoBase, byRegOfs, byBits) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 587 | do { \ |
| 588 | unsigned char byData; \ |
| 589 | VNSvInPortB(dwIoBase + byRegOfs, &byData); \ |
| 590 | VNSvOutPortB(dwIoBase + byRegOfs, byData & ~(byBits)); \ |
| 591 | } while (0) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 592 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 593 | #define MACvWordRegBitsOff(dwIoBase, byRegOfs, wBits) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 594 | do { \ |
| 595 | unsigned short wData; \ |
| 596 | VNSvInPortW(dwIoBase + byRegOfs, &wData); \ |
| 597 | VNSvOutPortW(dwIoBase + byRegOfs, wData & ~(wBits)); \ |
| 598 | } while (0) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 599 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 600 | #define MACvDWordRegBitsOff(dwIoBase, byRegOfs, dwBits) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 601 | do { \ |
| 602 | unsigned long dwData; \ |
| 603 | VNSvInPortD(dwIoBase + byRegOfs, &dwData); \ |
| 604 | VNSvOutPortD(dwIoBase + byRegOfs, dwData & ~(dwBits)); \ |
| 605 | } while (0) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 606 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 607 | #define MACvGetCurrRx0DescAddr(dwIoBase, pdwCurrDescAddr) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 608 | VNSvInPortD(dwIoBase + MAC_REG_RXDMAPTR0, \ |
| 609 | (unsigned long *)pdwCurrDescAddr) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 610 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 611 | #define MACvGetCurrRx1DescAddr(dwIoBase, pdwCurrDescAddr) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 612 | VNSvInPortD(dwIoBase + MAC_REG_RXDMAPTR1, \ |
| 613 | (unsigned long *)pdwCurrDescAddr) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 614 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 615 | #define MACvGetCurrTx0DescAddr(dwIoBase, pdwCurrDescAddr) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 616 | VNSvInPortD(dwIoBase + MAC_REG_TXDMAPTR0, \ |
| 617 | (unsigned long *)pdwCurrDescAddr) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 618 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 619 | #define MACvGetCurrAC0DescAddr(dwIoBase, pdwCurrDescAddr) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 620 | VNSvInPortD(dwIoBase + MAC_REG_AC0DMAPTR, \ |
| 621 | (unsigned long *)pdwCurrDescAddr) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 622 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 623 | #define MACvGetCurrSyncDescAddr(dwIoBase, pdwCurrDescAddr) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 624 | VNSvInPortD(dwIoBase + MAC_REG_SYNCDMAPTR, \ |
| 625 | (unsigned long *)pdwCurrDescAddr) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 626 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 627 | #define MACvGetCurrATIMDescAddr(dwIoBase, pdwCurrDescAddr) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 628 | VNSvInPortD(dwIoBase + MAC_REG_ATIMDMAPTR, \ |
| 629 | (unsigned long *)pdwCurrDescAddr) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 630 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 631 | /* set the chip with current BCN tx descriptor address */ |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 632 | #define MACvSetCurrBCNTxDescAddr(dwIoBase, dwCurrDescAddr) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 633 | VNSvOutPortD(dwIoBase + MAC_REG_BCNDMAPTR, \ |
| 634 | dwCurrDescAddr) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 635 | |
Emrys Bayliss | 12b7951 | 2015-01-16 03:29:27 +1100 | [diff] [blame] | 636 | /* set the chip with current BCN length */ |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 637 | #define MACvSetCurrBCNLength(dwIoBase, wCurrBCNLength) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 638 | VNSvOutPortW(dwIoBase + MAC_REG_BCNDMACTL+2, \ |
| 639 | wCurrBCNLength) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 640 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 641 | #define MACvReadBSSIDAddress(dwIoBase, pbyEtherAddr) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 642 | do { \ |
| 643 | VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 1); \ |
| 644 | VNSvInPortB(dwIoBase + MAC_REG_BSSID0, \ |
| 645 | (unsigned char *)pbyEtherAddr); \ |
| 646 | VNSvInPortB(dwIoBase + MAC_REG_BSSID0 + 1, \ |
| 647 | pbyEtherAddr + 1); \ |
| 648 | VNSvInPortB(dwIoBase + MAC_REG_BSSID0 + 2, \ |
| 649 | pbyEtherAddr + 2); \ |
| 650 | VNSvInPortB(dwIoBase + MAC_REG_BSSID0 + 3, \ |
| 651 | pbyEtherAddr + 3); \ |
| 652 | VNSvInPortB(dwIoBase + MAC_REG_BSSID0 + 4, \ |
| 653 | pbyEtherAddr + 4); \ |
| 654 | VNSvInPortB(dwIoBase + MAC_REG_BSSID0 + 5, \ |
| 655 | pbyEtherAddr + 5); \ |
| 656 | VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 0); \ |
| 657 | } while (0) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 658 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 659 | #define MACvWriteBSSIDAddress(dwIoBase, pbyEtherAddr) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 660 | do { \ |
| 661 | VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 1); \ |
| 662 | VNSvOutPortB(dwIoBase + MAC_REG_BSSID0, \ |
| 663 | *(pbyEtherAddr)); \ |
| 664 | VNSvOutPortB(dwIoBase + MAC_REG_BSSID0 + 1, \ |
| 665 | *(pbyEtherAddr + 1)); \ |
| 666 | VNSvOutPortB(dwIoBase + MAC_REG_BSSID0 + 2, \ |
| 667 | *(pbyEtherAddr + 2)); \ |
| 668 | VNSvOutPortB(dwIoBase + MAC_REG_BSSID0 + 3, \ |
| 669 | *(pbyEtherAddr + 3)); \ |
| 670 | VNSvOutPortB(dwIoBase + MAC_REG_BSSID0 + 4, \ |
| 671 | *(pbyEtherAddr + 4)); \ |
| 672 | VNSvOutPortB(dwIoBase + MAC_REG_BSSID0 + 5, \ |
| 673 | *(pbyEtherAddr + 5)); \ |
| 674 | VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 0); \ |
| 675 | } while (0) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 676 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 677 | #define MACvReadEtherAddress(dwIoBase, pbyEtherAddr) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 678 | do { \ |
| 679 | VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 1); \ |
| 680 | VNSvInPortB(dwIoBase + MAC_REG_PAR0, \ |
| 681 | (unsigned char *)pbyEtherAddr); \ |
| 682 | VNSvInPortB(dwIoBase + MAC_REG_PAR0 + 1, \ |
| 683 | pbyEtherAddr + 1); \ |
| 684 | VNSvInPortB(dwIoBase + MAC_REG_PAR0 + 2, \ |
| 685 | pbyEtherAddr + 2); \ |
| 686 | VNSvInPortB(dwIoBase + MAC_REG_PAR0 + 3, \ |
| 687 | pbyEtherAddr + 3); \ |
| 688 | VNSvInPortB(dwIoBase + MAC_REG_PAR0 + 4, \ |
| 689 | pbyEtherAddr + 4); \ |
| 690 | VNSvInPortB(dwIoBase + MAC_REG_PAR0 + 5, \ |
| 691 | pbyEtherAddr + 5); \ |
| 692 | VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 0); \ |
| 693 | } while (0) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 694 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 695 | #define MACvWriteEtherAddress(dwIoBase, pbyEtherAddr) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 696 | do { \ |
| 697 | VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 1); \ |
| 698 | VNSvOutPortB(dwIoBase + MAC_REG_PAR0, \ |
| 699 | *pbyEtherAddr); \ |
| 700 | VNSvOutPortB(dwIoBase + MAC_REG_PAR0 + 1, \ |
| 701 | *(pbyEtherAddr + 1)); \ |
| 702 | VNSvOutPortB(dwIoBase + MAC_REG_PAR0 + 2, \ |
| 703 | *(pbyEtherAddr + 2)); \ |
| 704 | VNSvOutPortB(dwIoBase + MAC_REG_PAR0 + 3, \ |
| 705 | *(pbyEtherAddr + 3)); \ |
| 706 | VNSvOutPortB(dwIoBase + MAC_REG_PAR0 + 4, \ |
| 707 | *(pbyEtherAddr + 4)); \ |
| 708 | VNSvOutPortB(dwIoBase + MAC_REG_PAR0 + 5, \ |
| 709 | *(pbyEtherAddr + 5)); \ |
| 710 | VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 0); \ |
| 711 | } while (0) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 712 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 713 | #define MACvClearISR(dwIoBase) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 714 | VNSvOutPortD(dwIoBase + MAC_REG_ISR, IMR_MASK_VALUE) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 715 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 716 | #define MACvStart(dwIoBase) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 717 | VNSvOutPortB(dwIoBase + MAC_REG_HOSTCR, \ |
| 718 | (HOSTCR_MACEN | HOSTCR_RXON | HOSTCR_TXON)) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 719 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 720 | #define MACvRx0PerPktMode(dwIoBase) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 721 | VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL0, RX_PERPKT) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 722 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 723 | #define MACvRx0BufferFillMode(dwIoBase) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 724 | VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL0, RX_PERPKTCLR) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 725 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 726 | #define MACvRx1PerPktMode(dwIoBase) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 727 | VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL1, RX_PERPKT) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 728 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 729 | #define MACvRx1BufferFillMode(dwIoBase) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 730 | VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL1, RX_PERPKTCLR) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 731 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 732 | #define MACvRxOn(dwIoBase) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 733 | MACvRegBitsOn(dwIoBase, MAC_REG_HOSTCR, HOSTCR_RXON) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 734 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 735 | #define MACvReceive0(dwIoBase) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 736 | do { \ |
| 737 | unsigned long dwData; \ |
| 738 | VNSvInPortD(dwIoBase + MAC_REG_RXDMACTL0, &dwData); \ |
| 739 | if (dwData & DMACTL_RUN) \ |
| 740 | VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL0, DMACTL_WAKE); \ |
| 741 | else \ |
| 742 | VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL0, DMACTL_RUN); \ |
| 743 | } while (0) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 744 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 745 | #define MACvReceive1(dwIoBase) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 746 | do { \ |
| 747 | unsigned long dwData; \ |
| 748 | VNSvInPortD(dwIoBase + MAC_REG_RXDMACTL1, &dwData); \ |
| 749 | if (dwData & DMACTL_RUN) \ |
| 750 | VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL1, DMACTL_WAKE); \ |
| 751 | else \ |
| 752 | VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL1, DMACTL_RUN); \ |
| 753 | } while (0) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 754 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 755 | #define MACvTxOn(dwIoBase) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 756 | MACvRegBitsOn(dwIoBase, MAC_REG_HOSTCR, HOSTCR_TXON) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 757 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 758 | #define MACvTransmit0(dwIoBase) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 759 | do { \ |
| 760 | unsigned long dwData; \ |
| 761 | VNSvInPortD(dwIoBase + MAC_REG_TXDMACTL0, &dwData); \ |
| 762 | if (dwData & DMACTL_RUN) \ |
| 763 | VNSvOutPortD(dwIoBase + MAC_REG_TXDMACTL0, DMACTL_WAKE); \ |
| 764 | else \ |
| 765 | VNSvOutPortD(dwIoBase + MAC_REG_TXDMACTL0, DMACTL_RUN); \ |
| 766 | } while (0) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 767 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 768 | #define MACvTransmitAC0(dwIoBase) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 769 | do { \ |
| 770 | unsigned long dwData; \ |
| 771 | VNSvInPortD(dwIoBase + MAC_REG_AC0DMACTL, &dwData); \ |
| 772 | if (dwData & DMACTL_RUN) \ |
| 773 | VNSvOutPortD(dwIoBase + MAC_REG_AC0DMACTL, DMACTL_WAKE); \ |
| 774 | else \ |
| 775 | VNSvOutPortD(dwIoBase + MAC_REG_AC0DMACTL, DMACTL_RUN); \ |
| 776 | } while (0) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 777 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 778 | #define MACvTransmitSYNC(dwIoBase) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 779 | do { \ |
| 780 | unsigned long dwData; \ |
| 781 | VNSvInPortD(dwIoBase + MAC_REG_SYNCDMACTL, &dwData); \ |
| 782 | if (dwData & DMACTL_RUN) \ |
| 783 | VNSvOutPortD(dwIoBase + MAC_REG_SYNCDMACTL, DMACTL_WAKE); \ |
| 784 | else \ |
| 785 | VNSvOutPortD(dwIoBase + MAC_REG_SYNCDMACTL, DMACTL_RUN); \ |
| 786 | } while (0) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 787 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 788 | #define MACvTransmitATIM(dwIoBase) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 789 | do { \ |
| 790 | unsigned long dwData; \ |
| 791 | VNSvInPortD(dwIoBase + MAC_REG_ATIMDMACTL, &dwData); \ |
| 792 | if (dwData & DMACTL_RUN) \ |
| 793 | VNSvOutPortD(dwIoBase + MAC_REG_ATIMDMACTL, DMACTL_WAKE); \ |
| 794 | else \ |
| 795 | VNSvOutPortD(dwIoBase + MAC_REG_ATIMDMACTL, DMACTL_RUN); \ |
| 796 | } while (0) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 797 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 798 | #define MACvTransmitBCN(dwIoBase) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 799 | VNSvOutPortB(dwIoBase + MAC_REG_BCNDMACTL, BEACON_READY) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 800 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 801 | #define MACvClearStckDS(dwIoBase) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 802 | do { \ |
| 803 | unsigned char byOrgValue; \ |
| 804 | VNSvInPortB(dwIoBase + MAC_REG_STICKHW, &byOrgValue); \ |
| 805 | byOrgValue = byOrgValue & 0xFC; \ |
| 806 | VNSvOutPortB(dwIoBase + MAC_REG_STICKHW, byOrgValue); \ |
| 807 | } while (0) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 808 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 809 | #define MACvReadISR(dwIoBase, pdwValue) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 810 | VNSvInPortD(dwIoBase + MAC_REG_ISR, pdwValue) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 811 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 812 | #define MACvWriteISR(dwIoBase, dwValue) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 813 | VNSvOutPortD(dwIoBase + MAC_REG_ISR, dwValue) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 814 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 815 | #define MACvIntEnable(dwIoBase, dwMask) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 816 | VNSvOutPortD(dwIoBase + MAC_REG_IMR, dwMask) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 817 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 818 | #define MACvIntDisable(dwIoBase) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 819 | VNSvOutPortD(dwIoBase + MAC_REG_IMR, 0) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 820 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 821 | #define MACvSelectPage0(dwIoBase) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 822 | VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 0) |
| 823 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 824 | #define MACvSelectPage1(dwIoBase) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 825 | VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 1) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 826 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 827 | #define MACvReadMIBCounter(dwIoBase, pdwCounter) \ |
Emrys Bayliss | b5aa3f1 | 2015-01-16 03:29:21 +1100 | [diff] [blame] | 828 | VNSvInPortD(dwIoBase + MAC_REG_MIBCNTR, pdwCounter) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 829 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 830 | #define MACvPwrEvntDisable(dwIoBase) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 831 | VNSvOutPortW(dwIoBase + MAC_REG_WAKEUPEN0, 0x0000) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 832 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 833 | #define MACvEnableProtectMD(dwIoBase) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 834 | do { \ |
| 835 | unsigned long dwOrgValue; \ |
Emrys Bayliss | b5aa3f1 | 2015-01-16 03:29:21 +1100 | [diff] [blame] | 836 | VNSvInPortD(dwIoBase + MAC_REG_ENCFG, &dwOrgValue); \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 837 | dwOrgValue = dwOrgValue | EnCFG_ProtectMd; \ |
| 838 | VNSvOutPortD(dwIoBase + MAC_REG_ENCFG, dwOrgValue); \ |
| 839 | } while (0) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 840 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 841 | #define MACvDisableProtectMD(dwIoBase) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 842 | do { \ |
| 843 | unsigned long dwOrgValue; \ |
Emrys Bayliss | b5aa3f1 | 2015-01-16 03:29:21 +1100 | [diff] [blame] | 844 | VNSvInPortD(dwIoBase + MAC_REG_ENCFG, &dwOrgValue); \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 845 | dwOrgValue = dwOrgValue & ~EnCFG_ProtectMd; \ |
| 846 | VNSvOutPortD(dwIoBase + MAC_REG_ENCFG, dwOrgValue); \ |
| 847 | } while (0) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 848 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 849 | #define MACvEnableBarkerPreambleMd(dwIoBase) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 850 | do { \ |
| 851 | unsigned long dwOrgValue; \ |
Emrys Bayliss | b5aa3f1 | 2015-01-16 03:29:21 +1100 | [diff] [blame] | 852 | VNSvInPortD(dwIoBase + MAC_REG_ENCFG, &dwOrgValue); \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 853 | dwOrgValue = dwOrgValue | EnCFG_BarkerPream; \ |
| 854 | VNSvOutPortD(dwIoBase + MAC_REG_ENCFG, dwOrgValue); \ |
| 855 | } while (0) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 856 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 857 | #define MACvDisableBarkerPreambleMd(dwIoBase) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 858 | do { \ |
| 859 | unsigned long dwOrgValue; \ |
Emrys Bayliss | b5aa3f1 | 2015-01-16 03:29:21 +1100 | [diff] [blame] | 860 | VNSvInPortD(dwIoBase + MAC_REG_ENCFG, &dwOrgValue); \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 861 | dwOrgValue = dwOrgValue & ~EnCFG_BarkerPream; \ |
| 862 | VNSvOutPortD(dwIoBase + MAC_REG_ENCFG, dwOrgValue); \ |
| 863 | } while (0) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 864 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 865 | #define MACvSetBBType(dwIoBase, byTyp) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 866 | do { \ |
| 867 | unsigned long dwOrgValue; \ |
Emrys Bayliss | b5aa3f1 | 2015-01-16 03:29:21 +1100 | [diff] [blame] | 868 | VNSvInPortD(dwIoBase + MAC_REG_ENCFG, &dwOrgValue); \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 869 | dwOrgValue = dwOrgValue & ~EnCFG_BBType_MASK; \ |
| 870 | dwOrgValue = dwOrgValue | (unsigned long)byTyp; \ |
| 871 | VNSvOutPortD(dwIoBase + MAC_REG_ENCFG, dwOrgValue); \ |
| 872 | } while (0) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 873 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 874 | #define MACvReadATIMW(dwIoBase, pwCounter) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 875 | VNSvInPortW(dwIoBase + MAC_REG_AIDATIM, pwCounter) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 876 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 877 | #define MACvWriteATIMW(dwIoBase, wCounter) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 878 | VNSvOutPortW(dwIoBase + MAC_REG_AIDATIM, wCounter) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 879 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 880 | #define MACvWriteCRC16_128(dwIoBase, byRegOfs, wCRC) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 881 | do { \ |
| 882 | VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 1); \ |
| 883 | VNSvOutPortW(dwIoBase + byRegOfs, wCRC); \ |
| 884 | VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 0); \ |
| 885 | } while (0) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 886 | |
Joe Perches | c3504bf | 2013-03-18 10:44:55 -0700 | [diff] [blame] | 887 | #define MACvGPIOIn(dwIoBase, pbyValue) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 888 | VNSvInPortB(dwIoBase + MAC_REG_GPIOCTL1, pbyValue) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 889 | |
| 890 | #define MACvSetRFLE_LatchBase(dwIoBase) \ |
Joe Perches | bda2a44 | 2013-03-18 20:55:40 -0700 | [diff] [blame] | 891 | MACvWordRegBitsOn(dwIoBase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_RFLEOPT) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 892 | |
Malcolm Priestley | f9f853a | 2015-11-22 09:07:22 +0000 | [diff] [blame] | 893 | bool MACbIsRegBitsOn(struct vnt_private *, unsigned char byRegOfs, |
Emrys Bayliss | 19bf265 | 2015-01-16 03:29:25 +1100 | [diff] [blame] | 894 | unsigned char byTestBits); |
Malcolm Priestley | f9f853a | 2015-11-22 09:07:22 +0000 | [diff] [blame] | 895 | bool MACbIsRegBitsOff(struct vnt_private *, unsigned char byRegOfs, |
Emrys Bayliss | 19bf265 | 2015-01-16 03:29:25 +1100 | [diff] [blame] | 896 | unsigned char byTestBits); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 897 | |
Malcolm Priestley | f9f853a | 2015-11-22 09:07:22 +0000 | [diff] [blame] | 898 | bool MACbIsIntDisable(struct vnt_private *); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 899 | |
Malcolm Priestley | f9f853a | 2015-11-22 09:07:22 +0000 | [diff] [blame] | 900 | void MACvSetShortRetryLimit(struct vnt_private *, unsigned char byRetryLimit); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 901 | |
Malcolm Priestley | f9f853a | 2015-11-22 09:07:22 +0000 | [diff] [blame] | 902 | void MACvSetLongRetryLimit(struct vnt_private *, unsigned char byRetryLimit); |
| 903 | void MACvGetLongRetryLimit(struct vnt_private *, |
Emrys Bayliss | 19bf265 | 2015-01-16 03:29:25 +1100 | [diff] [blame] | 904 | unsigned char *pbyRetryLimit); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 905 | |
Malcolm Priestley | f9f853a | 2015-11-22 09:07:22 +0000 | [diff] [blame] | 906 | void MACvSetLoopbackMode(struct vnt_private *, unsigned char byLoopbackMode); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 907 | |
Malcolm Priestley | f9f853a | 2015-11-22 09:07:22 +0000 | [diff] [blame] | 908 | void MACvSaveContext(struct vnt_private *, unsigned char *pbyCxtBuf); |
| 909 | void MACvRestoreContext(struct vnt_private *, unsigned char *pbyCxtBuf); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 910 | |
Malcolm Priestley | f9f853a | 2015-11-22 09:07:22 +0000 | [diff] [blame] | 911 | bool MACbSoftwareReset(struct vnt_private *); |
| 912 | bool MACbSafeSoftwareReset(struct vnt_private *); |
| 913 | bool MACbSafeRxOff(struct vnt_private *); |
| 914 | bool MACbSafeTxOff(struct vnt_private *); |
| 915 | bool MACbSafeStop(struct vnt_private *); |
| 916 | bool MACbShutdown(struct vnt_private *); |
| 917 | void MACvInitialize(struct vnt_private *); |
| 918 | void MACvSetCurrRx0DescAddr(struct vnt_private *, |
Malcolm Priestley | 2802947 | 2016-03-06 12:57:09 +0000 | [diff] [blame] | 919 | u32 curr_desc_addr); |
Malcolm Priestley | f9f853a | 2015-11-22 09:07:22 +0000 | [diff] [blame] | 920 | void MACvSetCurrRx1DescAddr(struct vnt_private *, |
Malcolm Priestley | 2802947 | 2016-03-06 12:57:09 +0000 | [diff] [blame] | 921 | u32 curr_desc_addr); |
Malcolm Priestley | f9f853a | 2015-11-22 09:07:22 +0000 | [diff] [blame] | 922 | void MACvSetCurrTXDescAddr(int iTxType, struct vnt_private *, |
Malcolm Priestley | 2802947 | 2016-03-06 12:57:09 +0000 | [diff] [blame] | 923 | u32 curr_desc_addr); |
Malcolm Priestley | f9f853a | 2015-11-22 09:07:22 +0000 | [diff] [blame] | 924 | void MACvSetCurrTx0DescAddrEx(struct vnt_private *, |
Malcolm Priestley | 2802947 | 2016-03-06 12:57:09 +0000 | [diff] [blame] | 925 | u32 curr_desc_addr); |
Malcolm Priestley | f9f853a | 2015-11-22 09:07:22 +0000 | [diff] [blame] | 926 | void MACvSetCurrAC0DescAddrEx(struct vnt_private *, |
Malcolm Priestley | 2802947 | 2016-03-06 12:57:09 +0000 | [diff] [blame] | 927 | u32 curr_desc_addr); |
Malcolm Priestley | f9f853a | 2015-11-22 09:07:22 +0000 | [diff] [blame] | 928 | void MACvSetCurrSyncDescAddrEx(struct vnt_private *, |
Malcolm Priestley | 2802947 | 2016-03-06 12:57:09 +0000 | [diff] [blame] | 929 | u32 curr_desc_addr); |
Malcolm Priestley | f9f853a | 2015-11-22 09:07:22 +0000 | [diff] [blame] | 930 | void MACvSetCurrATIMDescAddrEx(struct vnt_private *, |
Malcolm Priestley | 2802947 | 2016-03-06 12:57:09 +0000 | [diff] [blame] | 931 | u32 curr_desc_addr); |
Malcolm Priestley | f9f853a | 2015-11-22 09:07:22 +0000 | [diff] [blame] | 932 | void MACvTimer0MicroSDelay(struct vnt_private *, unsigned int uDelay); |
| 933 | void MACvOneShotTimer1MicroSec(struct vnt_private *, unsigned int uDelayTime); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 934 | |
Malcolm Priestley | f9f853a | 2015-11-22 09:07:22 +0000 | [diff] [blame] | 935 | void MACvSetMISCFifo(struct vnt_private *, unsigned short wOffset, |
Malcolm Priestley | e984c75 | 2016-03-06 12:57:02 +0000 | [diff] [blame] | 936 | u32 dwData); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 937 | |
Malcolm Priestley | f9f853a | 2015-11-22 09:07:22 +0000 | [diff] [blame] | 938 | bool MACbPSWakeup(struct vnt_private *); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 939 | |
Malcolm Priestley | f9f853a | 2015-11-22 09:07:22 +0000 | [diff] [blame] | 940 | void MACvSetKeyEntry(struct vnt_private *, unsigned short wKeyCtl, |
Emrys Bayliss | 19bf265 | 2015-01-16 03:29:25 +1100 | [diff] [blame] | 941 | unsigned int uEntryIdx, unsigned int uKeyIdx, |
| 942 | unsigned char *pbyAddr, u32 *pdwKey, |
| 943 | unsigned char byLocalID); |
Malcolm Priestley | f9f853a | 2015-11-22 09:07:22 +0000 | [diff] [blame] | 944 | void MACvDisableKeyEntry(struct vnt_private *, unsigned int uEntryIdx); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 945 | |
Emrys Bayliss | 060b505 | 2015-01-16 03:29:24 +1100 | [diff] [blame] | 946 | #endif /* __MAC_H__ */ |