├── .gitignore ├── BuildCaps.inc ├── COPYRIGHT ├── INSTALL ├── Makefile ├── Makefile.inc ├── Makefile.kernel ├── README ├── README.dfs ├── THANKS ├── ath ├── Makefile ├── Makefile.kernel ├── if_ath.c ├── if_ath_ahb.c ├── if_ath_ahb.h ├── if_ath_debug.h ├── if_ath_hal.h ├── if_ath_hal_extensions.c ├── if_ath_hal_extensions.h ├── if_ath_hal_macros.h ├── if_ath_hal_wrappers.h ├── if_ath_pci.c ├── if_ath_pci.h ├── if_ath_radar.c ├── if_ath_radar.h ├── if_athioctl.h └── if_athvar.h ├── ath_hal ├── COPYRIGHT ├── Makefile ├── Makefile.kernel ├── README ├── ah.c ├── ah.h ├── ah_debug.h ├── ah_decode.h ├── ah_desc.h ├── ah_devid.h ├── ah_eeprom.h ├── ah_eeprom_v1.c ├── ah_eeprom_v1.h ├── ah_eeprom_v14.c ├── ah_eeprom_v14.h ├── ah_eeprom_v3.c ├── ah_eeprom_v3.h ├── ah_internal.h ├── ah_os.c ├── ah_os.h ├── ah_osdep.h ├── ah_regdomain.c ├── ah_soc.h ├── ar5210 │ ├── ar5210.h │ ├── ar5210_attach.c │ ├── ar5210_beacon.c │ ├── ar5210_interrupts.c │ ├── ar5210_keycache.c │ ├── ar5210_misc.c │ ├── ar5210_phy.c │ ├── ar5210_power.c │ ├── ar5210_recv.c │ ├── ar5210_reset.c │ ├── ar5210_xmit.c │ ├── ar5210desc.h │ ├── ar5210phy.h │ ├── ar5210reg.h │ └── ar5k_0007.ini ├── ar5211 │ ├── ar5211.h │ ├── ar5211_attach.c │ ├── ar5211_beacon.c │ ├── ar5211_interrupts.c │ ├── ar5211_keycache.c │ ├── ar5211_misc.c │ ├── ar5211_phy.c │ ├── ar5211_power.c │ ├── ar5211_recv.c │ ├── ar5211_reset.c │ ├── ar5211_xmit.c │ ├── ar5211desc.h │ ├── ar5211phy.h │ ├── ar5211reg.h │ └── boss.ini ├── ar5212 │ ├── ar2316.c │ ├── ar2317.c │ ├── ar2413.c │ ├── ar2425.c │ ├── ar5111.c │ ├── ar5112.c │ ├── ar5212.h │ ├── ar5212.ini │ ├── ar5212_ani.c │ ├── ar5212_attach.c │ ├── ar5212_beacon.c │ ├── ar5212_eeprom.c │ ├── ar5212_gpio.c │ ├── ar5212_interrupts.c │ ├── ar5212_keycache.c │ ├── ar5212_misc.c │ ├── ar5212_phy.c │ ├── ar5212_power.c │ ├── ar5212_recv.c │ ├── ar5212_reset.c │ ├── ar5212_rfgain.c │ ├── ar5212_xmit.c │ ├── ar5212desc.h │ ├── ar5212phy.h │ ├── ar5212reg.h │ ├── ar5311reg.h │ └── ar5413.c ├── ar5312 │ ├── ar5312.h │ ├── ar5312_attach.c │ ├── ar5312_eeprom.c │ ├── ar5312_gpio.c │ ├── ar5312_interrupts.c │ ├── ar5312_misc.c │ ├── ar5312_power.c │ ├── ar5312_reset.c │ ├── ar5312phy.h │ ├── ar5312reg.h │ └── ar5315_gpio.c ├── ar5416 │ ├── ar2133.c │ ├── ar5416.h │ ├── ar5416.ini │ ├── ar5416_ani.c │ ├── ar5416_attach.c │ ├── ar5416_beacon.c │ ├── ar5416_cal.c │ ├── ar5416_cal.h │ ├── ar5416_cal_adcdc.c │ ├── ar5416_cal_adcgain.c │ ├── ar5416_cal_iq.c │ ├── ar5416_eeprom.c │ ├── ar5416_gpio.c │ ├── ar5416_interrupts.c │ ├── ar5416_keycache.c │ ├── ar5416_misc.c │ ├── ar5416_phy.c │ ├── ar5416_power.c │ ├── ar5416_recv.c │ ├── ar5416_reset.c │ ├── ar5416_xmit.c │ ├── ar5416desc.h │ ├── ar5416phy.h │ ├── ar5416reg.h │ ├── ar9160.ini │ ├── ar9160_attach.c │ ├── ar9280.c │ ├── ar9280.h │ ├── ar9280_attach.c │ ├── ar9280v1.ini │ └── ar9280v2.ini └── opt_ah.h ├── ath_rate ├── Makefile ├── amrr │ ├── Makefile │ ├── Makefile.kernel │ ├── amrr.c │ └── amrr.h ├── minstrel │ ├── Makefile │ ├── Makefile.kernel │ ├── minstrel.c │ ├── minstrel.h │ └── minstrel.txt ├── onoe │ ├── Makefile │ ├── Makefile.kernel │ ├── onoe.c │ └── onoe.h └── sample │ ├── Makefile │ ├── Makefile.kernel │ ├── sample.c │ └── sample.h ├── contrib └── madwifi.spec.in ├── include ├── compat.h └── sys │ └── queue.h ├── net80211 ├── Makefile ├── Makefile.kernel ├── _ieee80211.h ├── ieee80211.c ├── ieee80211.h ├── ieee80211_acl.c ├── ieee80211_beacon.c ├── ieee80211_crypto.c ├── ieee80211_crypto.h ├── ieee80211_crypto_ccmp.c ├── ieee80211_crypto_none.c ├── ieee80211_crypto_tkip.c ├── ieee80211_crypto_wep.c ├── ieee80211_debug.h ├── ieee80211_input.c ├── ieee80211_ioctl.h ├── ieee80211_linux.c ├── ieee80211_linux.h ├── ieee80211_monitor.c ├── ieee80211_monitor.h ├── ieee80211_node.c ├── ieee80211_node.h ├── ieee80211_output.c ├── ieee80211_power.c ├── ieee80211_power.h ├── ieee80211_proto.c ├── ieee80211_proto.h ├── ieee80211_radiotap.h ├── ieee80211_rate.c ├── ieee80211_rate.h ├── ieee80211_scan.c ├── ieee80211_scan.h ├── ieee80211_scan_ap.c ├── ieee80211_scan_sta.c ├── ieee80211_skb.c ├── ieee80211_skb.h ├── ieee80211_var.h ├── ieee80211_wireless.c ├── ieee80211_xauth.c ├── if_athproto.h ├── if_ethersubr.h ├── if_llc.h ├── if_media.c └── if_media.h ├── patch-kernel ├── Config.in ├── Configure.help.patch ├── Kconfig ├── README └── install.sh ├── regression ├── Makefile ├── ccmp │ ├── Makefile │ └── test_ccmp.c ├── tkip │ ├── Makefile │ └── test_tkip.c └── wep │ ├── Makefile │ └── test_wep.c ├── release.h ├── scripts ├── find-madwifi-modules.sh ├── if_ath_hal_generator.pl ├── madwifi-indent ├── madwifi-unload └── make-release.bash └── tools ├── .gitignore ├── 80211debug.c ├── 80211stats.c ├── Makefile ├── athchans.c ├── athctrl.c ├── athdebug.c ├── athkey.c ├── athstats.c ├── man ├── 80211debug.8 ├── 80211stats.8 ├── athchans.8 ├── athctrl.8 ├── athdebug.8 ├── athkey.8 ├── athstats.8 └── wlanconfig.8 ├── wireless_copy.h ├── wlanconfig.c └── wpakey.c /.gitignore: -------------------------------------------------------------------------------- 1 | .* 2 | *.ko 3 | *.mod.c 4 | *.o 5 | *.order 6 | Module.symvers 7 | -------------------------------------------------------------------------------- /BuildCaps.inc: -------------------------------------------------------------------------------- 1 | # 2 | # defaults 3 | # 4 | ifndef ATH_CAP_SUPERG_FF 5 | export ATH_CAP_SUPERG_FF=1 6 | endif 7 | 8 | ifndef ATH_CAP_DYNTURBO 9 | export ATH_CAP_DYNTURBO=1 10 | endif 11 | 12 | ifndef ATH_CAP_SUPERG_COMP 13 | export ATH_CAP_SUPERG_COMP=0 14 | endif 15 | 16 | # ifndef ATH_CAP_XR 17 | # export ATH_CAP_XR=0 18 | # endif 19 | 20 | ifndef ATH_CAP_TPC 21 | export ATH_CAP_TPC=1 22 | endif 23 | 24 | # ifndef ATH_CAP_TX99 25 | # export ATH_CAP_TX99=0 26 | # endif 27 | 28 | # 29 | # directives 30 | # 31 | ifneq ($(strip $(ATH_CAP_SUPERG_FF)),0) 32 | COPTS+= -DATH_SUPERG_FF=1 33 | endif 34 | 35 | ifneq ($(strip $(ATH_CAP_DYNTURBO)),0) 36 | COPTS+= -DATH_SUPERG_DYNTURBO=1 -DATH_TURBO_SCAN=1 37 | endif 38 | 39 | ifneq ($(strip $(ATH_CAP_SUPERG_COMP)),0) 40 | COPTS+= -DATH_SUPERG_COMP=1 41 | endif 42 | 43 | # ifneq ($(strip $(ATH_CAP_XR)),0) 44 | # COPTS+= -DATH_SUPERG_XR=1 45 | # endif 46 | 47 | ifneq ($(strip $(ATH_CAP_TPC)),0) 48 | COPTS+= -DATH_CAP_TPC=1 49 | endif 50 | 51 | # ifneq ($(strip $(ATH_CAP_TX99)),0) 52 | # COPTS+= -DATH_TX99_DIAG=1 53 | # endif 54 | -------------------------------------------------------------------------------- /COPYRIGHT: -------------------------------------------------------------------------------- 1 | All files contained in this distribution are covered by the following 2 | copyright unless explicitly identified otherwise. 3 | 4 | /*- 5 | * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions 10 | * are met: 11 | * 1. Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer, 13 | * without modification. 14 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer 15 | * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any 16 | * redistribution must be conditioned upon including a substantially 17 | * similar Disclaimer requirement for further binary redistribution. 18 | * 3. Neither the names of the above-listed copyright holders nor the names 19 | * of any contributors may be used to endorse or promote products derived 20 | * from this software without specific prior written permission. 21 | * 22 | * Alternatively, this software may be distributed under the terms of the 23 | * GNU General Public License ("GPL") version 2 as published by the Free 24 | * Software Foundation. 25 | * 26 | * NO WARRANTY 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY 30 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 31 | * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, 32 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 33 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 34 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 35 | * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 36 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 37 | * THE POSSIBILITY OF SUCH DAMAGES. 38 | * 39 | * $Id: COPYRIGHT,v 1.4 2004/01/13 18:05:41 samleffler Exp $ 40 | */ 41 | -------------------------------------------------------------------------------- /Makefile.kernel: -------------------------------------------------------------------------------- 1 | obj-$(CONFIG_ATHEROS_RATE_AMRR) += ath_rate/amrr/ 2 | obj-$(CONFIG_ATHEROS_RATE_MINSTREL) += ath_rate/minstrel/ 3 | obj-$(CONFIG_ATHEROS_RATE_ONOE) += ath_rate/onoe/ 4 | obj-$(CONFIG_ATHEROS_RATE_SAMPLE) += ath_rate/sample/ 5 | obj-$(CONFIG_ATHEROS) += ath/ ath_hal/ net80211/ 6 | 7 | ifeq ($(CONFIG_ATHEROS_DEBUG),y) 8 | EXTRA_CFLAGS += -DAR_DEBUG -DIEEE80211_DEBUG 9 | endif 10 | -------------------------------------------------------------------------------- /README.dfs: -------------------------------------------------------------------------------- 1 | 2007-10-11 Benoit PAPILLAULT 2 | 3 | Conformance testing to the following standards: 4 | * ETSI 301 893 v1.4.1 (dated 2007-07) 5 | * FCC 6 | * IEEE 802.11h-2003 (dated 2003-10-14) 7 | 8 | ETSI and FCC defines the regulation constraints and defines several roles : 9 | * "master" 10 | * "slave without radar detection" 11 | * "slave with radar detection" 12 | 13 | Frequencies & channels where DFS is applicable: 14 | * ETSI : 5250-5350MHz , 5470-5725MHz 15 | * IEEE 802.11 center frequencies : 16 | 5260, 5280, 5300, 5320 17 | 5500, 5520, 5540, 5560, 5580, 5600, 5620, 5640, 5660, 5680, 5700 18 | * IEEE 802.11 channels : 19 | 52, 56, 60, 64 20 | 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 21 | 22 | Simulating a radar pulse: 23 | echo " " > /proc/sys/dev/wifi0/radar_pulse 24 | 25 | Simulating a radar detected event: 26 | iwpriv wlan0 doth_radar 27 | 28 | == Notes on DFS in various modes == 29 | 30 | A VAP interface can be used in several modes: 31 | * IEEE80211_M_STA "sta" : DFS is implemented as "slave" 32 | * IEEE80211_M_IBSS "adhoc" : DFS is implemented as "master" 33 | * IEEE80211_M_AHDEMO "ahdemo" : DFS is implemented as "master" 34 | * IEEE80211_M_HOSTAP "ap" : DFS is implemented as "master" 35 | * IEEE80211_M_MONITOR "monitor" : DFS is not implemented 36 | * IEEE80211_M_WDS "wds" : DFS is implemented as "master" 37 | 38 | == Implementation notes == 39 | 40 | sc->sc_curchan.privFlags & CHANNEL_DFS is set if ETSI/FCC compliance is 41 | required by regulation. It does not mean that 802.11h is required. This flag 42 | is automatically adjusted by ath_radar_correct_dfs_flags() according to the 43 | regulation for the specified frequency. 44 | 45 | ic->ic_flags & IEEE80211_F_DOTH is set if IEEE 802.11h is required. It matches 46 | dot11SpectrumManagementRequired as described in IEEE 802.11h. Default value is 47 | 1 and can be changed at anytime by the user through iwpriv. 48 | 49 | ETSI/FCC mechanisms (Channel Availability Check, In-Service Monitoring, Channel 50 | Shutdown, Non-Occupancy Period) and IEEE 802.11h magnums (Selecting and 51 | advertising a new channel, ...) are implemented ONLY if both flags are set. 52 | 53 | -------------------------------------------------------------------------------- /THANKS: -------------------------------------------------------------------------------- 1 | Acknowledgments 2 | ================ 3 | This work could not have been done without the support of Atheros 4 | and in particular the efforts of Greg Chesson. Comments from David 5 | Miller were helpful in cleaning up some of the roughest edges in 6 | early versions of the driver. 7 | 8 | Many people have contributed fixes and improvements to this software, 9 | including (in no particular order): 10 | 11 | Joerg Albert 12 | Mathieu Lacage 13 | Henry Qian 14 | giova+mwfdev@fagl 15 | Vivien Chappelier 16 | Eric Lammerts 17 | Mark Rakes 18 | Stephen Walton 19 | Tong Chia 20 | Stephane Laroche 21 | Michael Renzmann 22 | Dale Whitfield 23 | Joachim Gleissner 24 | Georg Lukas 25 | Paul Stewart 26 | Alexander Wirtz 27 | Guy Erb 28 | Tom Marshall 29 | D. Stolte 30 | Kevin Yu 31 | Kristian Hoffmann 32 | Nick Moss 33 | Bindu Therthala 34 | William S. Kish 35 | Nick Petroni 36 | Carl Thompson 37 | Thorsten von Eicken 38 | Jouni Malinen 39 | Satish Balay 40 | Richard Dawe 41 | Bruno Randolf 42 | Sebastian Weitzel 43 | Rajendra Singh 44 | Tai-hwa Liang 45 | Divy Le Ray 46 | John Bicket 47 | Takayuki Kaiso 48 | Owen Stampflee 49 | Kel Modderman 50 | Matt Foster 51 | Patrick Pichon 52 | Pavel Roskin 53 | Stijn Tintel 54 | jonty at electrichamster dot net 55 | Aaron Dummer 56 | Dustin McIntire 57 | Frank Schaeckermann 58 | Antonio Ospite 59 | Jon Anderson 60 | Wang Wenjuan 61 | Bell Kin 62 | Ilia Baldine 63 | David Overton 64 | Andreas Schultz 65 | David Fort 66 | Sven Schnelle 67 | Rudger van Brenk 68 | John Byrne 69 | Jae-don Shin 70 | Stefan Becker 71 | Mark Glines 72 | Matt Brown 73 | Steffen Pfendtner 74 | Jick Nan 75 | Charles Bovy 76 | Ian M. Rawley 77 | Beat Meier 78 | Alexander Warg 79 | Jiri Fojtasek 80 | Joshua Wright 81 | Dan Williams 82 | Aurelien Jarno 83 | Daniel Wu 84 | Paolo Cristiani 85 | "stiabhan" 86 | Elias Oltmanns 87 | Imre Kaloz 88 | Brian Eaton 89 | "paolo" 90 | Daniel J Blueman 91 | Digger Vermont 92 | Felix Fietkau 93 | Colubris Networks 94 | Matthew W. S. Bell 95 | Ivan S. Subrov 96 | Jochem Berndsen 97 | Nicholas J Kreucher 98 | Terry Todd 99 | Dave Platt 100 | Scott Raynel 101 | Christian Buennig 102 | Joe Parks 103 | Pavel Novak 104 | Wade Mealing 105 | Tony Espy 106 | Joerg Albert 107 | Oliver Stampfli 108 | Till Wollenberg 109 | Mats Hojlund 110 | Michal Wrobel 111 | Tim Harvey 112 | Andrew Lunn 113 | Chris Hessing 114 | Zilvinas Valinskas 115 | Pramod Babu Gummaraj 116 | Chris Pearson 117 | Helge Deller 118 | Pavol Gono 119 | Laurent Butti 120 | Julien Tinnes 121 | Tjalling Hattink 122 | Jiri Fojtasek 123 | Brian Braunstein 124 | Frank Zdarsky 125 | Andrew Lunn 126 | Michael Plourde 127 | Mike Taylor 128 | Derek J Smithies 129 | jhansen 130 | Benoit Papillault 131 | Russell Harmon 132 | Alessandro Erta 133 | Jason Weber 134 | Przemyslaw Bruski 135 | Perry Lorier 136 | 137 | Apologies to anyone whose name was unintentionally left off. 138 | Please let us know if you think your name should be mentioned here! 139 | 140 | 141 | We also would like to thank the following individuals and companies 142 | (listed in alphabetic order) who supported us with donations: 143 | 144 | * Compex Systems Pte Ltd, Singapore - http://www.compex.com.sg 145 | two donations with a total of 7 MiniPCI cards 146 | 147 | * IndraNet Technologies Ltd, New Zealand - http://www.indranet.co.nz 148 | Minstrel rate control module 149 | 150 | * Linux-Consulting, USA - http://www.linux-consulting.com 151 | madwifi.org domain name, DNS server maintenance 152 | 153 | * Rusty Mellinger, USA 154 | donation of a MiniPCI card with AR5211 155 | 156 | * minipci.biz, Germany 157 | donation of two AR5008-based cards plus one desktop antenna and 158 | three pigtails 159 | 160 | * Netgate, USA - http://www.netgate.com 161 | 1U server (P3/850, 1GB RAM, 2x200GB HDD) 162 | 163 | A special thanks goes to Will Herrick, who invested a lot of 164 | personal time and money to pick up the server and ship it to 165 | Germany! 166 | 167 | * Suzo, Slovakia - http://www.suzo.sk 168 | 1 Wistron DCMA-81 MiniPCI card 169 | 170 | * true global communications GmbH, Germany - http://www.tgc.de 171 | Free server and bandwidth for madwifi-project.org 172 | 173 | * Voyage, Hong Kong - htt://www.voyage.hk 174 | 1 Senao NMP-8602 Plus MiniPCI card, 2 pigtails and 2 rubber 175 | antenna 176 | 177 | To learn more about donations to our project visit: 178 | http://madwifi-project.org/wiki/Donations 179 | 180 | If you want to support the project this way, please contact us by 181 | e-mail at donation@madwifi-project.org. 182 | -------------------------------------------------------------------------------- /ath/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2002-2005 Sam Leffler, Errno Consulting 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 1. Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer, 10 | # without modification. 11 | # 2. Redistributions in binary form must reproduce at minimum a disclaimer 12 | # similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any 13 | # redistribution must be conditioned upon including a substantially 14 | # similar Disclaimer requirement for further binary redistribution. 15 | # 3. Neither the names of the above-listed copyright holders nor the names 16 | # of any contributors may be used to endorse or promote products derived 17 | # from this software without specific prior written permission. 18 | # 19 | # Alternatively, this software may be distributed under the terms of the 20 | # GNU General Public License ("GPL") version 2 as published by the Free 21 | # Software Foundation. 22 | # 23 | # NO WARRANTY 24 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 | # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 | # LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY 27 | # AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 28 | # THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, 29 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 32 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 34 | # THE POSSIBILITY OF SUCH DAMAGES. 35 | # 36 | # $Id: //depot/sw/linuxsrc/src/802_11/madwifi/madwifi/ath/Makefile#12 $ 37 | # 38 | 39 | # 40 | # Makefile for the Atheros WLAN driver. 41 | # 42 | 43 | obj := $(firstword $(obj) $(SUBDIRS) .) 44 | TOP = $(obj)/.. 45 | 46 | ifeq ($(strip $(BUS)),AHB) 47 | BUSNAME=ahb 48 | COPTS+= -DATH_AHB 49 | else 50 | BUSNAME=pci 51 | COPTS+= -DATH_PCI 52 | endif 53 | 54 | # These flags select which radar signatures DFS will match 55 | COPTS += -DDFS_DOMAIN_ETSI -DDFS_DOMAIN_FCC 56 | 57 | include $(TOP)/Makefile.inc 58 | 59 | obj-m += ath_$(BUSNAME).o 60 | ath_$(BUSNAME)-objs := if_ath.o if_ath_radar.o if_ath_hal_extensions.o if_ath_$(BUSNAME).o 61 | 62 | INCS += -I$(TOP) -I$(HAL) -I$(WLAN) 63 | 64 | EXTRA_CFLAGS+= $(INCS) $(COPTS) 65 | 66 | -include $(TOPDIR)/Rules.make 67 | 68 | .PHONY: all 69 | all: 70 | $(MAKE) -C $(KERNELPATH) SUBDIRS=$(shell pwd) modules 71 | 72 | .PHONY: install 73 | install: 74 | test -d $(DESTDIR)/$(KMODPATH) || mkdir -p $(DESTDIR)/$(KMODPATH) 75 | install -m 0644 ath_$(BUSNAME).$(KMODSUF) $(DESTDIR)/$(KMODPATH) 76 | 77 | .PHONY: clean 78 | clean: 79 | rm -f *~ *.o *.ko *.mod.c .*.cmd 80 | rm -f modules.order .depend .version .*.o.flags .*.o.d 81 | rm -rf .tmp_versions 82 | 83 | ath_$(BUSNAME).o: $(ath_$(BUSNAME)-objs) 84 | $(LD) $(LDOPTS) -o ath_$(BUSNAME).$(KMODSUF) -r $(ath_$(BUSNAME)-objs) 85 | 86 | if_ath_hal.h: $(HAL)/ah.h 87 | $(TOP)/scripts/if_ath_hal_generator.pl $< $@ 88 | $(TOP)/scripts/madwifi-indent $@ 89 | -------------------------------------------------------------------------------- /ath/Makefile.kernel: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for the Atheros WLAN driver. 3 | # 4 | 5 | obj ?= . 6 | src ?= . 7 | srctree ?= . 8 | 9 | TOP = $(srctree)/$(src)/.. 10 | 11 | include $(TOP)/BuildCaps.inc 12 | 13 | HAL= $(TOP)/ath_hal 14 | WLAN= $(TOP)/net80211 15 | COMPAT= $(TOP)/include 16 | 17 | # 18 | # Select bus-specific code. Note that this defaults to PCI. 19 | # 20 | ifeq ($(strip $(BUS)),AHB) 21 | BUSNAME=ahb 22 | EXTRA_CFLAGS+= -DATH_AHB 23 | else 24 | BUSNAME=pci 25 | EXTRA_CFLAGS+= -DATH_PCI 26 | endif 27 | 28 | # These flags select which radar signatures DFS will match 29 | COPTS += -DDFS_DOMAIN_ETSI -DDFS_DOMAIN_FCC 30 | 31 | INCS = -include $(COMPAT)/compat.h -I$(COMPAT) 32 | INCS += -I$(TOP) -I$(HAL) -I$(WLAN) 33 | 34 | EXTRA_CFLAGS += $(INCS) $(COPTS) 35 | 36 | obj-$(CONFIG_ATHEROS) += ath_$(BUSNAME).o 37 | ath_$(BUSNAME)-objs := if_ath.o if_ath_radar.o if_ath_hal_extensions.o if_ath_$(BUSNAME).o 38 | -------------------------------------------------------------------------------- /ath/if_ath_ahb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004 Atheros Communications, Inc. 3 | * All rights reserved. 4 | * 5 | * $Id$ 6 | */ 7 | 8 | #ifndef _DEV_ATH_AHB_H_ 9 | #define _DEV_ATH_AHB_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | #define AR531X_WLAN0_NUM 0 16 | #define AR531X_WLAN1_NUM 1 17 | 18 | #define REG_WRITE(_reg,_val) *((volatile u_int32_t *)(_reg)) = (_val); 19 | #define REG_READ(_reg) *((volatile u_int32_t *)(_reg)) 20 | 21 | /* 22 | * 5315 specific registers 23 | */ 24 | 25 | /* 26 | * PCI-MAC Configuration registers 27 | */ 28 | #define AR5315_PCI 0xB0100000 /* PCI MMR */ 29 | #define AR5315_PCI_MAC_RC (AR5315_PCI + 0x4000) 30 | #define AR5315_PCI_MAC_SCR (AR5315_PCI + 0x4004) 31 | #define AR5315_PCI_MAC_INTPEND (AR5315_PCI + 0x4008) 32 | #define AR5315_PCI_MAC_SFR (AR5315_PCI + 0x400C) 33 | #define AR5315_PCI_MAC_PCICFG (AR5315_PCI + 0x4010) 34 | #define AR5315_PCI_MAC_SREV (AR5315_PCI + 0x4020) 35 | 36 | #define AR5315_PCI_MAC_RC_MAC 0x00000001 37 | #define AR5315_PCI_MAC_RC_BB 0x00000002 38 | 39 | #define AR5315_PCI_MAC_SCR_SLMODE_M 0x00030000 40 | #define AR5315_PCI_MAC_SCR_SLMODE_S 16 41 | #define AR5315_PCI_MAC_SCR_SLM_FWAKE 0 42 | #define AR5315_PCI_MAC_SCR_SLM_FSLEEP 1 43 | #define AR5315_PCI_MAC_SCR_SLM_NORMAL 2 44 | 45 | #define AR5315_PCI_MAC_SFR_SLEEP 0x00000001 46 | 47 | #define AR5315_PCI_MAC_PCICFG_SPWR_DN 0x00010000 48 | 49 | #define AR5315_IRQ_WLAN0_INTRS 3 50 | #define AR5315_WLAN0 0xb0000000 51 | 52 | #define AR5315_ENDIAN_CTL 0xb100000c 53 | #define AR5315_CONFIG_WLAN 0x00000002 /* WLAN byteswap */ 54 | #define AR5315_AHB_ARB_CTL 0xb1000008 55 | #define AR5315_ARB_WLAN 0x00000002 56 | 57 | /* 58 | * Revision Register - Initial value is 0x3010 (WMAC 3.0, AR531X 1.0). 59 | */ 60 | #define AR5315_SREV 0xb1000014 61 | 62 | #define AR5315_REV_MAJ 0x0080 63 | #define AR5317_REV_MAJ 0x0090 64 | #define AR5315_REV_MAJ_M 0x00f0 65 | #define AR5315_REV_MAJ_S 4 66 | #define AR5315_REV_MIN_M 0x000f 67 | #define AR5315_REV_MIN_S 0 68 | #define AR5315_REV_CHIP (REV_MAJ|REV_MIN) 69 | 70 | #define AR531X_IRQ_WLAN0_INTRS 2 71 | #define AR531X_IRQ_WLAN1_INTRS 5 72 | #define AR531X_WLAN0 0xb8000000 73 | #define AR531X_WLAN1 0xb8500000 74 | #define AR531X_WLANX_LEN 0x000ffffc 75 | 76 | #define AR531X_RESETCTL 0xbc003020 77 | #define AR531X_RESET_WLAN0 0x00000004 /* mac & bb */ 78 | #define AR531X_RESET_WLAN1 0x00000200 /* mac & bb */ 79 | #define AR531X_RESET_WARM_WLAN0_MAC 0x00002000 80 | #define AR531X_RESET_WARM_WLAN0_BB 0x00004000 81 | #define AR531X_RESET_WARM_WLAN1_MAC 0x00020000 82 | #define AR531X_RESET_WARM_WLAN1_BB 0x00040000 83 | 84 | #define AR531X_ENABLE 0xbc003080 85 | #define AR531X_ENABLE_WLAN0 0x0001 86 | #define AR531X_ENABLE_WLAN1 0x0018 /* both DMA and PIO */ 87 | 88 | #define AR531X_RADIO_MASK_OFF 0xc8 89 | #define AR531X_RADIO0_MASK 0x0003 90 | #define AR531X_RADIO1_MASK 0x000c 91 | #define AR531X_RADIO1_S 2 92 | 93 | #define BUS_DMA_FROMDEVICE DMA_FROM_DEVICE 94 | #define BUS_DMA_TODEVICE DMA_TO_DEVICE 95 | 96 | #define AR531X_APBBASE 0xbc000000 97 | #define AR531X_RESETTMR (AR531X_APBBASE + 0x3000) 98 | #define AR531X_REV (AR531X_RESETTMR + 0x0090) /* revision */ 99 | #define AR531X_REV_MAJ 0x00f0 100 | #define AR531X_REV_MAJ_S 4 101 | #define AR531X_REV_MIN 0x000f 102 | #define AR531X_REV_MIN_S 0 103 | 104 | #define AR531X_BD_MAGIC 0x35333131 /* "5311", for all 531x platforms */ 105 | 106 | /* Allow compiling on non-mips platforms for code verification */ 107 | #ifndef KSEG1ADDR 108 | #define KSEG1ADDR(addr) (addr) 109 | #endif 110 | 111 | #define bus_dma_sync_single dma_sync_single_for_cpu 112 | #define bus_map_single dma_map_single 113 | #define bus_unmap_single dma_unmap_single 114 | #define bus_alloc_consistent(_hwdev, _sz, _hdma) \ 115 | dma_alloc_coherent((_hwdev), (_sz), (_hdma), GFP_ATOMIC) 116 | #define bus_free_consistent dma_free_coherent 117 | 118 | #endif /* _DEV_ATH_AHB_H_ */ 119 | -------------------------------------------------------------------------------- /ath/if_ath_debug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This software is distributed under the terms of the 3 | * GNU General Public License ("GPL") version 2 as published by the Free 4 | * Software Foundation. 5 | * 6 | * NO WARRANTY 7 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 8 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 9 | * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY 10 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 11 | * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, 12 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 13 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 14 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 15 | * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 16 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 17 | * THE POSSIBILITY OF SUCH DAMAGES. 18 | * 19 | * $Id: if_ath_radar.h 2464 2007-06-15 22:51:56Z mtaylor $ 20 | */ 21 | #ifndef _IF_ATH_DEBUG_H_ 22 | #define _IF_ATH_DEBUG_H_ 23 | 24 | enum { 25 | ATH_DEBUG_XMIT = 0x00000001, /* basic xmit operation */ 26 | ATH_DEBUG_XMIT_DESC = 0x00000002, /* xmit descriptors */ 27 | ATH_DEBUG_RECV = 0x00000004, /* basic recv operation */ 28 | ATH_DEBUG_RECV_DESC = 0x00000008, /* recv descriptors */ 29 | ATH_DEBUG_RATE = 0x00000010, /* rate control */ 30 | ATH_DEBUG_RESET = 0x00000020, /* reset processing */ 31 | ATH_DEBUG_SKB_REF = 0x00000040, /* sbk references */ 32 | ATH_DEBUG_BEACON = 0x00000080, /* beacon handling */ 33 | ATH_DEBUG_WATCHDOG = 0x00000100, /* watchdog timeout */ 34 | ATH_DEBUG_INTR = 0x00001000, /* ISR */ 35 | ATH_DEBUG_TX_PROC = 0x00002000, /* tx ISR proc */ 36 | ATH_DEBUG_RX_PROC = 0x00004000, /* rx ISR proc */ 37 | ATH_DEBUG_BEACON_PROC = 0x00008000, /* beacon ISR proc */ 38 | ATH_DEBUG_CALIBRATE = 0x00010000, /* periodic calibration */ 39 | ATH_DEBUG_KEYCACHE = 0x00020000, /* key cache management */ 40 | ATH_DEBUG_STATE = 0x00040000, /* 802.11 state transitions */ 41 | ATH_DEBUG_TSF = 0x00080000, /* timestamp processing */ 42 | ATH_DEBUG_LED = 0x00100000, /* led management */ 43 | ATH_DEBUG_FF = 0x00200000, /* fast frames */ 44 | ATH_DEBUG_TURBO = 0x00400000, /* turbo/dynamic turbo */ 45 | ATH_DEBUG_UAPSD = 0x00800000, /* uapsd */ 46 | ATH_DEBUG_DOTH = 0x01000000, /* 11.h */ 47 | ATH_DEBUG_DOTHFILT = 0x02000000, /* 11.h radar pulse filter algorithm */ 48 | ATH_DEBUG_DOTHFILTVBSE = 0x04000000, /* 11.h radar pulse filter algorithm - pulse level debug */ 49 | ATH_DEBUG_DOTHFILTNOSC = 0x08000000, /* 11.h radar pulse filter algorithm - disable short circuit of processing after detection */ 50 | ATH_DEBUG_DOTHPULSES = 0x10000000, /* 11.h radar pulse events */ 51 | ATH_DEBUG_TXBUF = 0x20000000, /* TX buffer usage/leak debugging */ 52 | ATH_DEBUG_SKB = 0x40000000, /* SKB usage/leak debugging [applies to all vaps] */ 53 | ATH_DEBUG_FATAL = 0x80000000, /* fatal errors */ 54 | ATH_DEBUG_ANY = 0xffffffff, 55 | ATH_DEBUG_GLOBAL = (ATH_DEBUG_SKB|ATH_DEBUG_SKB_REF) 56 | }; 57 | 58 | #ifdef AR_DEBUG 59 | 60 | /* DEBUG-ONLY DEFINITIONS */ 61 | #define DFLAG_ISSET(_sc, _m) (((_sc)->sc_debug & _m)) 62 | #define DPRINTF(_sc, _m, _fmt, ...) do { \ 63 | if (DFLAG_ISSET((_sc), (_m))) \ 64 | printk(KERN_DEBUG "%s: %s: " _fmt, \ 65 | SC_DEV_NAME(_sc), __func__, ## __VA_ARGS__); \ 66 | } while (0) 67 | #define KEYPRINTF(_sc, _ix, _hk, _mac) do { \ 68 | if (DFLAG_ISSET((_sc), ATH_DEBUG_KEYCACHE)) \ 69 | ath_keyprint((_sc), __func__, _ix, _hk, _mac); \ 70 | } while (0) 71 | 72 | #else /* #ifdef AR_DEBUG */ 73 | 74 | #define DFLAG_ISSET(_sc, _m) 0 75 | #define DPRINTF(_sc, _m, _fmt, ...) 76 | #define KEYPRINTF(_sc, _ix, _hk, _mac) 77 | 78 | #endif /* #ifdef AR_DEBUG */ 79 | 80 | #define IFF_DUMPPKTS(_sc, _m) DFLAG_ISSET((_sc), (_m)) 81 | 82 | #define EPRINTF(_sc, _fmt, ...) \ 83 | printk(KERN_ERR "%s: %s: " _fmt, \ 84 | SC_DEV_NAME(_sc), __func__, ## __VA_ARGS__) 85 | 86 | #define WPRINTF(_sc, _fmt, ...) \ 87 | printk(KERN_WARNING "%s: %s: " _fmt, \ 88 | SC_DEV_NAME(_sc), __func__, ## __VA_ARGS__) 89 | 90 | #define IPRINTF(_sc, _fmt, ...) \ 91 | printk(KERN_INFO "%s: %s: " _fmt, \ 92 | SC_DEV_NAME(_sc), __func__, ## __VA_ARGS__) 93 | 94 | #endif /* #ifndef _IF_ATH_DEBUG_H_ */ 95 | -------------------------------------------------------------------------------- /ath/if_ath_hal_macros.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2007 Michael Taylor 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer, 10 | without modification. 11 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer 12 | * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any 13 | * redistribution must be conditioned upon including a substantially 14 | * similar Disclaimer requirement for further binary redistribution. 15 | * 3. Neither the names of the above-listed copyright holders nor the names 16 | * of any contributors may be used to endorse or promote products derived 17 | * from this software without specific prior written permission. 18 | * 19 | * Alternatively, this software may be distributed under the terms of the 20 | * GNU General Public License ("GPL") version 2 as published by the Free 21 | * Software Foundation. 22 | * 23 | * NO WARRANTY 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 | * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY 27 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 28 | * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, 29 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 32 | * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 34 | * THE POSSIBILITY OF SUCH DAMAGES. 35 | * 36 | * $Id: foo mtaylor $ 37 | */ 38 | /* 39 | * This file provides some macros that are used by if_ath_hal.h, 40 | * if_ath_hal_wrappers.h, and if_ath_hal_wrappers.c. 41 | * 42 | * The macros are provided for the HAL lock and for dynamically deciding whether 43 | * to define the HAL wrapper functions as inline or in the implementation file 44 | * at build time. i.e. inline for speed, or non-inline for debugging visibility 45 | * into the HAL methods being called (despite obfuscation). 46 | * 47 | * The if_ath_hal.h file is generated from ath_hal/ah.h at build time by the 48 | * build system. 49 | */ 50 | #ifndef _IF_ATH_HAL_MACROS_H_ 51 | #define _IF_ATH_HAL_MACROS_H_ 52 | 53 | #define ATH_HAL_LOCK_INIT(_sc) spin_lock_init(&(_sc)->sc_hal_lock) 54 | #define ATH_HAL_LOCK_DESTROY(_sc) 55 | #define ATH_HAL_LOCK_IRQ(_sc) do { \ 56 | unsigned long __sc_halLockflags; \ 57 | ATH_HAL_LOCK_CHECK(_sc); \ 58 | spin_lock_irqsave(&(_sc)->sc_hal_lock, __sc_halLockflags); 59 | #define ATH_HAL_UNLOCK_IRQ(_sc) \ 60 | ATH_HAL_LOCK_ASSERT(_sc); \ 61 | spin_unlock_irqrestore(&(_sc)->sc_hal_lock, __sc_halLockflags); \ 62 | } while (0) 63 | #define ATH_HAL_UNLOCK_IRQ_EARLY(_sc) \ 64 | ATH_HAL_LOCK_ASSERT(_sc); \ 65 | spin_unlock_irqrestore(&(_sc)->sc_hal_lock, __sc_halLockflags); 66 | 67 | #if (defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)) && defined(spin_is_locked) 68 | #define ATH_HAL_LOCK_ASSERT(_sc) \ 69 | KASSERT(spin_is_locked(&(_sc)->sc_hal_lock), ("HAL not locked!")) 70 | #if (defined(ATH_DEBUG_SPINLOCKS)) 71 | #define ATH_HAL_LOCK_CHECK(_sc) do { \ 72 | if (spin_is_locked(&(_sc)->sc_hal_lock)) \ 73 | IPRINTF(_sc, "About to block on HAL lock! [%s:%d]\n", __func__, __LINE__); \ 74 | } while(0) 75 | #else /* #if (defined(ATH_DEBUG_SPINLOCKS)) */ 76 | #define ATH_HAL_LOCK_CHECK(_sc) 77 | #endif /* #if (defined(ATH_DEBUG_SPINLOCKS)) */ 78 | 79 | #else 80 | #define ATH_HAL_LOCK_ASSERT(_sc) 81 | #define ATH_HAL_LOCK_CHECK(_sc) 82 | #endif 83 | 84 | #endif /* #ifndef _IF_ATH_HAL_MACROS_H_ */ 85 | -------------------------------------------------------------------------------- /ath/if_ath_pci.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting 3 | * Copyright (c) 2004-2005 Atheros Communications, Inc. 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer, 11 | * without modification. 12 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer 13 | * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any 14 | * redistribution must be conditioned upon including a substantially 15 | * similar Disclaimer requirement for further binary redistribution. 16 | * 3. Neither the names of the above-listed copyright holders nor the names 17 | * of any contributors may be used to endorse or promote products derived 18 | * from this software without specific prior written permission. 19 | * 20 | * Alternatively, this software may be distributed under the terms of the 21 | * GNU General Public License ("GPL") version 2 as published by the Free 22 | * Software Foundation. 23 | * 24 | * NO WARRANTY 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY 28 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 29 | * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, 30 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 33 | * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 35 | * THE POSSIBILITY OF SUCH DAMAGES. 36 | * 37 | * $Id$ 38 | */ 39 | 40 | #ifndef _DEV_ATH_PCI_H_ 41 | #define _DEV_ATH_PCI_H_ 42 | 43 | #include 44 | #define bus_map_single pci_map_single 45 | #define bus_unmap_single pci_unmap_single 46 | #define bus_dma_sync_single pci_dma_sync_single_for_cpu 47 | #define bus_alloc_consistent pci_alloc_consistent 48 | #define bus_free_consistent pci_free_consistent 49 | #define BUS_DMA_FROMDEVICE PCI_DMA_FROMDEVICE 50 | #define BUS_DMA_TODEVICE PCI_DMA_TODEVICE 51 | 52 | #endif /* _DEV_ATH_PCI_H_ */ 53 | -------------------------------------------------------------------------------- /ath_hal/COPYRIGHT: -------------------------------------------------------------------------------- 1 | All files contained in this distribution are covered by the following 2 | copyright unless explicitly identified otherwise. Note that this 3 | copyright does _NOT_ contain a "or GPL" clause and does _NOT_ permit 4 | redistribution with changes. 5 | 6 | /*- 7 | * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting, Atheros 8 | * Communications, Inc. All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms are permitted 11 | * provided that the following conditions are met: 12 | * 1. The materials contained herein are unmodified and are used 13 | * unmodified. 14 | * 2. Redistributions of source code must retain the above copyright 15 | * notice, this list of conditions and the following NO 16 | * ''WARRANTY'' disclaimer below (''Disclaimer''), without 17 | * modification. 18 | * 3. Redistributions in binary form must reproduce at minimum a 19 | * disclaimer similar to the Disclaimer below and any redistribution 20 | * must be conditioned upon including a substantially similar 21 | * Disclaimer requirement for further binary redistribution. 22 | * 4. Neither the names of the above-listed copyright holders nor the 23 | * names of any contributors may be used to endorse or promote 24 | * product derived from this software without specific prior written 25 | * permission. 26 | * 27 | * NO WARRANTY 28 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | * ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, 31 | * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 32 | * IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE 33 | * FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 35 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 36 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 37 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 38 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 39 | * SUCH DAMAGES. 40 | * 41 | * $Id: //depot/sw/branches/sam_hal/COPYRIGHT#2 $ 42 | */ 43 | -------------------------------------------------------------------------------- /ath_hal/Makefile.kernel: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for the Atheros WLAN driver. 3 | # 4 | 5 | obj ?= . 6 | src ?= . 7 | srctree ?= . 8 | 9 | TOP = $(srctree)/$(src)/.. 10 | 11 | include $(TOP)/BuildCaps.inc 12 | 13 | COMPAT= $(TOP)/include 14 | HAL= $(TOP)/ath_hal 15 | 16 | INCS = -include $(COMPAT)/compat.h -I$(COMPAT) 17 | INCS += -I$(HAL) 18 | 19 | EXTRA_CFLAGS += $(INCS) $(COPTS) 20 | 21 | ath_hal-objs := \ 22 | ah.o \ 23 | ah_eeprom_v1.o \ 24 | ah_eeprom_v14.o \ 25 | ah_eeprom_v3.o \ 26 | ah_os.o \ 27 | ah_regdomain.o \ 28 | ar5210/ar5210_attach.o \ 29 | ar5210/ar5210_beacon.o \ 30 | ar5210/ar5210_interrupts.o \ 31 | ar5210/ar5210_keycache.o \ 32 | ar5210/ar5210_misc.o \ 33 | ar5210/ar5210_phy.o \ 34 | ar5210/ar5210_power.o \ 35 | ar5210/ar5210_recv.o \ 36 | ar5210/ar5210_reset.o \ 37 | ar5210/ar5210_xmit.o \ 38 | ar5211/ar5211_attach.o \ 39 | ar5211/ar5211_beacon.o \ 40 | ar5211/ar5211_interrupts.o \ 41 | ar5211/ar5211_keycache.o \ 42 | ar5211/ar5211_misc.o \ 43 | ar5211/ar5211_phy.o \ 44 | ar5211/ar5211_power.o \ 45 | ar5211/ar5211_recv.o \ 46 | ar5211/ar5211_reset.o \ 47 | ar5211/ar5211_xmit.o \ 48 | ar5212/ar2316.o \ 49 | ar5212/ar2317.o \ 50 | ar5212/ar2413.o \ 51 | ar5212/ar2425.o \ 52 | ar5212/ar5111.o \ 53 | ar5212/ar5112.o \ 54 | ar5212/ar5212_ani.o \ 55 | ar5212/ar5212_attach.o \ 56 | ar5212/ar5212_beacon.o \ 57 | ar5212/ar5212_eeprom.o \ 58 | ar5212/ar5212_gpio.o \ 59 | ar5212/ar5212_interrupts.o \ 60 | ar5212/ar5212_keycache.o \ 61 | ar5212/ar5212_misc.o \ 62 | ar5212/ar5212_phy.o \ 63 | ar5212/ar5212_power.o \ 64 | ar5212/ar5212_recv.o \ 65 | ar5212/ar5212_reset.o \ 66 | ar5212/ar5212_rfgain.o \ 67 | ar5212/ar5212_xmit.o \ 68 | ar5212/ar5413.o \ 69 | ar5416/ar2133.o \ 70 | ar5416/ar5416_ani.o \ 71 | ar5416/ar5416_attach.o \ 72 | ar5416/ar5416_beacon.o \ 73 | ar5416/ar5416_cal.o \ 74 | ar5416/ar5416_cal_adcdc.o \ 75 | ar5416/ar5416_cal_adcgain.o \ 76 | ar5416/ar5416_cal_iq.o \ 77 | ar5416/ar5416_eeprom.o \ 78 | ar5416/ar5416_gpio.o \ 79 | ar5416/ar5416_interrupts.o \ 80 | ar5416/ar5416_keycache.o \ 81 | ar5416/ar5416_misc.o \ 82 | ar5416/ar5416_phy.o \ 83 | ar5416/ar5416_power.o \ 84 | ar5416/ar5416_recv.o \ 85 | ar5416/ar5416_reset.o \ 86 | ar5416/ar5416_xmit.o \ 87 | ar5416/ar9160_attach.o \ 88 | ar5416/ar9280.o \ 89 | ar5416/ar9280_attach.o 90 | 91 | ifeq ($(strip $(BUS)),AHB) 92 | ath_hal-objs += \ 93 | ar5312/ar5312_attach.o \ 94 | ar5312/ar5312_eeprom.o \ 95 | ar5312/ar5312_gpio.o \ 96 | ar5312/ar5312_interrupts.o \ 97 | ar5312/ar5312_misc.o \ 98 | ar5312/ar5312_power.o \ 99 | ar5312/ar5312_reset.o \ 100 | ar5312/ar5315_gpio.o 101 | endif 102 | 103 | obj-$(CONFIG_ATHEROS) += ath_hal.o 104 | -------------------------------------------------------------------------------- /ath_hal/README: -------------------------------------------------------------------------------- 1 | $Id: //depot/sw/branches/sam_hal/README#3 $ 2 | 3 | 4 | Atheros Hardware Access Layer (HAL) 5 | =================================== 6 | 7 | * Copyright (c) 2002-2008 Sam Leffler. 8 | * Copyright (c) 2002-2008 Atheros Communications, Inc. 9 | * All rights reserved. 10 | 11 | Read the file COPYRIGHT for the complete copyright. 12 | 13 | This code manages much of the chip-specific operation of the Atheros 14 | driver. The HAL is provided in a binary-only form in order to 15 | comply with local regulatory agency rules. In the United States 16 | the FCC requires that a radio transmitter only be operated at power 17 | levels and on frequency channels for which it is approved. The FCC 18 | requires that a software-defined radio cannot be configured by a 19 | user to operate outside the approved power levels and frequency 20 | channels. This makes it difficult to open-source code that enforces 21 | limits on the power levels, frequency channels and other parameters 22 | of the radio transmitter. See 23 | 24 | http://ftp.fcc.gov/Bureaus/Engineering_Technology/Orders/2001/fcc01264.pdf 25 | 26 | for the specific FCC regulation. Because the module is provided 27 | in a binary-only form it is marked "Proprietary" on Linux; this 28 | means when you load it you will see messages that your system is 29 | now "tainted". 30 | 31 | If you wish to use this driver on a platform for which an ath_hal 32 | module is not already provided please contact the author. Note that 33 | this is only necessary for new _architectures_; the HAL is not tied to 34 | any specific version of your operating system. 35 | 36 | 37 | Atheros Hardware 38 | ================ 39 | There are many generations of Atheros 802.11 wireless devices that 40 | are typically referred to by their programming model: 41 | 42 | 5210 supports 11a only 43 | 5211 supports both 11a and 11b 44 | 5212 supports 11a, 11b, and 11g 45 | 46 | These parts have been incorporated in a variety of retail products 47 | including cardbus cards and mini-pci cards. In addition many laptop 48 | vendors use Atheros mini-pci cards for their builtin wireless 49 | support. 50 | 51 | The Atheors PCI vendor id is 0x168c. The file ah_devid.h lists most 52 | known PCI device id's but is not exhaustive. Some vendors program 53 | their own vendor and/or device id's to aid in BIOS-locking mini-pci 54 | cards in laptops. 55 | 56 | Atheros SoC Hardware 57 | ==================== 58 | In addition to the cardbus/pci devices Atheros makes System on Chip 59 | (SoC) parts that integrate a MIPS cpu core and one or more MAC and 60 | radio parts. Binary support for these parts is necessarily built 61 | for the embedded MIPS processor where the code is to be run. 62 | 63 | Caveats 64 | ======= 65 | The binary hal builds provided here include no floating point and 66 | are operating system-independent. However due to toolchain 67 | peculiarities the .o files may be wrongly rejected by development 68 | tools. If that happens it may be possible to patch the file header 69 | so that the native toolchain will accept the files. In particular 70 | this has been observed for various Linux MIPS installations for the 71 | SoC parts. If you have issues consult the associated .inc file in 72 | the public directory; it explains exactly how the binary file was 73 | created (e.g. toolchain and compilation options). 74 | -------------------------------------------------------------------------------- /ath_hal/ah_debug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008 Sam Leffler, Errno Consulting 3 | * Copyright (c) 2008 Atheros Communications, Inc. 4 | * 5 | * Permission to use, copy, modify, and/or distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | * 17 | * $Id: ah_debug.h,v 1.1 2008/10/12 16:44:34 sam Exp $ 18 | */ 19 | #ifndef _ATH_AH_DEBUG_H_ 20 | #define _ATH_AH_DEBUG_H_ 21 | /* 22 | * Atheros Device Hardware Access Layer (HAL). 23 | * 24 | * Debug mask definitions. 25 | */ 26 | enum { 27 | HAL_DEBUG_REGDOMAIN = 0x00000001, /* regulatory handling */ 28 | HAL_DEBUG_ATTACH = 0x00000002, /* work done in attach */ 29 | HAL_DEBUG_RESET = 0x00000004, /* reset work */ 30 | HAL_DEBUG_NFCAL = 0x00000008, /* noise floor calibration */ 31 | HAL_DEBUG_PERCAL = 0x00000010, /* periodic calibration */ 32 | HAL_DEBUG_ANI = 0x00000020, /* ANI operation */ 33 | HAL_DEBUG_PHYIO = 0x00000040, /* phy i/o operations */ 34 | HAL_DEBUG_REGIO = 0x00000080, /* register i/o operations */ 35 | HAL_DEBUG_RFPARAM = 0x00000100, 36 | HAL_DEBUG_TXQUEUE = 0x00000200, /* tx queue handling */ 37 | HAL_DEBUG_TX = 0x00000400, 38 | HAL_DEBUG_TXDESC = 0x00000800, 39 | HAL_DEBUG_RX = 0x00001000, 40 | HAL_DEBUG_RXDESC = 0x00002000, 41 | HAL_DEBUG_KEYCACHE = 0x00004000, /* keycache handling */ 42 | HAL_DEBUG_EEPROM = 0x00008000, 43 | HAL_DEBUG_BEACON = 0x00010000, /* beacon setup work */ 44 | HAL_DEBUG_POWER = 0x00020000, /* power management */ 45 | HAL_DEBUG_INTERRUPT = 0x00000080, /* interrupt handling */ 46 | 47 | HAL_DEBUG_ANY = 0xffffffff 48 | }; 49 | #endif /* _ATH_AH_DEBUG_H_ */ 50 | -------------------------------------------------------------------------------- /ath_hal/ah_decode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 3 | * Copyright (c) 2002-2008 Atheros Communications, Inc. 4 | * 5 | * Permission to use, copy, modify, and/or distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | * 17 | * $Id: ah_decode.h,v 1.4 2008/11/10 04:08:00 sam Exp $ 18 | */ 19 | #ifndef _ATH_AH_DECODE_H_ 20 | #define _ATH_AH_DECODE_H_ 21 | /* 22 | * Register tracing support. 23 | * 24 | * Setting hw.ath.hal.alq=1 enables tracing of all register reads and 25 | * writes to the file /tmp/ath_hal.log. The file format is a simple 26 | * fixed-size array of records. When done logging set hw.ath.hal.alq=0 27 | * and then decode the file with the arcode program (that is part of the 28 | * HAL). If you start+stop tracing the data will be appended to an 29 | * existing file. 30 | */ 31 | struct athregrec { 32 | uint32_t op : 8, 33 | reg : 24; 34 | uint32_t val; 35 | }; 36 | 37 | enum { 38 | OP_READ = 0, /* register read */ 39 | OP_WRITE = 1, /* register write */ 40 | OP_DEVICE = 2, /* device identification */ 41 | OP_MARK = 3, /* application marker */ 42 | }; 43 | 44 | enum { 45 | AH_MARK_RESET, /* ar*Reset entry, bChannelChange */ 46 | AH_MARK_RESET_LINE, /* ar*_reset.c, line %d */ 47 | AH_MARK_RESET_DONE, /* ar*Reset exit, error code */ 48 | AH_MARK_CHIPRESET, /* ar*ChipReset, channel num */ 49 | AH_MARK_PERCAL, /* ar*PerCalibration, channel num */ 50 | AH_MARK_SETCHANNEL, /* ar*SetChannel, channel num */ 51 | AH_MARK_ANI_RESET, /* ar*AniReset, opmode */ 52 | AH_MARK_ANI_POLL, /* ar*AniReset, listen time */ 53 | AH_MARK_ANI_CONTROL, /* ar*AniReset, cmd */ 54 | }; 55 | #endif /* _ATH_AH_DECODE_H_ */ 56 | -------------------------------------------------------------------------------- /ath_hal/ah_devid.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 3 | * Copyright (c) 2002-2008 Atheros Communications, Inc. 4 | * 5 | * Permission to use, copy, modify, and/or distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | * 17 | * $Id$ 18 | */ 19 | 20 | #ifndef _DEV_ATH_DEVID_H_ 21 | #define _DEV_ATH_DEVID_H_ 22 | 23 | #define ATHEROS_VENDOR_ID 0x168c /* Atheros PCI vendor ID */ 24 | /* 25 | * NB: all Atheros-based devices should have a PCI vendor ID 26 | * of 0x168c, but some vendors, in their infinite wisdom 27 | * do not follow this so we must handle them specially. 28 | */ 29 | #define ATHEROS_3COM_VENDOR_ID 0xa727 /* 3Com 3CRPAG175 vendor ID */ 30 | #define ATHEROS_3COM2_VENDOR_ID 0x10b7 /* 3Com 3CRDAG675 vendor ID */ 31 | 32 | /* AR5210 (for reference) */ 33 | #define AR5210_DEFAULT 0x1107 /* No eeprom HW default */ 34 | #define AR5210_PROD 0x0007 /* Final device ID */ 35 | #define AR5210_AP 0x0207 /* Early AP11s */ 36 | 37 | /* AR5211 */ 38 | #define AR5211_DEFAULT 0x1112 /* No eeprom HW default */ 39 | #define AR5311_DEVID 0x0011 /* Final ar5311 devid */ 40 | #define AR5211_DEVID 0x0012 /* Final ar5211 devid */ 41 | #define AR5211_LEGACY 0xff12 /* Original emulation board */ 42 | #define AR5211_FPGA11B 0xf11b /* 11b emulation board */ 43 | 44 | /* AR5212 */ 45 | #define AR5212_DEFAULT 0x1113 /* No eeprom HW default */ 46 | #define AR5212_DEVID 0x0013 /* Final ar5212 devid */ 47 | #define AR5212_FPGA 0xf013 /* Emulation board */ 48 | #define AR5212_DEVID_IBM 0x1014 /* IBM minipci ID */ 49 | #define AR5212_AR5312_REV2 0x0052 /* AR5312 WMAC (AP31) */ 50 | #define AR5212_AR5312_REV7 0x0057 /* AR5312 WMAC (AP30-040) */ 51 | #define AR5212_AR2313_REV8 0x0058 /* AR2313 WMAC (AP43-030) */ 52 | #define AR5212_AR2315_REV6 0x0086 /* AR2315 WMAC (AP51-Light) */ 53 | #define AR5212_AR2315_REV7 0x0087 /* AR2315 WMAC (AP51-Full) */ 54 | #define AR5212_AR2317_REV1 0x0090 /* AR2317 WMAC (AP61-Light) */ 55 | #define AR5212_AR2317_REV2 0x0091 /* AR2317 WMAC (AP61-Full) */ 56 | 57 | /* AR5212 compatible devid's also attach to 5212 */ 58 | #define AR5212_DEVID_0014 0x0014 59 | #define AR5212_DEVID_0015 0x0015 60 | #define AR5212_DEVID_0016 0x0016 61 | #define AR5212_DEVID_0017 0x0017 62 | #define AR5212_DEVID_0018 0x0018 63 | #define AR5212_DEVID_0019 0x0019 64 | #define AR5212_AR2413 0x001a /* AR2413 aka Griffin-lite */ 65 | #define AR5212_AR5413 0x001b /* Eagle */ 66 | #define AR5212_AR5424 0x001c /* Condor (PCI express) */ 67 | #define AR5212_AR2417 0x001d /* Nala, PCI */ 68 | #define AR5212_DEVID_FF19 0xff19 /* XXX PCI express */ 69 | 70 | /* AR5213 */ 71 | #define AR5213_SREV_1_0 0x0055 72 | #define AR5213_SREV_REG 0x4020 73 | 74 | /* AR5416 compatible devid's */ 75 | #define AR5416_DEVID_PCI 0x0023 /* AR5416 PCI (MB/CB) Owl */ 76 | #define AR5416_DEVID_PCIE 0x0024 /* AR5416 PCI-E (XB) Owl */ 77 | #define AR9160_DEVID_PCI 0x0027 /* AR9160 PCI Sowl */ 78 | #define AR9280_DEVID_PCI 0x0029 /* AR9280 PCI Merlin */ 79 | #define AR9280_DEVID_PCIE 0x002a /* AR9280 PCI-E Merlin */ 80 | #define AR9285_DEVID_PCIE 0x002b /* AR9285 PCI-E Kite */ 81 | 82 | #define AR_SUBVENDOR_ID_NOG 0x0e11 /* No 11G subvendor ID */ 83 | #define AR_SUBVENDOR_ID_NEW_A 0x7065 /* Update device to new RD */ 84 | #endif /* _DEV_ATH_DEVID_H */ 85 | -------------------------------------------------------------------------------- /ath_hal/ah_eeprom_v1.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 3 | * Copyright (c) 2002-2008 Atheros Communications, Inc. 4 | * 5 | * Permission to use, copy, modify, and/or distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | * 17 | * $Id: ah_eeprom_v1.h,v 1.1 2008/11/11 02:40:11 sam Exp $ 18 | */ 19 | #ifndef _ATH_AH_EEPROM_V1_H_ 20 | #define _ATH_AH_EEPROM_V1_H_ 21 | 22 | #include "ah_eeprom.h" 23 | 24 | /* 25 | * EEPROM defines for Version 1 Crete EEPROM. 26 | * 27 | * The EEPROM is segmented into three sections: 28 | * 29 | * PCI/Cardbus default configuration settings 30 | * Cardbus CIS tuples and vendor-specific data 31 | * Atheros-specific data 32 | * 33 | * EEPROM entries are read 32-bits at a time through the PCI bus 34 | * interface but are all 16-bit values. 35 | * 36 | * Access to the Atheros-specific data is controlled by protection 37 | * bits and the data is checksum'd. The driver reads the Atheros 38 | * data from the EEPROM at attach and caches it in its private state. 39 | * This data includes the local regulatory domain, channel calibration 40 | * settings, and phy-related configuration settings. 41 | */ 42 | #define AR_EEPROM_MAC(i) (0x1f-(i))/* MAC address word */ 43 | #define AR_EEPROM_MAGIC 0x3d /* magic number */ 44 | #define AR_EEPROM_PROTECT 0x3f /* Atheros segment protect register */ 45 | #define AR_EEPROM_PROTOTECT_WP_128_191 0x80 46 | #define AR_EEPROM_REG_DOMAIN 0xbf /* Current regulatory domain register */ 47 | #define AR_EEPROM_ATHEROS_BASE 0xc0 /* Base of Atheros-specific data */ 48 | #define AR_EEPROM_ATHEROS_MAX 64 /* 64x2=128 bytes of EEPROM settings */ 49 | #define AR_EEPROM_ATHEROS(n) (AR_EEPROM_ATHEROS_BASE+(n)) 50 | #define AR_EEPROM_VERSION AR_EEPROM_ATHEROS(1) 51 | #define AR_EEPROM_ATHEROS_TP_SETTINGS 0x09 /* Transmit power settings */ 52 | #define AR_REG_DOMAINS_MAX 4 /* # of Regulatory Domains */ 53 | #define AR_CHANNELS_MAX 5 /* # of Channel calibration groups */ 54 | #define AR_TP_SETTINGS_SIZE 11 /* # locations/Channel group */ 55 | #define AR_TP_SCALING_ENTRIES 11 /* # entries in transmit power dBm->pcdac */ 56 | 57 | /* 58 | * NB: we store the rfsilent select+polarity data packed 59 | * with the encoding used in later parts so values 60 | * returned to applications are consistent. 61 | */ 62 | #define AR_EEPROM_RFSILENT_GPIO_SEL 0x001c 63 | #define AR_EEPROM_RFSILENT_GPIO_SEL_S 2 64 | #define AR_EEPROM_RFSILENT_POLARITY 0x0002 65 | #define AR_EEPROM_RFSILENT_POLARITY_S 1 66 | 67 | #define AR_I2DBM(x) ((uint8_t)((x * 2) + 3)) 68 | 69 | /* 70 | * Transmit power and channel calibration settings. 71 | */ 72 | struct tpcMap { 73 | uint8_t pcdac[AR_TP_SCALING_ENTRIES]; 74 | uint8_t gainF[AR_TP_SCALING_ENTRIES]; 75 | uint8_t rate36; 76 | uint8_t rate48; 77 | uint8_t rate54; 78 | uint8_t regdmn[AR_REG_DOMAINS_MAX]; 79 | }; 80 | 81 | /* 82 | * Information retrieved from EEPROM. 83 | */ 84 | typedef struct { 85 | uint16_t ee_version; /* Version field */ 86 | uint16_t ee_protect; /* EEPROM protect field */ 87 | uint16_t ee_antenna; /* Antenna Settings */ 88 | uint16_t ee_biasCurrents; /* OB, DB */ 89 | uint8_t ee_thresh62; /* thresh62 */ 90 | uint8_t ee_xlnaOn; /* External LNA timing */ 91 | uint8_t ee_xpaOff; /* Extern output stage timing */ 92 | uint8_t ee_xpaOn; /* Extern output stage timing */ 93 | uint8_t ee_rfKill; /* Single low bit signalling if RF Kill is implemented */ 94 | uint8_t ee_devType; /* Type: PCI, miniPCI, CB */ 95 | uint8_t ee_regDomain[AR_REG_DOMAINS_MAX]; 96 | /* calibrated reg domains */ 97 | struct tpcMap ee_tpc[AR_CHANNELS_MAX]; 98 | } HAL_EEPROM_v1; 99 | #endif /* _ATH_AH_EEPROM_V1_H_ */ 100 | -------------------------------------------------------------------------------- /ath_hal/ah_soc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 3 | * Copyright (c) 2002-2008 Atheros Communications, Inc. 4 | * 5 | * Permission to use, copy, modify, and/or distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | * 17 | * $Id: ah_soc.h,v 1.4 2008/11/10 04:08:00 sam Exp $ 18 | */ 19 | #ifndef _ATH_AH_SOC_H_ 20 | #define _ATH_AH_SOC_H_ 21 | /* 22 | * Atheros System on Chip (SoC) public definitions. 23 | */ 24 | 25 | /* 26 | * This is board-specific data that is stored in a "known" 27 | * location in flash. To find the start of this data search 28 | * back from the (aliased) end of flash by 0x1000 bytes at a 29 | * time until you find the string "5311", which marks the 30 | * start of Board Configuration. Typically one gives up if 31 | * more than 500KB is searched. 32 | */ 33 | struct ar531x_boarddata { 34 | uint32_t magic; /* board data is valid */ 35 | #define AR531X_BD_MAGIC 0x35333131 /* "5311", for all 531x platforms */ 36 | uint16_t cksum; /* checksum (starting with BD_REV 2) */ 37 | uint16_t rev; /* revision of this struct */ 38 | #define BD_REV 4 39 | char boardName[64]; /* Name of board */ 40 | uint16_t major; /* Board major number */ 41 | uint16_t minor; /* Board minor number */ 42 | uint32_t config; /* Board configuration */ 43 | #define BD_ENET0 0x00000001 /* ENET0 is stuffed */ 44 | #define BD_ENET1 0x00000002 /* ENET1 is stuffed */ 45 | #define BD_UART1 0x00000004 /* UART1 is stuffed */ 46 | #define BD_UART0 0x00000008 /* UART0 is stuffed (dma) */ 47 | #define BD_RSTFACTORY 0x00000010 /* Reset factory defaults stuffed */ 48 | #define BD_SYSLED 0x00000020 /* System LED stuffed */ 49 | #define BD_EXTUARTCLK 0x00000040 /* External UART clock */ 50 | #define BD_CPUFREQ 0x00000080 /* cpu freq is valid in nvram */ 51 | #define BD_SYSFREQ 0x00000100 /* sys freq is set in nvram */ 52 | #define BD_WLAN0 0x00000200 /* Enable WLAN0 */ 53 | #define BD_MEMCAP 0x00000400 /* CAP SDRAM @ memCap for testing */ 54 | #define BD_DISWATCHDOG 0x00000800 /* disable system watchdog */ 55 | #define BD_WLAN1 0x00001000 /* Enable WLAN1 (ar5212) */ 56 | #define BD_ISCASPER 0x00002000 /* FLAG for AR2312 */ 57 | #define BD_WLAN0_2G_EN 0x00004000 /* FLAG for radio0_2G */ 58 | #define BD_WLAN0_5G_EN 0x00008000 /* FLAG for radio0_2G */ 59 | #define BD_WLAN1_2G_EN 0x00020000 /* FLAG for radio0_2G */ 60 | #define BD_WLAN1_5G_EN 0x00040000 /* FLAG for radio0_2G */ 61 | uint16_t resetConfigGpio; /* Reset factory GPIO pin */ 62 | uint16_t sysLedGpio; /* System LED GPIO pin */ 63 | 64 | uint32_t cpuFreq; /* CPU core frequency in Hz */ 65 | uint32_t sysFreq; /* System frequency in Hz */ 66 | uint32_t cntFreq; /* Calculated C0_COUNT frequency */ 67 | 68 | uint8_t wlan0Mac[6]; 69 | uint8_t enet0Mac[6]; 70 | uint8_t enet1Mac[6]; 71 | 72 | uint16_t pciId; /* Pseudo PCIID for common code */ 73 | uint16_t memCap; /* cap bank1 in MB */ 74 | 75 | /* version 3 */ 76 | uint8_t wlan1Mac[6]; /* (ar5212) */ 77 | }; 78 | 79 | /* 80 | * Board support data. The driver is required to locate 81 | * and fill-in this information before passing a reference to 82 | * this structure as the HAL_BUS_TAG parameter supplied to 83 | * ath_hal_attach. 84 | */ 85 | struct ar531x_config { 86 | const struct ar531x_boarddata *board; /* board config data */ 87 | const char *radio; /* radio config data */ 88 | int unit; /* unit number [0, 1] */ 89 | void *tag; /* bus space tag */ 90 | }; 91 | #endif /* _ATH_AH_SOC_H_ */ 92 | -------------------------------------------------------------------------------- /ath_hal/ar5210/ar5210_interrupts.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 3 | * Copyright (c) 2002-2004 Atheros Communications, Inc. 4 | * 5 | * Permission to use, copy, modify, and/or distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | * 17 | * $Id: ar5210_interrupts.c,v 1.4 2008/11/10 04:08:02 sam Exp $ 18 | */ 19 | #include "opt_ah.h" 20 | 21 | #include "ah.h" 22 | #include "ah_internal.h" 23 | 24 | #include "ar5210/ar5210.h" 25 | #include "ar5210/ar5210reg.h" 26 | 27 | /* 28 | * Return non-zero if an interrupt is pending. 29 | */ 30 | HAL_BOOL 31 | ar5210IsInterruptPending(struct ath_hal *ah) 32 | { 33 | return (OS_REG_READ(ah, AR_INTPEND) ? AH_TRUE : AH_FALSE); 34 | } 35 | 36 | /* 37 | * Read the Interrupt Status Register value and return 38 | * an abstracted bitmask of the data found in the ISR. 39 | * Note that reading the ISR clear pending interrupts. 40 | */ 41 | HAL_BOOL 42 | ar5210GetPendingInterrupts(struct ath_hal *ah, HAL_INT *masked) 43 | { 44 | #define AR_FATAL_INT \ 45 | (AR_ISR_MCABT_INT | AR_ISR_SSERR_INT | AR_ISR_DPERR_INT | AR_ISR_RXORN_INT) 46 | struct ath_hal_5210 *ahp = AH5210(ah); 47 | uint32_t isr; 48 | 49 | isr = OS_REG_READ(ah, AR_ISR); 50 | if (isr == 0xffffffff) { 51 | *masked = 0; 52 | return AH_FALSE; 53 | } 54 | 55 | /* 56 | * Mask interrupts that have no device-independent 57 | * representation; these are added back below. We 58 | * also masked with the abstracted IMR to insure no 59 | * status bits leak through that weren't requested 60 | * (e.g. RXNOFRM) and that might confuse the caller. 61 | */ 62 | *masked = (isr & HAL_INT_COMMON) & ahp->ah_maskReg; 63 | 64 | if (isr & AR_FATAL_INT) 65 | *masked |= HAL_INT_FATAL; 66 | if (isr & (AR_ISR_RXOK_INT | AR_ISR_RXERR_INT)) 67 | *masked |= HAL_INT_RX; 68 | if (isr & (AR_ISR_TXOK_INT | AR_ISR_TXDESC_INT | AR_ISR_TXERR_INT | AR_ISR_TXEOL_INT)) 69 | *masked |= HAL_INT_TX; 70 | 71 | /* 72 | * On fatal errors collect ISR state for debugging. 73 | */ 74 | if (*masked & HAL_INT_FATAL) { 75 | AH_PRIVATE(ah)->ah_fatalState[0] = isr; 76 | } 77 | 78 | return AH_TRUE; 79 | #undef AR_FATAL_INT 80 | } 81 | 82 | HAL_INT 83 | ar5210GetInterrupts(struct ath_hal *ah) 84 | { 85 | return AH5210(ah)->ah_maskReg; 86 | } 87 | 88 | HAL_INT 89 | ar5210SetInterrupts(struct ath_hal *ah, HAL_INT ints) 90 | { 91 | struct ath_hal_5210 *ahp = AH5210(ah); 92 | uint32_t omask = ahp->ah_maskReg; 93 | uint32_t mask; 94 | 95 | HALDEBUG(ah, HAL_DEBUG_INTERRUPT, "%s: 0x%x => 0x%x\n", 96 | __func__, omask, ints); 97 | 98 | /* 99 | * Disable interrupts here before reading & modifying 100 | * the mask so that the ISR does not modify the mask 101 | * out from under us. 102 | */ 103 | if (omask & HAL_INT_GLOBAL) { 104 | HALDEBUG(ah, HAL_DEBUG_INTERRUPT, "%s: disable IER\n", __func__); 105 | OS_REG_WRITE(ah, AR_IER, AR_IER_DISABLE); 106 | } 107 | 108 | mask = ints & HAL_INT_COMMON; 109 | if (ints & HAL_INT_RX) 110 | mask |= AR_IMR_RXOK_INT | AR_IMR_RXERR_INT; 111 | if (ints & HAL_INT_TX) { 112 | if (ahp->ah_txOkInterruptMask) 113 | mask |= AR_IMR_TXOK_INT; 114 | if (ahp->ah_txErrInterruptMask) 115 | mask |= AR_IMR_TXERR_INT; 116 | if (ahp->ah_txDescInterruptMask) 117 | mask |= AR_IMR_TXDESC_INT; 118 | if (ahp->ah_txEolInterruptMask) 119 | mask |= AR_IMR_TXEOL_INT; 120 | } 121 | 122 | /* Write the new IMR and store off our SW copy. */ 123 | HALDEBUG(ah, HAL_DEBUG_INTERRUPT, "%s: new IMR 0x%x\n", __func__, mask); 124 | OS_REG_WRITE(ah, AR_IMR, mask); 125 | ahp->ah_maskReg = ints; 126 | 127 | /* Re-enable interrupts as appropriate. */ 128 | if (ints & HAL_INT_GLOBAL) { 129 | HALDEBUG(ah, HAL_DEBUG_INTERRUPT, "%s: enable IER\n", __func__); 130 | OS_REG_WRITE(ah, AR_IER, AR_IER_ENABLE); 131 | } 132 | 133 | return omask; 134 | } 135 | -------------------------------------------------------------------------------- /ath_hal/ar5210/ar5210_phy.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 3 | * Copyright (c) 2002-2004 Atheros Communications, Inc. 4 | * 5 | * Permission to use, copy, modify, and/or distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | * 17 | * $Id: ar5210_phy.c,v 1.3 2008/11/10 01:19:37 sam Exp $ 18 | */ 19 | #include "opt_ah.h" 20 | 21 | #include "ah.h" 22 | #include "ah_internal.h" 23 | 24 | #include "ar5210/ar5210.h" 25 | 26 | /* shorthands to compact tables for readability */ 27 | #define OFDM IEEE80211_T_OFDM 28 | #define TURBO IEEE80211_T_TURBO 29 | 30 | HAL_RATE_TABLE ar5210_11a_table = { 31 | 8, /* number of rates */ 32 | { 0 }, 33 | { 34 | /* short ctrl */ 35 | /* valid rateCode Preamble dot11Rate Rate */ 36 | /* 6 Mb */ { AH_TRUE, OFDM, 6000, 0x0b, 0x00, (0x80|12), 0 }, 37 | /* 9 Mb */ { AH_TRUE, OFDM, 9000, 0x0f, 0x00, 18, 0 }, 38 | /* 12 Mb */ { AH_TRUE, OFDM, 12000, 0x0a, 0x00, (0x80|24), 2 }, 39 | /* 18 Mb */ { AH_TRUE, OFDM, 18000, 0x0e, 0x00, 36, 2 }, 40 | /* 24 Mb */ { AH_TRUE, OFDM, 24000, 0x09, 0x00, (0x80|48), 4 }, 41 | /* 36 Mb */ { AH_TRUE, OFDM, 36000, 0x0d, 0x00, 72, 4 }, 42 | /* 48 Mb */ { AH_TRUE, OFDM, 48000, 0x08, 0x00, 96, 4 }, 43 | /* 54 Mb */ { AH_TRUE, OFDM, 54000, 0x0c, 0x00, 108, 4 } 44 | }, 45 | }; 46 | 47 | HAL_RATE_TABLE ar5210_turbo_table = { 48 | 8, /* number of rates */ 49 | { 0 }, 50 | { 51 | /* short ctrl */ 52 | /* valid rateCode Preamble dot11Rate Rate */ 53 | /* 6 Mb */ { AH_TRUE, TURBO, 6000, 0x0b, 0x00, (0x80|12), 0 }, 54 | /* 9 Mb */ { AH_TRUE, TURBO, 9000, 0x0f, 0x00, 18, 0 }, 55 | /* 12 Mb */ { AH_TRUE, TURBO, 12000, 0x0a, 0x00, (0x80|24), 2 }, 56 | /* 18 Mb */ { AH_TRUE, TURBO, 18000, 0x0e, 0x00, 36, 2 }, 57 | /* 24 Mb */ { AH_TRUE, TURBO, 24000, 0x09, 0x00, (0x80|48), 4 }, 58 | /* 36 Mb */ { AH_TRUE, TURBO, 36000, 0x0d, 0x00, 72, 4 }, 59 | /* 48 Mb */ { AH_TRUE, TURBO, 48000, 0x08, 0x00, 96, 4 }, 60 | /* 54 Mb */ { AH_TRUE, TURBO, 54000, 0x0c, 0x00, 108, 4 } 61 | }, 62 | }; 63 | 64 | #undef OFDM 65 | #undef TURBO 66 | 67 | const HAL_RATE_TABLE * 68 | ar5210GetRateTable(struct ath_hal *ah, u_int mode) 69 | { 70 | HAL_RATE_TABLE *rt; 71 | switch (mode) { 72 | case HAL_MODE_11A: 73 | rt = &ar5210_11a_table; 74 | break; 75 | case HAL_MODE_TURBO: 76 | rt = &ar5210_turbo_table; 77 | break; 78 | default: 79 | HALDEBUG(ah, HAL_DEBUG_ANY, "%s: invalid mode 0x%x\n", 80 | __func__, mode); 81 | return AH_NULL; 82 | } 83 | ath_hal_setupratetable(ah, rt); 84 | return rt; 85 | } 86 | -------------------------------------------------------------------------------- /ath_hal/ar5210/ar5210_power.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 3 | * Copyright (c) 2002-2004 Atheros Communications, Inc. 4 | * 5 | * Permission to use, copy, modify, and/or distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | * 17 | * $Id: ar5210_power.c,v 1.4 2008/11/10 04:08:02 sam Exp $ 18 | */ 19 | #include "opt_ah.h" 20 | 21 | #include "ah.h" 22 | #include "ah_internal.h" 23 | 24 | #include "ar5210/ar5210.h" 25 | #include "ar5210/ar5210reg.h" 26 | 27 | /* 28 | * Notify Power Mgt is disabled in self-generated frames. 29 | * If requested, set Power Mode of chip to auto/normal. 30 | */ 31 | static void 32 | ar5210SetPowerModeAuto(struct ath_hal *ah, int setChip) 33 | { 34 | OS_REG_SET_BIT(ah, AR_STA_ID1, AR_STA_ID1_PWR_SV); 35 | if (setChip) 36 | OS_REG_RMW_FIELD(ah, AR_SCR, AR_SCR_SLE, AR_SCR_SLE_ALLOW); 37 | } 38 | 39 | /* 40 | * Notify Power Mgt is enabled in self-generated frames. 41 | * If requested, force chip awake. 42 | * 43 | * Returns A_OK if chip is awake or successfully forced awake. 44 | * 45 | * WARNING WARNING WARNING 46 | * There is a problem with the chip where sometimes it will not wake up. 47 | */ 48 | static HAL_BOOL 49 | ar5210SetPowerModeAwake(struct ath_hal *ah, int setChip) 50 | { 51 | #define POWER_UP_TIME 2000 52 | uint32_t val; 53 | int i; 54 | 55 | if (setChip) { 56 | OS_REG_RMW_FIELD(ah, AR_SCR, AR_SCR_SLE, AR_SCR_SLE_WAKE); 57 | OS_DELAY(2000); /* Give chip the chance to awake */ 58 | 59 | for (i = POWER_UP_TIME / 200; i != 0; i--) { 60 | val = OS_REG_READ(ah, AR_PCICFG); 61 | if ((val & AR_PCICFG_SPWR_DN) == 0) 62 | break; 63 | OS_DELAY(200); 64 | OS_REG_RMW_FIELD(ah, AR_SCR, AR_SCR_SLE, 65 | AR_SCR_SLE_WAKE); 66 | } 67 | if (i == 0) { 68 | #ifdef AH_DEBUG 69 | ath_hal_printf(ah, "%s: Failed to wakeup in %ums\n", 70 | __func__, POWER_UP_TIME/20); 71 | #endif 72 | return AH_FALSE; 73 | } 74 | } 75 | 76 | OS_REG_CLR_BIT(ah, AR_STA_ID1, AR_STA_ID1_PWR_SV); 77 | return AH_TRUE; 78 | #undef POWER_UP_TIME 79 | } 80 | 81 | /* 82 | * Notify Power Mgt is disabled in self-generated frames. 83 | * If requested, force chip to sleep. 84 | */ 85 | static void 86 | ar5210SetPowerModeSleep(struct ath_hal *ah, int setChip) 87 | { 88 | OS_REG_SET_BIT(ah, AR_STA_ID1, AR_STA_ID1_PWR_SV); 89 | if (setChip) 90 | OS_REG_RMW_FIELD(ah, AR_SCR, AR_SCR_SLE, AR_SCR_SLE_SLP); 91 | } 92 | 93 | HAL_BOOL 94 | ar5210SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip) 95 | { 96 | struct ath_hal_5210 *ahp = AH5210(ah); 97 | #ifdef AH_DEBUG 98 | static const char* modes[] = { 99 | "AWAKE", 100 | "FULL-SLEEP", 101 | "NETWORK SLEEP", 102 | "UNDEFINED" 103 | }; 104 | #endif 105 | int status = AH_TRUE; 106 | 107 | HALDEBUG(ah, HAL_DEBUG_POWER, "%s: %s -> %s (%s)\n", __func__, 108 | modes[ahp->ah_powerMode], modes[mode], 109 | setChip ? "set chip " : ""); 110 | switch (mode) { 111 | case HAL_PM_AWAKE: 112 | status = ar5210SetPowerModeAwake(ah, setChip); 113 | break; 114 | case HAL_PM_FULL_SLEEP: 115 | ar5210SetPowerModeSleep(ah, setChip); 116 | break; 117 | case HAL_PM_NETWORK_SLEEP: 118 | ar5210SetPowerModeAuto(ah, setChip); 119 | break; 120 | default: 121 | HALDEBUG(ah, HAL_DEBUG_ANY, "%s: unknown power mode %u\n", 122 | __func__, mode); 123 | return AH_FALSE; 124 | } 125 | ahp->ah_powerMode = mode; 126 | return status; 127 | } 128 | 129 | HAL_POWER_MODE 130 | ar5210GetPowerMode(struct ath_hal *ah) 131 | { 132 | /* Just so happens the h/w maps directly to the abstracted value */ 133 | return MS(OS_REG_READ(ah, AR_SCR), AR_SCR_SLE); 134 | } 135 | -------------------------------------------------------------------------------- /ath_hal/ar5210/ar5210phy.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 3 | * Copyright (c) 2002-2004 Atheros Communications, Inc. 4 | * 5 | * Permission to use, copy, modify, and/or distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | * 17 | * $Id: ar5210phy.h,v 1.4 2008/11/10 01:19:37 sam Exp $ 18 | */ 19 | #ifndef _DEV_ATH_AR5210PHY_H 20 | #define _DEV_ATH_AR5210PHY_H 21 | 22 | /* 23 | * Definitions for the PHY on the Atheros AR5210 parts. 24 | */ 25 | 26 | /* PHY Registers */ 27 | #define AR_PHY_BASE 0x9800 /* PHY register base */ 28 | #define AR_PHY(_n) (AR_PHY_BASE + ((_n)<<2)) 29 | 30 | #define AR_PHY_FRCTL 0x9804 /* PHY frame control */ 31 | #define AR_PHY_TURBO_MODE 0x00000001 /* PHY turbo mode */ 32 | #define AR_PHY_TURBO_SHORT 0x00000002 /* PHY turbo short symbol */ 33 | #define AR_PHY_TIMING_ERR 0x01000000 /* Detect PHY timing error */ 34 | #define AR_PHY_PARITY_ERR 0x02000000 /* Detect signal parity err */ 35 | #define AR_PHY_ILLRATE_ERR 0x04000000 /* Detect PHY illegal rate */ 36 | #define AR_PHY_ILLLEN_ERR 0x08000000 /* Detect PHY illegal length */ 37 | #define AR_PHY_SERVICE_ERR 0x20000000 /* Detect PHY nonzero service */ 38 | #define AR_PHY_TXURN_ERR 0x40000000 /* DetectPHY TX underrun */ 39 | #define AR_PHY_FRCTL_BITS \ 40 | "\20\1TURBO_MODE\2TURBO_SHORT\30TIMING_ERR\31PARITY_ERR\32ILLRATE_ERR"\ 41 | "\33ILLEN_ERR\35SERVICE_ERR\36TXURN_ERR" 42 | 43 | #define AR_PHY_AGC 0x9808 /* PHY AGC command */ 44 | #define AR_PHY_AGC_DISABLE 0x08000000 /* Disable PHY AGC */ 45 | #define AR_PHY_AGC_BITS "\20\33DISABLE" 46 | 47 | #define AR_PHY_CHIPID 0x9818 /* PHY chip revision */ 48 | 49 | #define AR_PHY_ACTIVE 0x981c /* PHY activation */ 50 | #define AR_PHY_ENABLE 0x00000001 /* activate PHY */ 51 | #define AR_PHY_DISABLE 0x00000002 /* deactivate PHY */ 52 | #define AR_PHY_ACTIVE_BITS "\20\1ENABLE\2DISABLE" 53 | 54 | #define AR_PHY_AGCCTL 0x9860 /* PHY calibration and noise floor */ 55 | #define AR_PHY_AGC_CAL 0x00000001 /* PHY internal calibration */ 56 | #define AR_PHY_AGC_NF 0x00000002 /* calc PHY noise-floor */ 57 | #define AR_PHY_AGCCTL_BITS "\20\1CAL\2NF" 58 | 59 | #endif /* _DEV_ATH_AR5210PHY_H */ 60 | -------------------------------------------------------------------------------- /ath_hal/ar5211/ar5211_phy.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 3 | * Copyright (c) 2002-2006 Atheros Communications, Inc. 4 | * 5 | * Permission to use, copy, modify, and/or distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | * 17 | * $Id: ar5211_phy.c,v 1.3 2008/11/10 01:19:37 sam Exp $ 18 | */ 19 | #include "opt_ah.h" 20 | 21 | #include "ah.h" 22 | #include "ah_internal.h" 23 | 24 | #include "ar5211/ar5211.h" 25 | 26 | /* shorthands to compact tables for readability */ 27 | #define OFDM IEEE80211_T_OFDM 28 | #define CCK IEEE80211_T_CCK 29 | #define TURBO IEEE80211_T_TURBO 30 | 31 | HAL_RATE_TABLE ar5211_11a_table = { 32 | 8, /* number of rates */ 33 | { 0 }, 34 | { 35 | /* short ctrl */ 36 | /* valid rateCode Preamble dot11Rate Rate */ 37 | /* 6 Mb */ { AH_TRUE, OFDM, 6000, 0x0b, 0x00, (0x80|12), 0 }, 38 | /* 9 Mb */ { AH_TRUE, OFDM, 9000, 0x0f, 0x00, 18, 0 }, 39 | /* 12 Mb */ { AH_TRUE, OFDM, 12000, 0x0a, 0x00, (0x80|24), 2 }, 40 | /* 18 Mb */ { AH_TRUE, OFDM, 18000, 0x0e, 0x00, 36, 2 }, 41 | /* 24 Mb */ { AH_TRUE, OFDM, 24000, 0x09, 0x00, (0x80|48), 4 }, 42 | /* 36 Mb */ { AH_TRUE, OFDM, 36000, 0x0d, 0x00, 72, 4 }, 43 | /* 48 Mb */ { AH_TRUE, OFDM, 48000, 0x08, 0x00, 96, 4 }, 44 | /* 54 Mb */ { AH_TRUE, OFDM, 54000, 0x0c, 0x00, 108, 4 } 45 | }, 46 | }; 47 | 48 | HAL_RATE_TABLE ar5211_turbo_table = { 49 | 8, /* number of rates */ 50 | { 0 }, 51 | { 52 | /* short ctrl */ 53 | /* valid rateCode Preamble dot11Rate Rate */ 54 | /* 6 Mb */ { AH_TRUE, TURBO, 6000, 0x0b, 0x00, (0x80|12), 0 }, 55 | /* 9 Mb */ { AH_TRUE, TURBO, 9000, 0x0f, 0x00, 18, 0 }, 56 | /* 12 Mb */ { AH_TRUE, TURBO, 12000, 0x0a, 0x00, (0x80|24), 2 }, 57 | /* 18 Mb */ { AH_TRUE, TURBO, 18000, 0x0e, 0x00, 36, 2 }, 58 | /* 24 Mb */ { AH_TRUE, TURBO, 24000, 0x09, 0x00, (0x80|48), 4 }, 59 | /* 36 Mb */ { AH_TRUE, TURBO, 36000, 0x0d, 0x00, 72, 4 }, 60 | /* 48 Mb */ { AH_TRUE, TURBO, 48000, 0x08, 0x00, 96, 4 }, 61 | /* 54 Mb */ { AH_TRUE, TURBO, 54000, 0x0c, 0x00, 108, 4 } 62 | }, 63 | }; 64 | 65 | HAL_RATE_TABLE ar5211_11b_table = { 66 | 4, /* number of rates */ 67 | { 0 }, 68 | { 69 | /* short ctrl */ 70 | /* valid rateCode Preamble dot11Rate Rate */ 71 | /* 1 Mb */ { AH_TRUE, CCK, 1000, 0x0b, 0x00, (0x80| 2), 0 }, 72 | /* 2 Mb */ { AH_TRUE, CCK, 2000, 0x0a, 0x04, (0x80| 4), 1 }, 73 | /* 5.5 Mb */ { AH_TRUE, CCK, 5500, 0x09, 0x04, (0x80|11), 1 }, 74 | /* 11 Mb */ { AH_TRUE, CCK, 11000, 0x08, 0x04, (0x80|22), 1 } 75 | }, 76 | }; 77 | 78 | #undef OFDM 79 | #undef CCK 80 | #undef TURBO 81 | 82 | 83 | const HAL_RATE_TABLE * 84 | ar5211GetRateTable(struct ath_hal *ah, u_int mode) 85 | { 86 | HAL_RATE_TABLE *rt; 87 | switch (mode) { 88 | case HAL_MODE_11A: 89 | rt = &ar5211_11a_table; 90 | break; 91 | case HAL_MODE_11B: 92 | rt = &ar5211_11b_table; 93 | break; 94 | case HAL_MODE_TURBO: 95 | rt = &ar5211_turbo_table; 96 | break; 97 | default: 98 | HALDEBUG(ah, HAL_DEBUG_ANY, "%s: invalid mode 0x%x\n", 99 | __func__, mode); 100 | return AH_NULL; 101 | } 102 | ath_hal_setupratetable(ah, rt); 103 | return rt; 104 | } 105 | -------------------------------------------------------------------------------- /ath_hal/ar5211/ar5211_power.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 3 | * Copyright (c) 2002-2006 Atheros Communications, Inc. 4 | * 5 | * Permission to use, copy, modify, and/or distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | * 17 | * $Id: ar5211_power.c,v 1.4 2008/11/10 04:08:02 sam Exp $ 18 | */ 19 | #include "opt_ah.h" 20 | 21 | #include "ah.h" 22 | #include "ah_internal.h" 23 | 24 | #include "ar5211/ar5211.h" 25 | #include "ar5211/ar5211reg.h" 26 | #include "ar5211/ar5211desc.h" 27 | 28 | /* 29 | * Notify Power Mgt is enabled in self-generated frames. 30 | * If requested, force chip awake. 31 | * 32 | * Returns A_OK if chip is awake or successfully forced awake. 33 | * 34 | * WARNING WARNING WARNING 35 | * There is a problem with the chip where sometimes it will not wake up. 36 | */ 37 | static HAL_BOOL 38 | ar5211SetPowerModeAwake(struct ath_hal *ah, int setChip) 39 | { 40 | #define POWER_UP_TIME 2000 41 | uint32_t val; 42 | int i; 43 | 44 | if (setChip) { 45 | OS_REG_RMW_FIELD(ah, AR_SCR, AR_SCR_SLE, AR_SCR_SLE_WAKE); 46 | OS_DELAY(10); /* Give chip the chance to awake */ 47 | 48 | for (i = POWER_UP_TIME / 200; i != 0; i--) { 49 | val = OS_REG_READ(ah, AR_PCICFG); 50 | if ((val & AR_PCICFG_SPWR_DN) == 0) 51 | break; 52 | OS_DELAY(200); 53 | OS_REG_RMW_FIELD(ah, AR_SCR, AR_SCR_SLE, 54 | AR_SCR_SLE_WAKE); 55 | } 56 | if (i == 0) { 57 | #ifdef AH_DEBUG 58 | ath_hal_printf(ah, "%s: Failed to wakeup in %ums\n", 59 | __func__, POWER_UP_TIME/20); 60 | #endif 61 | return AH_FALSE; 62 | } 63 | } 64 | 65 | OS_REG_CLR_BIT(ah, AR_STA_ID1, AR_STA_ID1_PWR_SAV); 66 | return AH_TRUE; 67 | #undef POWER_UP_TIME 68 | } 69 | 70 | /* 71 | * Notify Power Mgt is disabled in self-generated frames. 72 | * If requested, force chip to sleep. 73 | */ 74 | static void 75 | ar5211SetPowerModeSleep(struct ath_hal *ah, int setChip) 76 | { 77 | OS_REG_SET_BIT(ah, AR_STA_ID1, AR_STA_ID1_PWR_SAV); 78 | if (setChip) 79 | OS_REG_RMW_FIELD(ah, AR_SCR, AR_SCR_SLE, AR_SCR_SLE_SLP); 80 | } 81 | 82 | /* 83 | * Notify Power Management is enabled in self-generating 84 | * fames. If request, set power mode of chip to 85 | * auto/normal. Duration in units of 128us (1/8 TU). 86 | */ 87 | static void 88 | ar5211SetPowerModeNetworkSleep(struct ath_hal *ah, int setChip) 89 | { 90 | OS_REG_SET_BIT(ah, AR_STA_ID1, AR_STA_ID1_PWR_SAV); 91 | if (setChip) 92 | OS_REG_RMW_FIELD(ah, AR_SCR, AR_SCR_SLE, AR_SCR_SLE_NORM); 93 | } 94 | 95 | HAL_BOOL 96 | ar5211SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip) 97 | { 98 | struct ath_hal_5211 *ahp = AH5211(ah); 99 | #ifdef AH_DEBUG 100 | static const char* modes[] = { 101 | "AWAKE", 102 | "FULL-SLEEP", 103 | "NETWORK SLEEP", 104 | "UNDEFINED" 105 | }; 106 | #endif 107 | int status = AH_TRUE; 108 | 109 | HALDEBUG(ah, HAL_DEBUG_POWER, "%s: %s -> %s (%s)\n", __func__, 110 | modes[ahp->ah_powerMode], modes[mode], 111 | setChip ? "set chip " : ""); 112 | switch (mode) { 113 | case HAL_PM_AWAKE: 114 | status = ar5211SetPowerModeAwake(ah, setChip); 115 | break; 116 | case HAL_PM_FULL_SLEEP: 117 | ar5211SetPowerModeSleep(ah, setChip); 118 | break; 119 | case HAL_PM_NETWORK_SLEEP: 120 | ar5211SetPowerModeNetworkSleep(ah, setChip); 121 | break; 122 | default: 123 | HALDEBUG(ah, HAL_DEBUG_ANY, "%s: unknown power mode %u\n", 124 | __func__, mode); 125 | return AH_FALSE; 126 | } 127 | ahp->ah_powerMode = mode; 128 | return status; 129 | } 130 | 131 | HAL_POWER_MODE 132 | ar5211GetPowerMode(struct ath_hal *ah) 133 | { 134 | /* Just so happens the h/w maps directly to the abstracted value */ 135 | return MS(OS_REG_READ(ah, AR_SCR), AR_SCR_SLE); 136 | } 137 | -------------------------------------------------------------------------------- /ath_hal/ar5212/ar5212_eeprom.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 3 | * Copyright (c) 2002-2008 Atheros Communications, Inc. 4 | * 5 | * Permission to use, copy, modify, and/or distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | * 17 | * $Id: ar5212_eeprom.c,v 1.6 2008/11/10 04:08:03 sam Exp $ 18 | */ 19 | #include "opt_ah.h" 20 | 21 | #include "ah.h" 22 | #include "ah_internal.h" 23 | #include "ah_devid.h" 24 | #ifdef AH_DEBUG 25 | #include "ah_desc.h" /* NB: for HAL_PHYERR* */ 26 | #endif 27 | 28 | #include "ar5212/ar5212.h" 29 | #include "ar5212/ar5212reg.h" 30 | #include "ar5212/ar5212phy.h" 31 | 32 | /* 33 | * Read 16 bits of data from offset into *data 34 | */ 35 | HAL_BOOL 36 | ar5212EepromRead(struct ath_hal *ah, u_int off, uint16_t *data) 37 | { 38 | OS_REG_WRITE(ah, AR_EEPROM_ADDR, off); 39 | OS_REG_WRITE(ah, AR_EEPROM_CMD, AR_EEPROM_CMD_READ); 40 | 41 | if (!ath_hal_wait(ah, AR_EEPROM_STS, 42 | AR_EEPROM_STS_READ_COMPLETE | AR_EEPROM_STS_READ_ERROR, 43 | AR_EEPROM_STS_READ_COMPLETE)) { 44 | HALDEBUG(ah, HAL_DEBUG_ANY, "%s: read failed for entry 0x%x\n", 45 | __func__, off); 46 | return AH_FALSE; 47 | } 48 | *data = OS_REG_READ(ah, AR_EEPROM_DATA) & 0xffff; 49 | return AH_TRUE; 50 | } 51 | -------------------------------------------------------------------------------- /ath_hal/ar5212/ar5212_gpio.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 3 | * Copyright (c) 2002-2008 Atheros Communications, Inc. 4 | * 5 | * Permission to use, copy, modify, and/or distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | * 17 | * $Id: ar5212_gpio.c,v 1.3 2008/11/10 04:08:03 sam Exp $ 18 | */ 19 | #include "opt_ah.h" 20 | 21 | #include "ah.h" 22 | #include "ah_internal.h" 23 | #include "ah_devid.h" 24 | #ifdef AH_DEBUG 25 | #include "ah_desc.h" /* NB: for HAL_PHYERR* */ 26 | #endif 27 | 28 | #include "ar5212/ar5212.h" 29 | #include "ar5212/ar5212reg.h" 30 | #include "ar5212/ar5212phy.h" 31 | 32 | #define AR_NUM_GPIO 6 /* 6 GPIO pins */ 33 | #define AR_GPIOD_MASK 0x0000002F /* GPIO data reg r/w mask */ 34 | 35 | /* 36 | * Configure GPIO Output lines 37 | */ 38 | HAL_BOOL 39 | ar5212GpioCfgOutput(struct ath_hal *ah, uint32_t gpio) 40 | { 41 | HALASSERT(gpio < AR_NUM_GPIO); 42 | 43 | /* 44 | * NB: AR_GPIOCR_CR_A(pin) is all 1's so there's no need 45 | * to clear the field before or'ing in the new value. 46 | */ 47 | OS_REG_WRITE(ah, AR_GPIOCR, 48 | OS_REG_READ(ah, AR_GPIOCR) | AR_GPIOCR_CR_A(gpio)); 49 | 50 | return AH_TRUE; 51 | } 52 | 53 | /* 54 | * Configure GPIO Input lines 55 | */ 56 | HAL_BOOL 57 | ar5212GpioCfgInput(struct ath_hal *ah, uint32_t gpio) 58 | { 59 | HALASSERT(gpio < AR_NUM_GPIO); 60 | 61 | OS_REG_WRITE(ah, AR_GPIOCR, 62 | (OS_REG_READ(ah, AR_GPIOCR) &~ AR_GPIOCR_CR_A(gpio)) 63 | | AR_GPIOCR_CR_N(gpio)); 64 | 65 | return AH_TRUE; 66 | } 67 | 68 | /* 69 | * Once configured for I/O - set output lines 70 | */ 71 | HAL_BOOL 72 | ar5212GpioSet(struct ath_hal *ah, uint32_t gpio, uint32_t val) 73 | { 74 | uint32_t reg; 75 | 76 | HALASSERT(gpio < AR_NUM_GPIO); 77 | 78 | reg = OS_REG_READ(ah, AR_GPIODO); 79 | reg &= ~(1 << gpio); 80 | reg |= (val&1) << gpio; 81 | 82 | OS_REG_WRITE(ah, AR_GPIODO, reg); 83 | return AH_TRUE; 84 | } 85 | 86 | /* 87 | * Once configured for I/O - get input lines 88 | */ 89 | uint32_t 90 | ar5212GpioGet(struct ath_hal *ah, uint32_t gpio) 91 | { 92 | if (gpio < AR_NUM_GPIO) { 93 | uint32_t val = OS_REG_READ(ah, AR_GPIODI); 94 | val = ((val & AR_GPIOD_MASK) >> gpio) & 0x1; 95 | return val; 96 | } else { 97 | return 0xffffffff; 98 | } 99 | } 100 | 101 | /* 102 | * Set the GPIO Interrupt 103 | */ 104 | void 105 | ar5212GpioSetIntr(struct ath_hal *ah, u_int gpio, uint32_t ilevel) 106 | { 107 | uint32_t val; 108 | 109 | /* XXX bounds check gpio */ 110 | val = OS_REG_READ(ah, AR_GPIOCR); 111 | val &= ~(AR_GPIOCR_CR_A(gpio) | 112 | AR_GPIOCR_INT_MASK | AR_GPIOCR_INT_ENA | AR_GPIOCR_INT_SEL); 113 | val |= AR_GPIOCR_CR_N(gpio) | AR_GPIOCR_INT(gpio) | AR_GPIOCR_INT_ENA; 114 | if (ilevel) 115 | val |= AR_GPIOCR_INT_SELH; /* interrupt on pin high */ 116 | else 117 | val |= AR_GPIOCR_INT_SELL; /* interrupt on pin low */ 118 | 119 | /* Don't need to change anything for low level interrupt. */ 120 | OS_REG_WRITE(ah, AR_GPIOCR, val); 121 | 122 | /* Change the interrupt mask. */ 123 | (void) ar5212SetInterrupts(ah, AH5212(ah)->ah_maskReg | HAL_INT_GPIO); 124 | } 125 | -------------------------------------------------------------------------------- /ath_hal/ar5212/ar5311reg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 3 | * Copyright (c) 2002-2008 Atheros Communications, Inc. 4 | * 5 | * Permission to use, copy, modify, and/or distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | * 17 | * $Id: ar5311reg.h,v 1.3 2008/10/06 18:32:50 sam Exp $ 18 | */ 19 | #ifndef _DEV_ATH_AR5311REG_H_ 20 | #define _DEV_ATH_AR5311REG_H_ 21 | 22 | /* 23 | * Definitions for the Atheros 5311 chipset. 24 | */ 25 | #define AR5311_QDCLKGATE 0x005c /* MAC QCU/DCU clock gating control */ 26 | #define AR5311_QDCLKGATE_QCU_M 0x0000FFFF /* QCU clock disable */ 27 | #define AR5311_QDCLKGATE_DCU_M 0x07FF0000 /* DCU clock disable */ 28 | 29 | #define AR5311_RXCFG_DEF_RX_ANTENNA 0x00000008 /* Default Receive Antenna */ 30 | 31 | /* 32 | * NOTE: MAC_5211/MAC_5311 difference 33 | * On Oahu the TX latency field has increased from 6 bits to 9 bits. 34 | * The RX latency field is unchanged but is shifted over 3 bits. 35 | */ 36 | #define AR5311_USEC_TX_LAT_M 0x000FC000 /* tx latency (usec) */ 37 | #define AR5311_USEC_TX_LAT_S 14 38 | #define AR5311_USEC_RX_LAT_M 0x03F00000 /* rx latency (usec) */ 39 | #define AR5311_USEC_RX_LAT_S 20 40 | 41 | /* 42 | * NOTE: MAC_5211/MAC_5311 difference 43 | * On Maui2/Spirit the frame sequence number is controlled per DCU. 44 | * On Oahu the frame sequence number is global across all DCUs and 45 | * is controlled 46 | */ 47 | #define AR5311_D_MISC_SEQ_NUM_CONTROL 0x01000000 /* seq num local or global */ 48 | #define AR5311_DIAG_USE_ECO 0x00000400 /* "super secret" enable ECO */ 49 | 50 | #endif /* _DEV_ATH_AR5311REG_H_ */ 51 | -------------------------------------------------------------------------------- /ath_hal/ar5312/ar5312.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 3 | * Copyright (c) 2002-2008 Atheros Communications, Inc. 4 | * 5 | * Permission to use, copy, modify, and/or distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | * 17 | * $FreeBSD$ 18 | */ 19 | #ifndef _ATH_AR5312_H_ 20 | #define _ATH_AR5312_H_ 21 | 22 | #include "ah_soc.h" 23 | #include "ar5212/ar5212.h" 24 | 25 | #define AR5312_UNIT(_ah) \ 26 | (((const struct ar531x_config *)((_ah)->ah_st))->unit) 27 | #define AR5312_BOARDCONFIG(_ah) \ 28 | (((const struct ar531x_config *)((_ah)->ah_st))->board) 29 | #define AR5312_RADIOCONFIG(_ah) \ 30 | (((const struct ar531x_config *)((_ah)->ah_st))->radio) 31 | 32 | #define IS_5312_2_X(ah) \ 33 | (AH_PRIVATE(ah)->ah_macVersion == AR_SREV_VERSION_VENICE && \ 34 | (AH_PRIVATE(ah)->ah_macRev == 2 || AH_PRIVATE(ah)->ah_macRev == 7)) 35 | #define IS_5315(ah) \ 36 | (AH_PRIVATE(ah)->ah_devid == AR5212_AR2315_REV6 || \ 37 | AH_PRIVATE(ah)->ah_devid == AR5212_AR2315_REV7 || \ 38 | AH_PRIVATE(ah)->ah_devid == AR5212_AR2317_REV1 || \ 39 | AH_PRIVATE(ah)->ah_devid == AR5212_AR2317_REV2) 40 | 41 | extern HAL_BOOL ar5312IsInterruptPending(struct ath_hal *ah); 42 | 43 | /* AR5312 */ 44 | extern HAL_BOOL ar5312GpioCfgOutput(struct ath_hal *, uint32_t gpio); 45 | extern HAL_BOOL ar5312GpioCfgInput(struct ath_hal *, uint32_t gpio); 46 | extern HAL_BOOL ar5312GpioSet(struct ath_hal *, uint32_t gpio, uint32_t val); 47 | extern uint32_t ar5312GpioGet(struct ath_hal *ah, uint32_t gpio); 48 | extern void ar5312GpioSetIntr(struct ath_hal *ah, u_int, uint32_t ilevel); 49 | 50 | /* AR2315+ */ 51 | extern HAL_BOOL ar5315GpioCfgOutput(struct ath_hal *, uint32_t gpio); 52 | extern HAL_BOOL ar5315GpioCfgInput(struct ath_hal *, uint32_t gpio); 53 | extern HAL_BOOL ar5315GpioSet(struct ath_hal *, uint32_t gpio, uint32_t val); 54 | extern uint32_t ar5315GpioGet(struct ath_hal *ah, uint32_t gpio); 55 | extern void ar5315GpioSetIntr(struct ath_hal *ah, u_int, uint32_t ilevel); 56 | 57 | extern void ar5312SetLedState(struct ath_hal *ah, HAL_LED_STATE state); 58 | extern HAL_BOOL ar5312DetectCardPresent(struct ath_hal *ah); 59 | extern void ar5312SetupClock(struct ath_hal *ah, HAL_OPMODE opmode); 60 | extern void ar5312RestoreClock(struct ath_hal *ah, HAL_OPMODE opmode); 61 | extern void ar5312DumpState(struct ath_hal *ah); 62 | extern HAL_BOOL ar5312Reset(struct ath_hal *ah, HAL_OPMODE opmode, 63 | HAL_CHANNEL *chan, HAL_BOOL bChannelChange, HAL_STATUS *status); 64 | extern HAL_BOOL ar5312ChipReset(struct ath_hal *ah, HAL_CHANNEL *chan); 65 | extern HAL_BOOL ar5312SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, 66 | int setChip); 67 | extern HAL_BOOL ar5312PhyDisable(struct ath_hal *ah); 68 | extern HAL_BOOL ar5312Disable(struct ath_hal *ah); 69 | extern HAL_BOOL ar5312MacReset(struct ath_hal *ah, unsigned int RCMask); 70 | extern uint32_t ar5312GetPowerMode(struct ath_hal *ah); 71 | extern HAL_BOOL ar5312GetPowerStatus(struct ath_hal *ah); 72 | 73 | /* BSP functions */ 74 | extern HAL_BOOL ar5312EepromRead(struct ath_hal *, u_int off, uint16_t *data); 75 | extern HAL_BOOL ar5312EepromWrite(struct ath_hal *, u_int off, uint16_t data); 76 | 77 | #endif /* _ATH_AR3212_H_ */ 78 | -------------------------------------------------------------------------------- /ath_hal/ar5312/ar5312_eeprom.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 3 | * Copyright (c) 2002-2008 Atheros Communications, Inc. 4 | * 5 | * Permission to use, copy, modify, and/or distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | * 17 | * $Id: ar5312_eeprom.c,v 1.4 2008/11/10 04:08:04 sam Exp $ 18 | */ 19 | #include "opt_ah.h" 20 | 21 | 22 | #ifdef AH_SUPPORT_AR5312 23 | 24 | #include "ah.h" 25 | #include "ah_internal.h" 26 | 27 | #include "ar5312/ar5312.h" 28 | #include "ar5312/ar5312reg.h" 29 | #include "ar5212/ar5212desc.h" 30 | 31 | /* 32 | * Read 16 bits of data from offset into *data 33 | */ 34 | HAL_BOOL 35 | ar5312EepromRead(struct ath_hal *ah, u_int off, uint16_t *dataIn) 36 | { 37 | int i,offset; 38 | const char *eepromAddr = AR5312_RADIOCONFIG(ah); 39 | uint8_t *data; 40 | 41 | data = (uint8_t *) dataIn; 42 | for (i=0,offset=2*off; i<2; i++,offset++) { 43 | data[i] = eepromAddr[offset]; 44 | } 45 | return AH_TRUE; 46 | } 47 | #endif /* AH_SUPPORT_AR5312 */ 48 | -------------------------------------------------------------------------------- /ath_hal/ar5312/ar5312_gpio.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 3 | * Copyright (c) 2002-2008 Atheros Communications, Inc. 4 | * 5 | * Permission to use, copy, modify, and/or distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | * 17 | * $Id: ar5312_gpio.c,v 1.3 2008/11/10 04:08:04 sam Exp $ 18 | */ 19 | #include "opt_ah.h" 20 | 21 | #ifdef AH_SUPPORT_AR5312 22 | 23 | #include "ah.h" 24 | #include "ah_internal.h" 25 | #include "ah_devid.h" 26 | 27 | #include "ar5312/ar5312.h" 28 | #include "ar5312/ar5312reg.h" 29 | #include "ar5312/ar5312phy.h" 30 | 31 | #define AR_NUM_GPIO 6 /* 6 GPIO pins */ 32 | #define AR5312_GPIOD_MASK 0x0000002F /* GPIO data reg r/w mask */ 33 | 34 | /* 35 | * Configure GPIO Output lines 36 | */ 37 | HAL_BOOL 38 | ar5312GpioCfgOutput(struct ath_hal *ah, uint32_t gpio) 39 | { 40 | uint32_t gpioOffset = (AR5312_GPIO_BASE - ((uint32_t) ah->ah_sh)); 41 | 42 | HALASSERT(gpio < AR_NUM_GPIO); 43 | 44 | OS_REG_WRITE(ah, gpioOffset+AR5312_GPIOCR, 45 | (OS_REG_READ(ah, gpioOffset+AR5312_GPIOCR) &~ AR_GPIOCR_CR_A(gpio)) 46 | | AR_GPIOCR_CR_A(gpio)); 47 | 48 | return AH_TRUE; 49 | } 50 | 51 | /* 52 | * Configure GPIO Input lines 53 | */ 54 | HAL_BOOL 55 | ar5312GpioCfgInput(struct ath_hal *ah, uint32_t gpio) 56 | { 57 | uint32_t gpioOffset = (AR5312_GPIO_BASE - ((uint32_t) ah->ah_sh)); 58 | 59 | HALASSERT(gpio < AR_NUM_GPIO); 60 | 61 | OS_REG_WRITE(ah, gpioOffset+AR5312_GPIOCR, 62 | (OS_REG_READ(ah, gpioOffset+AR5312_GPIOCR) &~ AR_GPIOCR_CR_A(gpio)) 63 | | AR_GPIOCR_CR_N(gpio)); 64 | 65 | return AH_TRUE; 66 | } 67 | 68 | /* 69 | * Once configured for I/O - set output lines 70 | */ 71 | HAL_BOOL 72 | ar5312GpioSet(struct ath_hal *ah, uint32_t gpio, uint32_t val) 73 | { 74 | uint32_t reg; 75 | uint32_t gpioOffset = (AR5312_GPIO_BASE - ((uint32_t) ah->ah_sh)); 76 | 77 | HALASSERT(gpio < AR_NUM_GPIO); 78 | 79 | reg = OS_REG_READ(ah, gpioOffset+AR5312_GPIODO); 80 | reg &= ~(1 << gpio); 81 | reg |= (val&1) << gpio; 82 | 83 | OS_REG_WRITE(ah, gpioOffset+AR5312_GPIODO, reg); 84 | return AH_TRUE; 85 | } 86 | 87 | /* 88 | * Once configured for I/O - get input lines 89 | */ 90 | uint32_t 91 | ar5312GpioGet(struct ath_hal *ah, uint32_t gpio) 92 | { 93 | uint32_t gpioOffset = (AR5312_GPIO_BASE - ((uint32_t) ah->ah_sh)); 94 | 95 | if (gpio < AR_NUM_GPIO) { 96 | uint32_t val = OS_REG_READ(ah, gpioOffset+AR5312_GPIODI); 97 | val = ((val & AR5312_GPIOD_MASK) >> gpio) & 0x1; 98 | return val; 99 | } else { 100 | return 0xffffffff; 101 | } 102 | } 103 | 104 | /* 105 | * Set the GPIO Interrupt 106 | */ 107 | void 108 | ar5312GpioSetIntr(struct ath_hal *ah, u_int gpio, uint32_t ilevel) 109 | { 110 | uint32_t val; 111 | uint32_t gpioOffset = (AR5312_GPIO_BASE - ((uint32_t) ah->ah_sh)); 112 | 113 | /* XXX bounds check gpio */ 114 | val = OS_REG_READ(ah, gpioOffset+AR5312_GPIOCR); 115 | val &= ~(AR_GPIOCR_CR_A(gpio) | 116 | AR_GPIOCR_INT_MASK | AR_GPIOCR_INT_ENA | AR_GPIOCR_INT_SEL); 117 | val |= AR_GPIOCR_CR_N(gpio) | AR_GPIOCR_INT(gpio) | AR_GPIOCR_INT_ENA; 118 | if (ilevel) 119 | val |= AR_GPIOCR_INT_SELH; /* interrupt on pin high */ 120 | else 121 | val |= AR_GPIOCR_INT_SELL; /* interrupt on pin low */ 122 | 123 | /* Don't need to change anything for low level interrupt. */ 124 | OS_REG_WRITE(ah, gpioOffset+AR5312_GPIOCR, val); 125 | 126 | /* Change the interrupt mask. */ 127 | (void) ar5212SetInterrupts(ah, AH5212(ah)->ah_maskReg | HAL_INT_GPIO); 128 | } 129 | 130 | 131 | #endif /* AH_SUPPORT_AR5312 */ 132 | -------------------------------------------------------------------------------- /ath_hal/ar5312/ar5312_interrupts.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 3 | * Copyright (c) 2002-2008 Atheros Communications, Inc. 4 | * 5 | * Permission to use, copy, modify, and/or distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | * 17 | * $Id: ar5312_interrupts.c,v 1.2 2008/11/10 01:19:39 sam Exp $ 18 | */ 19 | #include "opt_ah.h" 20 | 21 | #ifdef AH_SUPPORT_AR5312 22 | 23 | #include "ah.h" 24 | #include "ah_internal.h" 25 | 26 | #include "ar5312/ar5312.h" 27 | #include "ar5312/ar5312reg.h" 28 | #include "ar5312/ar5312phy.h" 29 | 30 | 31 | /* 32 | * Checks to see if an interrupt is pending on our NIC 33 | * 34 | * Returns: TRUE if an interrupt is pending 35 | * FALSE if not 36 | */ 37 | HAL_BOOL 38 | ar5312IsInterruptPending(struct ath_hal *ah) 39 | { 40 | /* 41 | * Some platforms trigger our ISR before applying power to 42 | * the card. For the 5312, this is always true. 43 | */ 44 | 45 | return(AH_TRUE); 46 | } 47 | #endif /* AH_SUPPORT_AR5312 */ 48 | -------------------------------------------------------------------------------- /ath_hal/ar5312/ar5312_power.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 3 | * Copyright (c) 2002-2008 Atheros Communications, Inc. 4 | * 5 | * Permission to use, copy, modify, and/or distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | * 17 | * $Id: ar5312_power.c,v 1.4 2008/11/10 04:08:04 sam Exp $ 18 | */ 19 | #include "opt_ah.h" 20 | 21 | #ifdef AH_SUPPORT_AR5312 22 | 23 | #include "ah.h" 24 | #include "ah_internal.h" 25 | 26 | #include "ar5312/ar5312.h" 27 | #include "ar5312/ar5312reg.h" 28 | #include "ar5212/ar5212desc.h" 29 | 30 | /* 31 | * Notify Power Mgt is enabled in self-generated frames. 32 | * If requested, force chip awake. 33 | * 34 | * Returns A_OK if chip is awake or successfully forced awake. 35 | * 36 | * WARNING WARNING WARNING 37 | * There is a problem with the chip where sometimes it will not wake up. 38 | */ 39 | static HAL_BOOL 40 | ar5312SetPowerModeAwake(struct ath_hal *ah, int setChip) 41 | { 42 | /* No need for this at the moment for APs */ 43 | return AH_TRUE; 44 | } 45 | 46 | /* 47 | * Notify Power Mgt is disabled in self-generated frames. 48 | * If requested, force chip to sleep. 49 | */ 50 | static void 51 | ar5312SetPowerModeSleep(struct ath_hal *ah, int setChip) 52 | { 53 | /* No need for this at the moment for APs */ 54 | } 55 | 56 | /* 57 | * Notify Power Management is enabled in self-generating 58 | * fames. If request, set power mode of chip to 59 | * auto/normal. Duration in units of 128us (1/8 TU). 60 | */ 61 | static void 62 | ar5312SetPowerModeNetworkSleep(struct ath_hal *ah, int setChip) 63 | { 64 | /* No need for this at the moment for APs */ 65 | } 66 | 67 | /* 68 | * Set power mgt to the requested mode, and conditionally set 69 | * the chip as well 70 | */ 71 | HAL_BOOL 72 | ar5312SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip) 73 | { 74 | struct ath_hal_5212 *ahp = AH5212(ah); 75 | #ifdef AH_DEBUG 76 | static const char* modes[] = { 77 | "AWAKE", 78 | "FULL-SLEEP", 79 | "NETWORK SLEEP", 80 | "UNDEFINED" 81 | }; 82 | #endif 83 | int status = AH_TRUE; 84 | 85 | HALDEBUG(ah, HAL_DEBUG_POWER, "%s: %s -> %s (%s)\n", __func__, 86 | modes[ahp->ah_powerMode], modes[mode], 87 | setChip ? "set chip " : ""); 88 | switch (mode) { 89 | case HAL_PM_AWAKE: 90 | status = ar5312SetPowerModeAwake(ah, setChip); 91 | break; 92 | case HAL_PM_FULL_SLEEP: 93 | ar5312SetPowerModeSleep(ah, setChip); 94 | break; 95 | case HAL_PM_NETWORK_SLEEP: 96 | ar5312SetPowerModeNetworkSleep(ah, setChip); 97 | break; 98 | default: 99 | HALDEBUG(ah, HAL_DEBUG_POWER, "%s: unknown power mode %u\n", 100 | __func__, mode); 101 | return AH_FALSE; 102 | } 103 | ahp->ah_powerMode = mode; 104 | return status; 105 | } 106 | 107 | /* 108 | * Return the current sleep mode of the chip 109 | */ 110 | uint32_t 111 | ar5312GetPowerMode(struct ath_hal *ah) 112 | { 113 | return HAL_PM_AWAKE; 114 | } 115 | 116 | /* 117 | * Return the current sleep state of the chip 118 | * TRUE = sleeping 119 | */ 120 | HAL_BOOL 121 | ar5312GetPowerStatus(struct ath_hal *ah) 122 | { 123 | return 0; /* Currently, 5312 is never in sleep mode. */ 124 | } 125 | #endif /* AH_SUPPORT_AR5312 */ 126 | -------------------------------------------------------------------------------- /ath_hal/ar5312/ar5312phy.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 3 | * Copyright (c) 2002-2008 Atheros Communications, Inc. 4 | * 5 | * Permission to use, copy, modify, and/or distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | * 17 | * $Id: ar5312phy.h,v 1.3 2008/10/06 18:32:50 sam Exp $ 18 | */ 19 | #ifndef _DEV_ATH_AR5312PHY_H_ 20 | #define _DEV_ATH_AR5312PHY_H_ 21 | 22 | #include "ar5212/ar5212phy.h" 23 | 24 | /* PHY registers */ 25 | 26 | #define AR_PHY_PLL_CTL_44_5312 0x14d6 /* 44 MHz for 11b, 11g */ 27 | #define AR_PHY_PLL_CTL_40_5312 0x14d4 /* 40 MHz for 11a, turbos */ 28 | #define AR_PHY_PLL_CTL_40_5312_HALF 0x15d4 /* 40 MHz for 11a, turbos (Half)*/ 29 | #define AR_PHY_PLL_CTL_40_5312_QUARTER 0x16d4 /* 40 MHz for 11a, turbos (Quarter)*/ 30 | 31 | #endif /* _DEV_ATH_AR5312PHY_H_ */ 32 | -------------------------------------------------------------------------------- /ath_hal/ar5312/ar5315_gpio.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 3 | * Copyright (c) 2002-2008 Atheros Communications, Inc. 4 | * 5 | * Permission to use, copy, modify, and/or distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | * 17 | * $Id: ar5315_gpio.c,v 1.3 2008/11/10 04:08:04 sam Exp $ 18 | */ 19 | #include "opt_ah.h" 20 | 21 | #if (AH_SUPPORT_2316 || AH_SUPPORT_2317) 22 | 23 | #include "ah.h" 24 | #include "ah_internal.h" 25 | #include "ah_devid.h" 26 | 27 | #include "ar5312/ar5312.h" 28 | #include "ar5312/ar5312reg.h" 29 | #include "ar5312/ar5312phy.h" 30 | 31 | #define AR_NUM_GPIO 7 /* 6 GPIO pins */ 32 | #define AR5315_GPIOD_MASK 0x0000007F /* GPIO data reg r/w mask */ 33 | 34 | /* 35 | * Configure GPIO Output lines 36 | */ 37 | HAL_BOOL 38 | ar5315GpioCfgOutput(struct ath_hal *ah, uint32_t gpio) 39 | { 40 | uint32_t gpioOffset = (AR5315_GPIO_BASE - ((uint32_t) ah->ah_sh)); 41 | 42 | HALASSERT(gpio < AR_NUM_GPIO); 43 | 44 | OS_REG_WRITE(ah, gpioOffset+AR5315_GPIODIR, 45 | (OS_REG_READ(ah, gpioOffset+AR5315_GPIODIR) &~ AR5315_GPIODIR_M(gpio)) 46 | | AR5315_GPIODIR_O(gpio)); 47 | 48 | return AH_TRUE; 49 | } 50 | 51 | /* 52 | * Configure GPIO Input lines 53 | */ 54 | HAL_BOOL 55 | ar5315GpioCfgInput(struct ath_hal *ah, uint32_t gpio) 56 | { 57 | uint32_t gpioOffset = (AR5315_GPIO_BASE - ((uint32_t) ah->ah_sh)); 58 | 59 | HALASSERT(gpio < AR_NUM_GPIO); 60 | 61 | OS_REG_WRITE(ah, gpioOffset+AR5315_GPIODIR, 62 | (OS_REG_READ(ah, gpioOffset+AR5315_GPIODIR) &~ AR5315_GPIODIR_M(gpio)) 63 | | AR5315_GPIODIR_I(gpio)); 64 | 65 | return AH_TRUE; 66 | } 67 | 68 | /* 69 | * Once configured for I/O - set output lines 70 | */ 71 | HAL_BOOL 72 | ar5315GpioSet(struct ath_hal *ah, uint32_t gpio, uint32_t val) 73 | { 74 | uint32_t reg; 75 | uint32_t gpioOffset = (AR5315_GPIO_BASE - ((uint32_t) ah->ah_sh)); 76 | 77 | HALASSERT(gpio < AR_NUM_GPIO); 78 | 79 | reg = OS_REG_READ(ah, gpioOffset+AR5315_GPIODO); 80 | reg &= ~(1 << gpio); 81 | reg |= (val&1) << gpio; 82 | 83 | OS_REG_WRITE(ah, gpioOffset+AR5315_GPIODO, reg); 84 | return AH_TRUE; 85 | } 86 | 87 | /* 88 | * Once configured for I/O - get input lines 89 | */ 90 | uint32_t 91 | ar5315GpioGet(struct ath_hal *ah, uint32_t gpio) 92 | { 93 | uint32_t gpioOffset = (AR5315_GPIO_BASE - ((uint32_t) ah->ah_sh)); 94 | 95 | if (gpio < AR_NUM_GPIO) { 96 | uint32_t val = OS_REG_READ(ah, gpioOffset+AR5315_GPIODI); 97 | val = ((val & AR5315_GPIOD_MASK) >> gpio) & 0x1; 98 | return val; 99 | } else { 100 | return 0xffffffff; 101 | } 102 | } 103 | 104 | /* 105 | * Set the GPIO Interrupt 106 | */ 107 | void 108 | ar5315GpioSetIntr(struct ath_hal *ah, u_int gpio, uint32_t ilevel) 109 | { 110 | uint32_t val; 111 | uint32_t gpioOffset = (AR5315_GPIO_BASE - ((uint32_t) ah->ah_sh)); 112 | 113 | /* XXX bounds check gpio */ 114 | val = OS_REG_READ(ah, gpioOffset+AR5315_GPIOINT); 115 | val &= ~(AR5315_GPIOINT_M | AR5315_GPIOINTLVL_M); 116 | val |= gpio << AR5315_GPIOINT_S; 117 | if (ilevel) 118 | val |= 2 << AR5315_GPIOINTLVL_S; /* interrupt on pin high */ 119 | else 120 | val |= 1 << AR5315_GPIOINTLVL_S; /* interrupt on pin low */ 121 | 122 | /* Don't need to change anything for low level interrupt. */ 123 | OS_REG_WRITE(ah, gpioOffset+AR5315_GPIOINT, val); 124 | 125 | /* Change the interrupt mask. */ 126 | (void) ar5212SetInterrupts(ah, AH5212(ah)->ah_maskReg | HAL_INT_GPIO); 127 | } 128 | 129 | 130 | #endif /* AH_SUPPORT_2316 || AH_SUPPORT_2317 */ 131 | -------------------------------------------------------------------------------- /ath_hal/ar5416/ar5416_cal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 3 | * Copyright (c) 2002-2008 Atheros Communications, Inc. 4 | * 5 | * Permission to use, copy, modify, and/or distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | * 17 | * $Id: ar5416_cal.h,v 1.3 2008/11/11 17:43:23 sam Exp $ 18 | */ 19 | #ifndef _ATH_AR5416_CAL_H_ 20 | #define _ATH_AR5416_CAL_H_ 21 | 22 | typedef enum { 23 | ADC_DC_INIT_CAL = 0x1, 24 | ADC_GAIN_CAL = 0x2, 25 | ADC_DC_CAL = 0x4, 26 | IQ_MISMATCH_CAL = 0x8 27 | } HAL_CAL_TYPE; 28 | 29 | /* Calibrate state */ 30 | typedef enum { 31 | CAL_INACTIVE, 32 | CAL_WAITING, 33 | CAL_RUNNING, 34 | CAL_DONE 35 | } HAL_CAL_STATE; 36 | 37 | typedef union { 38 | uint32_t u; 39 | int32_t s; 40 | } HAL_CAL_SAMPLE; 41 | 42 | #define MIN_CAL_SAMPLES 1 43 | #define MAX_CAL_SAMPLES 64 44 | #define INIT_LOG_COUNT 5 45 | #define PER_MIN_LOG_COUNT 2 46 | #define PER_MAX_LOG_COUNT 10 47 | 48 | /* Per Calibration data structure */ 49 | typedef struct per_cal_data { 50 | const char *calName; /* for diagnostics */ 51 | HAL_CAL_TYPE calType; /* Type of calibration */ 52 | uint32_t calNumSamples; /* # SW samples to collect */ 53 | uint32_t calCountMax; /* # HW samples to collect */ 54 | void (*calCollect)(struct ath_hal *); /* Accumulator function */ 55 | /* Post-processing function */ 56 | void (*calPostProc)(struct ath_hal *, uint8_t); 57 | } HAL_PERCAL_DATA; 58 | 59 | /* List structure for calibration data */ 60 | typedef struct cal_list { 61 | struct cal_list *calNext; 62 | HAL_CAL_STATE calState; 63 | const HAL_PERCAL_DATA *calData; 64 | } HAL_CAL_LIST; 65 | 66 | struct ar5416PerCal { 67 | /* 68 | * Periodic calibration state. 69 | */ 70 | HAL_CAL_TYPE suppCals; 71 | HAL_CAL_LIST iqCalData; 72 | HAL_CAL_LIST adcGainCalData; 73 | HAL_CAL_LIST adcDcCalInitData; 74 | HAL_CAL_LIST adcDcCalData; 75 | HAL_CAL_LIST *cal_list; 76 | HAL_CAL_LIST *cal_last; 77 | HAL_CAL_LIST *cal_curr; 78 | #define AR5416_MAX_CHAINS 3 /* XXX dup's eeprom def */ 79 | HAL_CAL_SAMPLE caldata[4][AR5416_MAX_CHAINS]; 80 | int calSamples; 81 | /* 82 | * Noise floor cal histogram support. 83 | * XXX be nice to re-use space in ar5212 84 | */ 85 | #define AR5416_NUM_NF_READINGS 6 /* (3 chains * (ctl + ext) */ 86 | struct ar5212NfCalHist nfCalHist[AR5416_NUM_NF_READINGS]; 87 | }; 88 | 89 | #define INIT_CAL(_perCal) do { \ 90 | (_perCal)->calState = CAL_WAITING; \ 91 | (_perCal)->calNext = AH_NULL; \ 92 | } while (0) 93 | 94 | #define INSERT_CAL(_cal, _perCal) do { \ 95 | if ((_cal)->cal_last == AH_NULL) { \ 96 | (_cal)->cal_list = (_cal)->cal_last = (_perCal); \ 97 | ((_cal)->cal_last)->calNext = (_perCal); \ 98 | } else { \ 99 | ((_cal)->cal_last)->calNext = (_perCal); \ 100 | (_cal)->cal_last = (_perCal); \ 101 | (_perCal)->calNext = (_cal)->cal_list; \ 102 | } \ 103 | } while (0) 104 | 105 | HAL_BOOL ar5416InitCal(struct ath_hal *ah, HAL_CHANNEL *chan); 106 | HAL_BOOL ar5416PerCalibration(struct ath_hal *, HAL_CHANNEL *, 107 | HAL_BOOL *isIQdone); 108 | HAL_BOOL ar5416PerCalibrationN(struct ath_hal *ah, HAL_CHANNEL *chan, 109 | u_int chainMask, HAL_BOOL longCal, HAL_BOOL *isCalDone); 110 | HAL_BOOL ar5416ResetCalValid(struct ath_hal *ah, HAL_CHANNEL *chan); 111 | 112 | void ar5416IQCalCollect(struct ath_hal *ah); 113 | void ar5416IQCalibration(struct ath_hal *ah, uint8_t numChains); 114 | void ar5416AdcGainCalCollect(struct ath_hal *ah); 115 | void ar5416AdcGainCalibration(struct ath_hal *ah, uint8_t numChains); 116 | void ar5416AdcDcCalCollect(struct ath_hal *ah); 117 | void ar5416AdcDcCalibration(struct ath_hal *ah, uint8_t numChains); 118 | void ar5416InitNfHistBuff(struct ar5212NfCalHist *h); 119 | #endif /* _ATH_AR5416_CAL_H_ */ 120 | -------------------------------------------------------------------------------- /ath_hal/ar5416/ar5416_cal_adcdc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 3 | * Copyright (c) 2002-2008 Atheros Communications, Inc. 4 | * 5 | * Permission to use, copy, modify, and/or distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | * 17 | * $Id: ar5416_cal_adcdc.c,v 1.2 2008/11/11 17:43:23 sam Exp $ 18 | */ 19 | #include "opt_ah.h" 20 | 21 | #include "ah.h" 22 | #include "ah_internal.h" 23 | #include "ah_devid.h" 24 | 25 | #include "ar5416/ar5416.h" 26 | #include "ar5416/ar5416reg.h" 27 | #include "ar5416/ar5416phy.h" 28 | 29 | /* Adc DC Offset Cal aliases */ 30 | #define totalAdcDcOffsetIOddPhase(i) caldata[0][i].s 31 | #define totalAdcDcOffsetIEvenPhase(i) caldata[1][i].s 32 | #define totalAdcDcOffsetQOddPhase(i) caldata[2][i].s 33 | #define totalAdcDcOffsetQEvenPhase(i) caldata[3][i].s 34 | 35 | void 36 | ar5416AdcDcCalCollect(struct ath_hal *ah) 37 | { 38 | struct ar5416PerCal *cal = &AH5416(ah)->ah_cal; 39 | int i; 40 | 41 | for (i = 0; i < AR5416_MAX_CHAINS; i++) { 42 | cal->totalAdcDcOffsetIOddPhase(i) += (int32_t) 43 | OS_REG_READ(ah, AR_PHY_CAL_MEAS_0(i)); 44 | cal->totalAdcDcOffsetIEvenPhase(i) += (int32_t) 45 | OS_REG_READ(ah, AR_PHY_CAL_MEAS_1(i)); 46 | cal->totalAdcDcOffsetQOddPhase(i) += (int32_t) 47 | OS_REG_READ(ah, AR_PHY_CAL_MEAS_2(i)); 48 | cal->totalAdcDcOffsetQEvenPhase(i) += (int32_t) 49 | OS_REG_READ(ah, AR_PHY_CAL_MEAS_3(i)); 50 | 51 | HALDEBUG(ah, HAL_DEBUG_PERCAL, 52 | "%d: Chn %d oddi=0x%08x; eveni=0x%08x; oddq=0x%08x; evenq=0x%08x;\n", 53 | cal->calSamples, i, 54 | cal->totalAdcDcOffsetIOddPhase(i), 55 | cal->totalAdcDcOffsetIEvenPhase(i), 56 | cal->totalAdcDcOffsetQOddPhase(i), 57 | cal->totalAdcDcOffsetQEvenPhase(i)); 58 | } 59 | } 60 | 61 | void 62 | ar5416AdcDcCalibration(struct ath_hal *ah, uint8_t numChains) 63 | { 64 | struct ar5416PerCal *cal = &AH5416(ah)->ah_cal; 65 | const HAL_PERCAL_DATA *calData = cal->cal_curr->calData; 66 | uint32_t numSamples; 67 | int i; 68 | 69 | numSamples = (1 << (calData->calCountMax + 5)) * calData->calNumSamples; 70 | for (i = 0; i < numChains; i++) { 71 | uint32_t iOddMeasOffset = cal->totalAdcDcOffsetIOddPhase(i); 72 | uint32_t iEvenMeasOffset = cal->totalAdcDcOffsetIEvenPhase(i); 73 | int32_t qOddMeasOffset = cal->totalAdcDcOffsetQOddPhase(i); 74 | int32_t qEvenMeasOffset = cal->totalAdcDcOffsetQEvenPhase(i); 75 | int32_t qDcMismatch, iDcMismatch; 76 | uint32_t val; 77 | 78 | HALDEBUG(ah, HAL_DEBUG_PERCAL, 79 | "Starting ADC DC Offset Cal for Chain %d\n", i); 80 | 81 | HALDEBUG(ah, HAL_DEBUG_PERCAL, " pwr_meas_odd_i = %d\n", 82 | iOddMeasOffset); 83 | HALDEBUG(ah, HAL_DEBUG_PERCAL, " pwr_meas_even_i = %d\n", 84 | iEvenMeasOffset); 85 | HALDEBUG(ah, HAL_DEBUG_PERCAL, " pwr_meas_odd_q = %d\n", 86 | qOddMeasOffset); 87 | HALDEBUG(ah, HAL_DEBUG_PERCAL, " pwr_meas_even_q = %d\n", 88 | qEvenMeasOffset); 89 | 90 | HALASSERT(numSamples); 91 | 92 | iDcMismatch = (((iEvenMeasOffset - iOddMeasOffset) * 2) / 93 | numSamples) & 0x1ff; 94 | qDcMismatch = (((qOddMeasOffset - qEvenMeasOffset) * 2) / 95 | numSamples) & 0x1ff; 96 | HALDEBUG(ah, HAL_DEBUG_PERCAL, 97 | " dc_offset_mismatch_i = 0x%08x\n", iDcMismatch); 98 | HALDEBUG(ah, HAL_DEBUG_PERCAL, 99 | " dc_offset_mismatch_q = 0x%08x\n", qDcMismatch); 100 | 101 | val = OS_REG_READ(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(i)); 102 | val &= 0xc0000fff; 103 | val |= (qDcMismatch << 12) | (iDcMismatch << 21); 104 | OS_REG_WRITE(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(i), val); 105 | 106 | HALDEBUG(ah, HAL_DEBUG_PERCAL, 107 | "ADC DC Offset Cal done for Chain %d\n", i); 108 | } 109 | OS_REG_SET_BIT(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(0), 110 | AR_PHY_NEW_ADC_DC_OFFSET_CORR_ENABLE); 111 | } 112 | -------------------------------------------------------------------------------- /ath_hal/ar5416/ar5416_cal_adcgain.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 3 | * Copyright (c) 2002-2008 Atheros Communications, Inc. 4 | * 5 | * Permission to use, copy, modify, and/or distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | * 17 | * $Id: ar5416_cal_adcgain.c,v 1.2 2008/11/11 17:43:23 sam Exp $ 18 | */ 19 | #include "opt_ah.h" 20 | 21 | #include "ah.h" 22 | #include "ah_internal.h" 23 | #include "ah_devid.h" 24 | 25 | #include "ar5416/ar5416.h" 26 | #include "ar5416/ar5416reg.h" 27 | #include "ar5416/ar5416phy.h" 28 | 29 | /* Adc Gain Cal aliases */ 30 | #define totalAdcIOddPhase(i) caldata[0][i].u 31 | #define totalAdcIEvenPhase(i) caldata[1][i].u 32 | #define totalAdcQOddPhase(i) caldata[2][i].u 33 | #define totalAdcQEvenPhase(i) caldata[3][i].u 34 | 35 | /* 36 | * Collect data from HW to later perform ADC Gain Calibration 37 | */ 38 | void 39 | ar5416AdcGainCalCollect(struct ath_hal *ah) 40 | { 41 | struct ar5416PerCal *cal = &AH5416(ah)->ah_cal; 42 | int i; 43 | 44 | /* 45 | * Accumulate ADC Gain cal measures for active chains 46 | */ 47 | for (i = 0; i < AR5416_MAX_CHAINS; i++) { 48 | cal->totalAdcIOddPhase(i) += 49 | OS_REG_READ(ah, AR_PHY_CAL_MEAS_0(i)); 50 | cal->totalAdcIEvenPhase(i) += 51 | OS_REG_READ(ah, AR_PHY_CAL_MEAS_1(i)); 52 | cal->totalAdcQOddPhase(i) += 53 | OS_REG_READ(ah, AR_PHY_CAL_MEAS_2(i)); 54 | cal->totalAdcQEvenPhase(i) += 55 | OS_REG_READ(ah, AR_PHY_CAL_MEAS_3(i)); 56 | 57 | HALDEBUG(ah, HAL_DEBUG_PERCAL, 58 | "%d: Chn %d oddi=0x%08x; eveni=0x%08x; oddq=0x%08x; evenq=0x%08x;\n", 59 | cal->calSamples, i, cal->totalAdcIOddPhase(i), 60 | cal->totalAdcIEvenPhase(i), cal->totalAdcQOddPhase(i), 61 | cal->totalAdcQEvenPhase(i)); 62 | } 63 | } 64 | 65 | /* 66 | * Use HW data to do ADC Gain Calibration 67 | */ 68 | void 69 | ar5416AdcGainCalibration(struct ath_hal *ah, uint8_t numChains) 70 | { 71 | struct ar5416PerCal *cal = &AH5416(ah)->ah_cal; 72 | uint32_t i; 73 | 74 | for (i = 0; i < numChains; i++) { 75 | uint32_t iOddMeasOffset = cal->totalAdcIOddPhase(i); 76 | uint32_t iEvenMeasOffset = cal->totalAdcIEvenPhase(i); 77 | uint32_t qOddMeasOffset = cal->totalAdcQOddPhase(i); 78 | uint32_t qEvenMeasOffset = cal->totalAdcQEvenPhase(i); 79 | 80 | HALDEBUG(ah, HAL_DEBUG_PERCAL, 81 | "Start ADC Gain Cal for Chain %d\n", i); 82 | HALDEBUG(ah, HAL_DEBUG_PERCAL, 83 | " pwr_meas_odd_i = 0x%08x\n", iOddMeasOffset); 84 | HALDEBUG(ah, HAL_DEBUG_PERCAL, 85 | " pwr_meas_even_i = 0x%08x\n", iEvenMeasOffset); 86 | HALDEBUG(ah, HAL_DEBUG_PERCAL, 87 | " pwr_meas_odd_q = 0x%08x\n", qOddMeasOffset); 88 | HALDEBUG(ah, HAL_DEBUG_PERCAL, 89 | " pwr_meas_even_q = 0x%08x\n", qEvenMeasOffset); 90 | 91 | if (iOddMeasOffset != 0 && qEvenMeasOffset != 0) { 92 | uint32_t iGainMismatch = 93 | ((iEvenMeasOffset*32)/iOddMeasOffset) & 0x3f; 94 | uint32_t qGainMismatch = 95 | ((qOddMeasOffset*32)/qEvenMeasOffset) & 0x3f; 96 | uint32_t val; 97 | 98 | HALDEBUG(ah, HAL_DEBUG_PERCAL, 99 | " gain_mismatch_i = 0x%08x\n", 100 | iGainMismatch); 101 | HALDEBUG(ah, HAL_DEBUG_PERCAL, 102 | " gain_mismatch_q = 0x%08x\n", 103 | qGainMismatch); 104 | 105 | val = OS_REG_READ(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(i)); 106 | val &= 0xfffff000; 107 | val |= (qGainMismatch) | (iGainMismatch << 6); 108 | OS_REG_WRITE(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(i), val); 109 | 110 | HALDEBUG(ah, HAL_DEBUG_PERCAL, 111 | "ADC Gain Cal done for Chain %d\n", i); 112 | } 113 | } 114 | OS_REG_SET_BIT(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(0), 115 | AR_PHY_NEW_ADC_GAIN_CORR_ENABLE); 116 | } 117 | -------------------------------------------------------------------------------- /ath_hal/ar5416/ar5416_cal_iq.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 3 | * Copyright (c) 2002-2008 Atheros Communications, Inc. 4 | * 5 | * Permission to use, copy, modify, and/or distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | * 17 | * $Id: ar5416_cal_iq.c,v 1.2 2008/11/11 17:43:23 sam Exp $ 18 | */ 19 | #include "opt_ah.h" 20 | 21 | #include "ah.h" 22 | #include "ah_internal.h" 23 | #include "ah_devid.h" 24 | 25 | #include "ar5416/ar5416.h" 26 | #include "ar5416/ar5416reg.h" 27 | #include "ar5416/ar5416phy.h" 28 | 29 | /* IQ Cal aliases */ 30 | #define totalPowerMeasI(i) caldata[0][i].u 31 | #define totalPowerMeasQ(i) caldata[1][i].u 32 | #define totalIqCorrMeas(i) caldata[2][i].s 33 | 34 | /* 35 | * Collect data from HW to later perform IQ Mismatch Calibration 36 | */ 37 | void 38 | ar5416IQCalCollect(struct ath_hal *ah) 39 | { 40 | struct ar5416PerCal *cal = &AH5416(ah)->ah_cal; 41 | int i; 42 | 43 | /* 44 | * Accumulate IQ cal measures for active chains 45 | */ 46 | for (i = 0; i < AR5416_MAX_CHAINS; i++) { 47 | cal->totalPowerMeasI(i) += 48 | OS_REG_READ(ah, AR_PHY_CAL_MEAS_0(i)); 49 | cal->totalPowerMeasQ(i) += 50 | OS_REG_READ(ah, AR_PHY_CAL_MEAS_1(i)); 51 | cal->totalIqCorrMeas(i) += (int32_t) 52 | OS_REG_READ(ah, AR_PHY_CAL_MEAS_2(i)); 53 | HALDEBUG(ah, HAL_DEBUG_PERCAL, 54 | "%d: Chn %d pmi=0x%08x;pmq=0x%08x;iqcm=0x%08x;\n", 55 | cal->calSamples, i, cal->totalPowerMeasI(i), 56 | cal->totalPowerMeasQ(i), cal->totalIqCorrMeas(i)); 57 | } 58 | } 59 | 60 | /* 61 | * Use HW data to do IQ Mismatch Calibration 62 | */ 63 | void 64 | ar5416IQCalibration(struct ath_hal *ah, uint8_t numChains) 65 | { 66 | struct ar5416PerCal *cal = &AH5416(ah)->ah_cal; 67 | int i; 68 | 69 | for (i = 0; i < numChains; i++) { 70 | uint32_t powerMeasI = cal->totalPowerMeasI(i); 71 | uint32_t powerMeasQ = cal->totalPowerMeasQ(i); 72 | uint32_t iqCorrMeas = cal->totalIqCorrMeas(i); 73 | uint32_t qCoffDenom, iCoffDenom; 74 | int iqCorrNeg; 75 | 76 | HALDEBUG(ah, HAL_DEBUG_PERCAL, 77 | "Start IQ Cal and Correction for Chain %d\n", i); 78 | HALDEBUG(ah, HAL_DEBUG_PERCAL, 79 | "Orignal: iq_corr_meas = 0x%08x\n", iqCorrMeas); 80 | 81 | iqCorrNeg = 0; 82 | /* iqCorrMeas is always negative. */ 83 | if (iqCorrMeas > 0x80000000) { 84 | iqCorrMeas = (0xffffffff - iqCorrMeas) + 1; 85 | iqCorrNeg = 1; 86 | } 87 | 88 | HALDEBUG(ah, HAL_DEBUG_PERCAL, " pwr_meas_i = 0x%08x\n", 89 | powerMeasI); 90 | HALDEBUG(ah, HAL_DEBUG_PERCAL, " pwr_meas_q = 0x%08x\n", 91 | powerMeasQ); 92 | HALDEBUG(ah, HAL_DEBUG_PERCAL, " iqCorrNeg is 0x%08x\n", 93 | iqCorrNeg); 94 | 95 | iCoffDenom = (powerMeasI/2 + powerMeasQ/2)/ 128; 96 | qCoffDenom = powerMeasQ / 64; 97 | /* Protect against divide-by-0 */ 98 | if (powerMeasQ != 0) { 99 | /* IQ corr_meas is already negated if iqcorr_neg == 1 */ 100 | int32_t iCoff = iqCorrMeas/iCoffDenom; 101 | int32_t qCoff = powerMeasI/qCoffDenom - 64; 102 | 103 | HALDEBUG(ah, HAL_DEBUG_PERCAL, " iCoff = 0x%08x\n", 104 | iCoff); 105 | HALDEBUG(ah, HAL_DEBUG_PERCAL, " qCoff = 0x%08x\n", 106 | qCoff); 107 | 108 | /* Negate iCoff if iqCorrNeg == 0 */ 109 | iCoff = iCoff & 0x3f; 110 | HALDEBUG(ah, HAL_DEBUG_PERCAL, 111 | "New: iCoff = 0x%08x\n", iCoff); 112 | 113 | if (iqCorrNeg == 0x0) 114 | iCoff = 0x40 - iCoff; 115 | if (qCoff > 15) 116 | qCoff = 15; 117 | else if (qCoff <= -16) 118 | qCoff = 16; 119 | HALDEBUG(ah, HAL_DEBUG_PERCAL, 120 | " : iCoff = 0x%x qCoff = 0x%x\n", iCoff, qCoff); 121 | 122 | OS_REG_RMW_FIELD(ah, AR_PHY_TIMING_CTRL4_CHAIN(i), 123 | AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF, iCoff); 124 | OS_REG_RMW_FIELD(ah, AR_PHY_TIMING_CTRL4_CHAIN(i), 125 | AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF, qCoff); 126 | HALDEBUG(ah, HAL_DEBUG_PERCAL, 127 | "IQ Cal and Correction done for Chain %d\n", i); 128 | } 129 | } 130 | OS_REG_SET_BIT(ah, AR_PHY_TIMING_CTRL4, 131 | AR_PHY_TIMING_CTRL4_IQCORR_ENABLE); 132 | } 133 | -------------------------------------------------------------------------------- /ath_hal/ar5416/ar5416_eeprom.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 3 | * Copyright (c) 2002-2008 Atheros Communications, Inc. 4 | * 5 | * Permission to use, copy, modify, and/or distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | * 17 | * $Id: ar5416_eeprom.c,v 1.6 2008/11/10 04:08:04 sam Exp $ 18 | */ 19 | #include "opt_ah.h" 20 | 21 | #include "ah.h" 22 | #include "ah_internal.h" 23 | #include "ah_devid.h" 24 | 25 | #include "ah_eeprom_v14.h" 26 | 27 | #include "ar5416/ar5416.h" 28 | #include "ar5416/ar5416reg.h" 29 | #include "ar5416/ar5416phy.h" 30 | 31 | /* 32 | * Read 16 bits of data from offset into *data 33 | */ 34 | HAL_BOOL 35 | ar5416EepromRead(struct ath_hal *ah, u_int off, uint16_t *data) 36 | { 37 | OS_REG_READ(ah, AR5416_EEPROM_OFFSET + (off << AR5416_EEPROM_S)); 38 | if (!ath_hal_wait(ah, AR_EEPROM_STATUS_DATA, 39 | AR_EEPROM_STATUS_DATA_BUSY | AR_EEPROM_STATUS_DATA_PROT_ACCESS, 0)) 40 | return AH_FALSE; 41 | *data = MS(OS_REG_READ(ah, AR_EEPROM_STATUS_DATA), 42 | AR_EEPROM_STATUS_DATA_VAL); 43 | return AH_TRUE; 44 | } 45 | -------------------------------------------------------------------------------- /ath_hal/ar5416/ar5416_gpio.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 3 | * Copyright (c) 2002-2008 Atheros Communications, Inc. 4 | * 5 | * Permission to use, copy, modify, and/or distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | * 17 | * $Id: ar5416_gpio.c,v 1.3 2008/11/10 04:08:04 sam Exp $ 18 | */ 19 | #include "opt_ah.h" 20 | 21 | #include "ah.h" 22 | #include "ah_internal.h" 23 | #include "ah_devid.h" 24 | #ifdef AH_DEBUG 25 | #include "ah_desc.h" /* NB: for HAL_PHYERR* */ 26 | #endif 27 | 28 | #include "ar5416/ar5416.h" 29 | #include "ar5416/ar5416reg.h" 30 | #include "ar5416/ar5416phy.h" 31 | 32 | #define AR_NUM_GPIO 6 /* 6 GPIO pins */ 33 | #define AR_GPIO_BIT(_gpio) (1 << _gpio) 34 | 35 | /* 36 | * Configure GPIO Output lines 37 | */ 38 | HAL_BOOL 39 | ar5416GpioCfgOutput(struct ath_hal *ah, uint32_t gpio) 40 | { 41 | HALASSERT(gpio < AR_NUM_GPIO); 42 | OS_REG_CLR_BIT(ah, AR_GPIO_INTR_OUT, AR_GPIO_BIT(gpio)); 43 | return AH_TRUE; 44 | } 45 | 46 | /* 47 | * Configure GPIO Input lines 48 | */ 49 | HAL_BOOL 50 | ar5416GpioCfgInput(struct ath_hal *ah, uint32_t gpio) 51 | { 52 | HALASSERT(gpio < AR_NUM_GPIO); 53 | OS_REG_SET_BIT(ah, AR_GPIO_INTR_OUT, AR_GPIO_BIT(gpio)); 54 | return AH_TRUE; 55 | } 56 | 57 | /* 58 | * Once configured for I/O - set output lines 59 | */ 60 | HAL_BOOL 61 | ar5416GpioSet(struct ath_hal *ah, uint32_t gpio, uint32_t val) 62 | { 63 | uint32_t reg; 64 | 65 | HALASSERT(gpio < AR_NUM_GPIO); 66 | reg = MS(OS_REG_READ(ah, AR_GPIO_INTR_OUT), AR_GPIO_OUT_VAL); 67 | if (val & 1) 68 | reg |= AR_GPIO_BIT(gpio); 69 | else 70 | reg &= ~AR_GPIO_BIT(gpio); 71 | 72 | OS_REG_RMW_FIELD(ah, AR_GPIO_INTR_OUT, AR_GPIO_OUT_VAL, reg); 73 | return AH_TRUE; 74 | } 75 | 76 | /* 77 | * Once configured for I/O - get input lines 78 | */ 79 | uint32_t 80 | ar5416GpioGet(struct ath_hal *ah, uint32_t gpio) 81 | { 82 | if (gpio >= AR_NUM_GPIO) 83 | return 0xffffffff; 84 | return ((OS_REG_READ(ah, AR_GPIO_IN) & AR_GPIO_BIT(gpio)) >> gpio); 85 | } 86 | 87 | /* 88 | * Set the GPIO Interrupt 89 | */ 90 | void 91 | ar5416GpioSetIntr(struct ath_hal *ah, u_int gpio, uint32_t ilevel) 92 | { 93 | uint32_t val; 94 | 95 | HALASSERT(gpio < AR_NUM_GPIO); 96 | /* XXX bounds check gpio */ 97 | val = MS(OS_REG_READ(ah, AR_GPIO_INTR_OUT), AR_GPIO_INTR_CTRL); 98 | if (ilevel) /* 0 == interrupt on pin high */ 99 | val &= ~AR_GPIO_BIT(gpio); 100 | else /* 1 == interrupt on pin low */ 101 | val |= AR_GPIO_BIT(gpio); 102 | OS_REG_RMW_FIELD(ah, AR_GPIO_INTR_OUT, AR_GPIO_INTR_CTRL, val); 103 | 104 | /* Change the interrupt mask. */ 105 | val = MS(OS_REG_READ(ah, AR_INTR_ASYNC_ENABLE), AR_INTR_GPIO); 106 | val |= AR_GPIO_BIT(gpio); 107 | OS_REG_RMW_FIELD(ah, AR_INTR_ASYNC_ENABLE, AR_INTR_GPIO, val); 108 | 109 | val = MS(OS_REG_READ(ah, AR_INTR_ASYNC_MASK), AR_INTR_GPIO); 110 | val |= AR_GPIO_BIT(gpio); 111 | OS_REG_RMW_FIELD(ah, AR_INTR_ASYNC_MASK, AR_INTR_GPIO, val); 112 | } 113 | -------------------------------------------------------------------------------- /ath_hal/ar5416/ar5416_keycache.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 3 | * Copyright (c) 2002-2008 Atheros Communications, Inc. 4 | * 5 | * Permission to use, copy, modify, and/or distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | * 17 | * $Id: ar5416_keycache.c,v 1.3 2008/11/10 04:08:04 sam Exp $ 18 | */ 19 | #include "opt_ah.h" 20 | 21 | #include "ah.h" 22 | #include "ah_internal.h" 23 | 24 | #include "ar5416/ar5416.h" 25 | 26 | static const int keyType[] = { 27 | 1, /* HAL_CIPHER_WEP */ 28 | 0, /* HAL_CIPHER_AES_OCB */ 29 | 2, /* HAL_CIPHER_AES_CCM */ 30 | 0, /* HAL_CIPHER_CKIP */ 31 | 3, /* HAL_CIPHER_TKIP */ 32 | 0, /* HAL_CIPHER_CLR */ 33 | }; 34 | 35 | /* 36 | * Clear the specified key cache entry and any associated MIC entry. 37 | */ 38 | HAL_BOOL 39 | ar5416ResetKeyCacheEntry(struct ath_hal *ah, uint16_t entry) 40 | { 41 | struct ath_hal_5416 *ahp = AH5416(ah); 42 | 43 | if (ar5212ResetKeyCacheEntry(ah, entry)) { 44 | ahp->ah_keytype[entry] = keyType[HAL_CIPHER_CLR]; 45 | return AH_TRUE; 46 | } else 47 | return AH_FALSE; 48 | } 49 | 50 | /* 51 | * Sets the contents of the specified key cache entry 52 | * and any associated MIC entry. 53 | */ 54 | HAL_BOOL 55 | ar5416SetKeyCacheEntry(struct ath_hal *ah, uint16_t entry, 56 | const HAL_KEYVAL *k, const uint8_t *mac, 57 | int xorKey) 58 | { 59 | struct ath_hal_5416 *ahp = AH5416(ah); 60 | 61 | if (ar5212SetKeyCacheEntry(ah, entry, k, mac, xorKey)) { 62 | ahp->ah_keytype[entry] = keyType[k->kv_type]; 63 | return AH_TRUE; 64 | } else 65 | return AH_FALSE; 66 | } 67 | -------------------------------------------------------------------------------- /ath_hal/ar5416/ar9280.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008-2009 Sam Leffler, Errno Consulting 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | * 16 | * $FreeBSD$ 17 | */ 18 | #ifndef _ATH_AR9280_H_ 19 | #define _ATH_AR9280_H_ 20 | 21 | #include "ar5416/ar5416.h" 22 | 23 | struct ath_hal_9280 { 24 | struct ath_hal_5416 ah_5416; 25 | 26 | HAL_INI_ARRAY ah_ini_xmodes; 27 | HAL_INI_ARRAY ah_ini_rxgain; 28 | HAL_INI_ARRAY ah_ini_txgain; 29 | }; 30 | #define AH9280(_ah) ((struct ath_hal_9280 *)(_ah)) 31 | 32 | #define AR9280_DEFAULT_RXCHAINMASK 3 33 | #define AR9280_DEFAULT_TXCHAINMASK 1 34 | 35 | HAL_BOOL ar9280RfAttach(struct ath_hal *, HAL_STATUS *); 36 | 37 | struct ath_hal; 38 | 39 | HAL_BOOL ar9280SetAntennaSwitch(struct ath_hal *, HAL_ANT_SETTING); 40 | #endif /* _ATH_AR9280_H_ */ 41 | -------------------------------------------------------------------------------- /ath_hal/opt_ah.h: -------------------------------------------------------------------------------- 1 | #define AH_SUPPORT_11D 1 2 | #define AH_SUPPORT_2316 1 3 | #define AH_SUPPORT_2317 1 4 | #define AH_SUPPORT_5311 1 5 | #define AH_SUPPORT_AR5312 1 6 | #define AH_SUPPORT_AR5416 1 7 | #define AH_SUPPORT_AR9280 1 8 | /* #define AH_SUPPORT_WRITE_EEPROM 1 */ 9 | /* #define AH_SUPPORT_WRITE_REGDOMAIN 1 */ 10 | -------------------------------------------------------------------------------- /ath_rate/Makefile: -------------------------------------------------------------------------------- 1 | obj := $(firstword $(obj) $(SUBDIRS) .) 2 | TOP = $(obj)/.. 3 | 4 | obj-y := amrr/ onoe/ sample/ minstrel/ 5 | 6 | include $(TOP)/Makefile.inc 7 | 8 | .PHONY: modules 9 | modules: 10 | $(MAKE) -C $(KERNELPATH) SUBDIRS=$(shell pwd) modules 11 | 12 | .PHONY: install 13 | install: 14 | for i in $(obj-y); do \ 15 | $(MAKE) -C $$i install || exit 1; \ 16 | done 17 | 18 | .PHONY: clean 19 | clean: 20 | for i in $(obj-y); do \ 21 | $(MAKE) -C $$i clean; \ 22 | done 23 | 24 | rm -f modules.order 25 | -------------------------------------------------------------------------------- /ath_rate/amrr/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Sam Leffler, Errno Consulting 3 | # Copyright (c) 2004 Video54 Technologies, Inc. 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions 8 | # are met: 9 | # 1. Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer, 11 | # without modification. 12 | # 2. Redistributions in binary form must reproduce at minimum a disclaimer 13 | # similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any 14 | # redistribution must be conditioned upon including a substantially 15 | # similar Disclaimer requirement for further binary redistribution. 16 | # 3. Neither the names of the above-listed copyright holders nor the names 17 | # of any contributors may be used to endorse or promote products derived 18 | # from this software without specific prior written permission. 19 | # 20 | # Alternatively, this software may be distributed under the terms of the 21 | # GNU General Public License ("GPL") version 2 as published by the Free 22 | # Software Foundation. 23 | # 24 | # NO WARRANTY 25 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | # LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY 28 | # AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 29 | # THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, 30 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 33 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 35 | # THE POSSIBILITY OF SUCH DAMAGES. 36 | # 37 | # $Id: //depot/sw/linuxsrc/src/802_11/madwifi/madwifi/ath_rate/amrr/Makefile#2 $ 38 | # 39 | 40 | # 41 | # Makefile for the Atheros Rate Control Support. 42 | # 43 | obj := $(firstword $(obj) $(SUBDIRS) .) 44 | TOP = $(obj)/../.. 45 | 46 | obj-m += ath_rate_amrr.o 47 | ath_rate_amrr-objs := amrr.o 48 | 49 | include $(TOP)/Makefile.inc 50 | 51 | INCS += -I$(TOP) -I$(ATH) -I$(HAL) 52 | 53 | EXTRA_CFLAGS+= $(INCS) $(COPTS) 54 | 55 | -include $(TOPDIR)/Rules.make 56 | 57 | .PHONY: all 58 | all: 59 | $(MAKE) -C $(KERNELPATH) SUBDIRS=$(shell pwd) modules 60 | 61 | .PHONY: install 62 | install: 63 | test -d $(DESTDIR)/$(KMODPATH) || mkdir -p $(DESTDIR)/$(KMODPATH) 64 | install -m 0644 ath_rate_amrr.$(KMODSUF) $(DESTDIR)/$(KMODPATH) 65 | 66 | .PHONY: clean 67 | clean: 68 | -rm -f *~ *.o *.ko *.mod.c 69 | -rm -f modules.order .depend .version .*.o.flags .*.o.d .*.o.cmd .*.ko.cmd 70 | -rm -rf .tmp_versions 71 | 72 | ath_rate_amrr.o: $(ath_rate_amrr-objs) 73 | $(LD) $(LDOPTS) -o ath_rate_amrr.$(KMODSUF) -r $(ath_rate_amrr-objs) 74 | -------------------------------------------------------------------------------- /ath_rate/amrr/Makefile.kernel: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for AMRR (Adaptive Multi Rate Retry) control algorithm. 3 | # 4 | # $Id: //depot/sw/linuxsrc/src/802_11/madwifi/madwifi/ath_rate/amrr/Makefile.kernel#1 $ 5 | # 6 | 7 | src ?= . 8 | srctree ?= . 9 | 10 | TOP = $(srctree)/$(src)/../.. 11 | 12 | include $(TOP)/BuildCaps.inc 13 | 14 | ATH= $(TOP)/ath 15 | COMPAT= $(TOP)/include 16 | HAL= $(TOP)/ath_hal 17 | 18 | INCS = -include $(COMPAT)/compat.h -I$(COMPAT) 19 | INCS += -I$(TOP) -I$(ATH) -I$(HAL) 20 | EXTRA_CFLAGS += $(INCS) $(COPTS) 21 | 22 | obj-$(CONFIG_ATHEROS) += ath_rate_amrr.o 23 | ath_rate_amrr-objs := amrr.o 24 | -------------------------------------------------------------------------------- /ath_rate/amrr/amrr.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2004 INRIA 3 | * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer, 11 | without modification. 12 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer 13 | * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any 14 | * redistribution must be conditioned upon including a substantially 15 | * similar Disclaimer requirement for further binary redistribution. 16 | * 3. Neither the names of the above-listed copyright holders nor the names 17 | * of any contributors may be used to endorse or promote products derived 18 | * from this software without specific prior written permission. 19 | * 20 | * Alternatively, this software may be distributed under the terms of the 21 | * GNU General Public License ("GPL") version 2 as published by the Free 22 | * Software Foundation. 23 | * 24 | * NO WARRANTY 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY 28 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 29 | * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, 30 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 33 | * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 35 | * THE POSSIBILITY OF SUCH DAMAGES. 36 | * 37 | * $Id$ 38 | */ 39 | 40 | #ifndef _DEV_ATH_RATE_AMRR_H 41 | #define _DEV_ATH_RATE_AMRR_H 42 | 43 | /* per-device state */ 44 | struct amrr_softc { 45 | struct ath_ratectrl arc; /* base state */ 46 | struct timer_list timer; /* periodic timer */ 47 | }; 48 | 49 | /* per-node state */ 50 | struct amrr_node { 51 | /* AMRR statistics for this node */ 52 | u_int amn_tx_try0_cnt; 53 | u_int amn_tx_try1_cnt; 54 | u_int amn_tx_try2_cnt; 55 | u_int amn_tx_try3_cnt; 56 | u_int amn_tx_failure_cnt; 57 | /* AMRR algorithm state for this node */ 58 | u_int amn_success_threshold; 59 | u_int amn_success; 60 | u_int amn_recovery; 61 | /* rate index et al. */ 62 | u_int8_t amn_tx_rix0; /* series 0 rate index */ 63 | u_int8_t amn_tx_rate0; /* series 0 h/w rate */ 64 | u_int8_t amn_tx_rate1; /* series 1 h/w rate */ 65 | u_int8_t amn_tx_rate2; /* series 2 h/w rate */ 66 | u_int8_t amn_tx_rate3; /* series 3 h/w rate */ 67 | u_int8_t amn_tx_rate0sp; /* series 0 short preamble h/w rate */ 68 | u_int8_t amn_tx_rate1sp; /* series 1 short preamble h/w rate */ 69 | u_int8_t amn_tx_rate2sp; /* series 2 short preamble h/w rate */ 70 | u_int8_t amn_tx_rate3sp; /* series 3 short preamble h/w rate */ 71 | u_int8_t amn_tx_try0; /* series 0 try count */ 72 | u_int amn_tx_try1; /* series 1 try count */ 73 | u_int amn_tx_try2; /* series 2 try count */ 74 | u_int amn_tx_try3; /* series 3 try count */ 75 | }; 76 | #define ATH_NODE_AMRR(an) ((struct amrr_node *)&an[1]) 77 | #endif /* _DEV_ATH_RATE_AMRR_H */ 78 | -------------------------------------------------------------------------------- /ath_rate/minstrel/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Sam Leffler, Errno Consulting 3 | # Copyright (c) 2004 Video54 Technologies, Inc. 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions 8 | # are met: 9 | # 1. Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer, 11 | # without modification. 12 | # 2. Redistributions in binary form must reproduce at minimum a disclaimer 13 | # similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any 14 | # redistribution must be conditioned upon including a substantially 15 | # similar Disclaimer requirement for further binary redistribution. 16 | # 3. Neither the names of the above-listed copyright holders nor the names 17 | # of any contributors may be used to endorse or promote products derived 18 | # from this software without specific prior written permission. 19 | # 20 | # Alternatively, this software may be distributed under the terms of the 21 | # GNU General Public License ("GPL") version 2 as published by the Free 22 | # Software Foundation. 23 | # 24 | # NO WARRANTY 25 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | # LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY 28 | # AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 29 | # THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, 30 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 33 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 35 | # THE POSSIBILITY OF SUCH DAMAGES. 36 | # 37 | 38 | # 39 | # Makefile for the Atheros Rate Control Support. 40 | # 41 | obj := $(firstword $(obj) $(SUBDIRS) .) 42 | TOP = $(obj)/../.. 43 | 44 | obj-m += ath_rate_minstrel.o 45 | ath_rate_minstrel-objs := minstrel.o 46 | 47 | include $(TOP)/Makefile.inc 48 | 49 | INCS += -I$(TOP) -I$(ATH) -I$(HAL) 50 | 51 | EXTRA_CFLAGS+= $(INCS) $(COPTS) 52 | 53 | -include $(TOPDIR)/Rules.make 54 | 55 | .PHONY: all 56 | all: 57 | $(MAKE) -C $(KERNELPATH) SUBDIRS=$(shell pwd) modules 58 | 59 | .PHONY: install 60 | install: 61 | test -d $(DESTDIR)/$(KMODPATH) || mkdir -p $(DESTDIR)/$(KMODPATH) 62 | install -m 0644 ath_rate_minstrel.$(KMODSUF) $(DESTDIR)/$(KMODPATH) 63 | 64 | .PHONY: clean 65 | clean: 66 | -rm -f *~ *.o *.ko *.mod.c 67 | -rm -f modules.order .depend .version .*.o.flags .*.o.d .*.o.cmd .*.ko.cmd 68 | -rm -rf .tmp_versions 69 | 70 | ath_rate_minstrel.o: $(ath_rate_minstrel-objs) 71 | $(LD) $(LDOPTS) -o ath_rate_minstrel.$(KMODSUF) -r $(ath_rate_minstrel-objs) 72 | -------------------------------------------------------------------------------- /ath_rate/minstrel/Makefile.kernel: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for the Minstrel rate control algorithm. 3 | # 4 | # $Id: //depot/sw/linuxsrc/src/802_11/madwifi/madwifi/ath_rate/minstrel/Makefile.kernel#1 $ 5 | # 6 | 7 | src ?= . 8 | srctree ?= . 9 | 10 | TOP = $(srctree)/$(src)/../.. 11 | 12 | include $(TOP)/BuildCaps.inc 13 | 14 | ATH= $(TOP)/ath 15 | COMPAT= $(TOP)/include 16 | HAL= $(TOP)/ath_hal 17 | 18 | INCS = -include $(COMPAT)/compat.h -I$(COMPAT) 19 | INCS += -I$(TOP) -I$(ATH) -I$(HAL) 20 | EXTRA_CFLAGS += $(INCS) $(COPTS) 21 | 22 | obj-$(CONFIG_ATHEROS) += ath_rate_minstrel.o 23 | ath_rate_minstrel-objs := minstrel.o 24 | -------------------------------------------------------------------------------- /ath_rate/onoe/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Sam Leffler, Errno Consulting 3 | # Copyright (c) 2004 Video54 Technologies, Inc. 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions 8 | # are met: 9 | # 1. Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer, 11 | # without modification. 12 | # 2. Redistributions in binary form must reproduce at minimum a disclaimer 13 | # similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any 14 | # redistribution must be conditioned upon including a substantially 15 | # similar Disclaimer requirement for further binary redistribution. 16 | # 3. Neither the names of the above-listed copyright holders nor the names 17 | # of any contributors may be used to endorse or promote products derived 18 | # from this software without specific prior written permission. 19 | # 20 | # Alternatively, this software may be distributed under the terms of the 21 | # GNU General Public License ("GPL") version 2 as published by the Free 22 | # Software Foundation. 23 | # 24 | # NO WARRANTY 25 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | # LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY 28 | # AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 29 | # THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, 30 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 33 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 35 | # THE POSSIBILITY OF SUCH DAMAGES. 36 | # 37 | # $Id: //depot/sw/linuxsrc/src/802_11/madwifi/madwifi/ath_rate/onoe/Makefile $ 38 | # 39 | 40 | # 41 | # Makefile for the Atheros Rate Control Support. 42 | # 43 | obj := $(firstword $(obj) $(SUBDIRS) .) 44 | TOP = $(obj)/../.. 45 | 46 | obj-m += ath_rate_onoe.o 47 | ath_rate_onoe-objs := onoe.o 48 | 49 | include $(TOP)/Makefile.inc 50 | 51 | INCS += -I$(TOP) -I$(ATH) -I$(HAL) 52 | 53 | EXTRA_CFLAGS+= $(INCS) $(COPTS) 54 | 55 | -include $(TOPDIR)/Rules.make 56 | 57 | .PHONY: all 58 | all: 59 | $(MAKE) -C $(KERNELPATH) SUBDIRS=$(shell pwd) modules 60 | 61 | .PHONY: install 62 | install: 63 | test -d $(DESTDIR)/$(KMODPATH) || mkdir -p $(DESTDIR)/$(KMODPATH) 64 | install -m 0644 ath_rate_onoe.$(KMODSUF) $(DESTDIR)/$(KMODPATH) 65 | 66 | .PHONY: clean 67 | clean: 68 | -rm -f *~ *.o *.ko *.mod.c 69 | -rm -f modules.order .depend .version .*.o.flags .*.o.d .*.o.cmd .*.ko.cmd 70 | -rm -rf .tmp_versions 71 | 72 | ath_rate_onoe.o: $(ath_rate_onoe-objs) 73 | $(LD) $(LDOPTS) -o ath_rate_onoe.$(KMODSUF) -r $(ath_rate_onoe-objs) 74 | -------------------------------------------------------------------------------- /ath_rate/onoe/Makefile.kernel: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for Atsushi Onoe's rate control algorithm. 3 | # 4 | # $Id: //depot/sw/linuxsrc/src/802_11/madwifi/madwifi/ath_rate/onoe/Makefile.kernel#1 $ 5 | # 6 | 7 | src ?= . 8 | srctree ?= . 9 | 10 | TOP = $(srctree)/$(src)/../.. 11 | 12 | include $(TOP)/BuildCaps.inc 13 | 14 | ATH= $(TOP)/ath 15 | COMPAT= $(TOP)/include 16 | HAL= $(TOP)/ath_hal 17 | 18 | INCS = -include $(COMPAT)/compat.h -I$(COMPAT) 19 | INCS += -I$(TOP) -I$(ATH) -I$(HAL) 20 | EXTRA_CFLAGS += $(INCS) $(COPTS) 21 | 22 | obj-$(CONFIG_ATHEROS) += ath_rate_onoe.o 23 | ath_rate_onoe-objs := onoe.o 24 | -------------------------------------------------------------------------------- /ath_rate/onoe/onoe.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer, 10 | without modification. 11 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer 12 | * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any 13 | * redistribution must be conditioned upon including a substantially 14 | * similar Disclaimer requirement for further binary redistribution. 15 | * 3. Neither the names of the above-listed copyright holders nor the names 16 | * of any contributors may be used to endorse or promote products derived 17 | * from this software without specific prior written permission. 18 | * 19 | * Alternatively, this software may be distributed under the terms of the 20 | * GNU General Public License ("GPL") version 2 as published by the Free 21 | * Software Foundation. 22 | * 23 | * NO WARRANTY 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 | * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY 27 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 28 | * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, 29 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 32 | * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 34 | * THE POSSIBILITY OF SUCH DAMAGES. 35 | * 36 | * $Id$ 37 | */ 38 | 39 | /* 40 | * Definitions for the Atheros Wireless LAN controller driver. 41 | */ 42 | #ifndef _DEV_ATH_RATE_ONOE_H 43 | #define _DEV_ATH_RATE_ONOE_H 44 | 45 | /* per-device state */ 46 | struct onoe_softc { 47 | struct ath_ratectrl arc; /* base state */ 48 | }; 49 | 50 | /* per-node state */ 51 | struct onoe_node { 52 | u_int on_tx_ok; /* tx ok pkt */ 53 | u_int on_tx_err; /* tx !ok pkt */ 54 | u_int on_tx_retr; /* tx retry count */ 55 | int on_tx_upper; /* tx upper rate req cnt */ 56 | u_int8_t on_tx_rix0; /* series 0 rate index */ 57 | u_int8_t on_tx_try0; /* series 0 try count */ 58 | u_int8_t on_tx_rate0; /* series 0 h/w rate */ 59 | u_int8_t on_tx_rate1; /* series 1 h/w rate */ 60 | u_int8_t on_tx_rate2; /* series 2 h/w rate */ 61 | u_int8_t on_tx_rate3; /* series 3 h/w rate */ 62 | u_int8_t on_tx_rate0sp; /* series 0 short preamble h/w rate */ 63 | u_int8_t on_tx_rate1sp; /* series 1 short preamble h/w rate */ 64 | u_int8_t on_tx_rate2sp; /* series 2 short preamble h/w rate */ 65 | u_int8_t on_tx_rate3sp; /* series 3 short preamble h/w rate */ 66 | unsigned long on_nextcheck; /* time of next check for rate drop */ 67 | }; 68 | #define ATH_NODE_ONOE(an) ((struct onoe_node *)&an[1]) 69 | #endif /* _DEV_ATH_RATE_ONOE_H */ 70 | -------------------------------------------------------------------------------- /ath_rate/sample/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Sam Leffler, Errno Consulting 3 | # Copyright (c) 2004 Video54 Technologies, Inc. 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions 8 | # are met: 9 | # 1. Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer, 11 | # without modification. 12 | # 2. Redistributions in binary form must reproduce at minimum a disclaimer 13 | # similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any 14 | # redistribution must be conditioned upon including a substantially 15 | # similar Disclaimer requirement for further binary redistribution. 16 | # 3. Neither the names of the above-listed copyright holders nor the names 17 | # of any contributors may be used to endorse or promote products derived 18 | # from this software without specific prior written permission. 19 | # 20 | # Alternatively, this software may be distributed under the terms of the 21 | # GNU General Public License ("GPL") version 2 as published by the Free 22 | # Software Foundation. 23 | # 24 | # NO WARRANTY 25 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | # LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY 28 | # AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 29 | # THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, 30 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 33 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 35 | # THE POSSIBILITY OF SUCH DAMAGES. 36 | # 37 | 38 | # 39 | # Makefile for the Atheros Rate Control Support. 40 | # 41 | obj := $(firstword $(obj) $(SUBDIRS) .) 42 | TOP = $(obj)/../.. 43 | 44 | obj-m += ath_rate_sample.o 45 | ath_rate_sample-objs := sample.o 46 | 47 | include $(TOP)/Makefile.inc 48 | 49 | INCS += -I$(TOP) -I$(ATH) -I$(HAL) 50 | 51 | EXTRA_CFLAGS+= $(INCS) $(COPTS) 52 | 53 | -include $(TOPDIR)/Rules.make 54 | 55 | .PHONY: all 56 | all: 57 | $(MAKE) -C $(KERNELPATH) SUBDIRS=$(shell pwd) modules 58 | 59 | .PHONY: install 60 | install: 61 | test -d $(DESTDIR)/$(KMODPATH) || mkdir -p $(DESTDIR)/$(KMODPATH) 62 | install -m 0644 ath_rate_sample.$(KMODSUF) $(DESTDIR)/$(KMODPATH) 63 | 64 | .PHONY: clean 65 | clean: 66 | -rm -f *~ *.o *.ko *.mod.c 67 | -rm -f modules.order .depend .version .*.o.flags .*.o.d .*.o.cmd .*.ko.cmd 68 | -rm -rf .tmp_versions 69 | 70 | ath_rate_sample.o: $(ath_rate_sample-objs) 71 | $(LD) $(LDOPTS) -o ath_rate_sample.$(KMODSUF) -r $(ath_rate_sample-objs) 72 | -------------------------------------------------------------------------------- /ath_rate/sample/Makefile.kernel: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for John Bicket's SampleRate control algorithm. 3 | # 4 | # $Id: //depot/sw/linuxsrc/src/802_11/madwifi/madwifi/ath_rate/sample/Makefile.kernel#1 $ 5 | # 6 | 7 | src ?= . 8 | srctree ?= . 9 | 10 | TOP = $(srctree)/$(src)/../.. 11 | 12 | include $(TOP)/BuildCaps.inc 13 | 14 | ATH= $(TOP)/ath 15 | COMPAT= $(TOP)/include 16 | HAL= $(TOP)/ath_hal 17 | 18 | INCS = -include $(COMPAT)/compat.h -I$(COMPAT) 19 | INCS += -I$(TOP) -I$(ATH) -I$(HAL) 20 | EXTRA_CFLAGS += $(INCS) $(COPTS) 21 | 22 | obj-$(CONFIG_ATHEROS) += ath_rate_sample.o 23 | ath_rate_sample-objs := sample.o 24 | -------------------------------------------------------------------------------- /net80211/Makefile.kernel: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for the 802.11 NET80211 module. 3 | # 4 | 5 | src ?= . 6 | srctree ?= . 7 | 8 | TOP = $(srctree)/$(src)/.. 9 | 10 | include $(TOP)/BuildCaps.inc 11 | 12 | COMPAT = $(TOP)/include 13 | 14 | HAL = $(TOP)/ath_hal 15 | 16 | INCS = -include $(COMPAT)/compat.h -I$(COMPAT) 17 | INCS += -I$(TOP) -I$(HAL) 18 | EXTRA_CFLAGS += $(INCS) $(COPTS) 19 | 20 | # 21 | # There is one authenticator mechanism: an in-kernel implementation 22 | # (wlan_xauth). 23 | # 24 | MOD_AUTH := wlan_xauth.o 25 | # 26 | # Scanning policy is split into modules. The default policy modules 27 | # separate station-mode scanning support from ap-mode scanning support. 28 | # 29 | MOD_SCAN := wlan_scan_sta.o wlan_scan_ap.o 30 | 31 | obj-$(CONFIG_ATHEROS) += wlan.o wlan_wep.o wlan_tkip.o wlan_ccmp.o wlan_acl.o \ 32 | $(MOD_AUTH) $(MOD_SCAN) 33 | 34 | wlan-objs := if_media.o \ 35 | ieee80211.o ieee80211_beacon.o ieee80211_crypto.o \ 36 | ieee80211_crypto_none.o ieee80211_input.o ieee80211_node.o \ 37 | ieee80211_output.o ieee80211_proto.o ieee80211_power.o \ 38 | ieee80211_scan.o ieee80211_wireless.o ieee80211_linux.o \ 39 | ieee80211_monitor.o ieee80211_rate.o ieee80211_skb.o 40 | wlan_wep-objs := ieee80211_crypto_wep.o 41 | wlan_tkip-objs := ieee80211_crypto_tkip.o 42 | wlan_ccmp-objs := ieee80211_crypto_ccmp.o 43 | wlan_xauth-objs := ieee80211_xauth.o 44 | wlan_acl-objs := ieee80211_acl.o 45 | wlan_scan_sta-objs := ieee80211_scan_sta.o 46 | wlan_scan_ap-objs := ieee80211_scan_ap.o 47 | -------------------------------------------------------------------------------- /net80211/ieee80211_power.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2001 Atsushi Onoe 3 | * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * Alternatively, this software may be distributed under the terms of the 18 | * GNU General Public License ("GPL") version 2 as published by the Free 19 | * Software Foundation. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 24 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 26 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | * 32 | * $Id$ 33 | */ 34 | #ifndef _NET80211_IEEE80211_POWER_H_ 35 | #define _NET80211_IEEE80211_POWER_H_ 36 | 37 | struct ieee80211com; 38 | struct ieee80211vap; 39 | 40 | void ieee80211_power_attach(struct ieee80211com *); 41 | void ieee80211_power_detach(struct ieee80211com *); 42 | void ieee80211_power_vattach(struct ieee80211vap *); 43 | void ieee80211_power_latevattach(struct ieee80211vap *); 44 | void ieee80211_power_vdetach(struct ieee80211vap *); 45 | 46 | struct ieee80211_node; 47 | 48 | int ieee80211_node_saveq_drain(struct ieee80211_node *); 49 | int ieee80211_node_saveq_age(struct ieee80211_node *); 50 | int ieee80211_pwrsave(struct sk_buff *); 51 | void ieee80211_node_pwrsave(struct ieee80211_node *, int); 52 | void ieee80211_sta_pwrsave(struct ieee80211vap *, int); 53 | #endif /* _NET80211_IEEE80211_POWER_H_ */ 54 | -------------------------------------------------------------------------------- /net80211/ieee80211_rate.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2007 Pavel Roskin 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 3. The name of the author may not be used to endorse or promote products 13 | * derived from this software without specific prior written permission. 14 | * 15 | * Alternatively, this software may be distributed under the terms of the 16 | * GNU General Public License ("GPL") version 2 as published by the Free 17 | * Software Foundation. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | #ifndef EXPORT_SYMTAB 31 | #define EXPORT_SYMTAB 32 | #endif 33 | 34 | /* 35 | * Atheros module glue for rate control algorithms. 36 | */ 37 | #if !defined(AUTOCONF_INCLUDED) && !defined(CONFIG_LOCALVERSION) 38 | #include 39 | #endif 40 | 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | 48 | static const char *module_names[] = { 49 | [IEEE80211_RATE_AMRR] = "ath_rate_amrr", 50 | [IEEE80211_RATE_MINSTREL] = "ath_rate_minstrel", 51 | [IEEE80211_RATE_ONOE] = "ath_rate_onoe", 52 | [IEEE80211_RATE_SAMPLE] = "ath_rate_sample" 53 | }; 54 | 55 | /* 56 | * Table of registered rate controllers. 57 | */ 58 | static struct ieee80211_rate_ops ratectls[IEEE80211_RATE_MAX]; 59 | 60 | int ieee80211_rate_register(struct ieee80211_rate_ops *ops) 61 | { 62 | int id = ops->ratectl_id; 63 | 64 | if ((0 <= id) && (id < IEEE80211_RATE_MAX)) { 65 | memcpy(&ratectls[id], ops, sizeof(*ops)); 66 | return 0; 67 | } 68 | return -EINVAL; 69 | } 70 | EXPORT_SYMBOL(ieee80211_rate_register); 71 | 72 | void ieee80211_rate_unregister(struct ieee80211_rate_ops *ops) 73 | { 74 | int id = ops->ratectl_id; 75 | 76 | if ((0 <= id) && (id < IEEE80211_RATE_MAX)) 77 | memset(&ratectls[id], 0, sizeof(ratectls[0])); 78 | } 79 | EXPORT_SYMBOL(ieee80211_rate_unregister); 80 | 81 | struct ath_ratectrl *ieee80211_rate_attach(struct ath_softc *sc, 82 | const char *name) 83 | { 84 | int id; 85 | char buf[64]; 86 | struct ath_ratectrl *ctl; 87 | 88 | snprintf(buf, sizeof(buf), "ath_rate_%s", name); 89 | for (id = 0; id < IEEE80211_RATE_MAX; id++) { 90 | if (strcmp(buf, module_names[id]) == 0) 91 | break; 92 | } 93 | 94 | if (id >= IEEE80211_RATE_MAX) { 95 | printk(KERN_ERR "Module \"%s\" is not known\n", buf); 96 | return NULL; 97 | } 98 | 99 | if (!ratectls[id].attach) 100 | ieee80211_load_module(buf); 101 | 102 | if (!ratectls[id].attach) { 103 | printk(KERN_ERR "Error loading module \"%s\"\n", buf); 104 | return NULL; 105 | } 106 | 107 | ctl = ratectls[id].attach(sc); 108 | if (!ctl) { 109 | printk(KERN_ERR "Module \"%s\" failed to initialize\n", buf); 110 | return NULL; 111 | } 112 | 113 | ctl->ops = &ratectls[id]; 114 | return ctl; 115 | } 116 | EXPORT_SYMBOL(ieee80211_rate_attach); 117 | 118 | void ieee80211_rate_detach(struct ath_ratectrl *ctl) { 119 | ctl->ops->detach(ctl); 120 | } 121 | EXPORT_SYMBOL(ieee80211_rate_detach); 122 | -------------------------------------------------------------------------------- /net80211/ieee80211_xauth.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2004 Video54 Technologies, Inc. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * Alternatively, this software may be distributed under the terms of the 17 | * GNU General Public License ("GPL") version 2 as published by the Free 18 | * Software Foundation. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 21 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 23 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 24 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 25 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 29 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | * $Id$ 32 | */ 33 | #ifndef EXPORT_SYMTAB 34 | #define EXPORT_SYMTAB 35 | #endif 36 | 37 | /* 38 | * External authenticator placeholder module. 39 | * 40 | * This support is optional; it is only used when the 802.11 layer's 41 | * authentication mode is set to use 802.1x or WPA is enabled separately 42 | * (for WPA-PSK). If compiled as a module this code does not need 43 | * to be present unless 802.1x/WPA is in use. 44 | * 45 | * The authenticator hooks into the 802.11 layer. At present we use none 46 | * of the available callbacks--the user mode authenticator process works 47 | * entirely from messages about stations joining and leaving. 48 | */ 49 | #if !defined(AUTOCONF_INCLUDED) && !defined(CONFIG_LOCALVERSION) 50 | #include 51 | #endif 52 | #include 53 | #include 54 | #include 55 | #include 56 | #include 57 | #include 58 | #include 59 | #include 60 | 61 | #include "if_media.h" 62 | #include "if_llc.h" 63 | #include "if_ethersubr.h" 64 | 65 | #include 66 | 67 | /* 68 | * Module glue. 69 | */ 70 | MODULE_AUTHOR("Errno Consulting, Sam Leffler"); 71 | MODULE_DESCRIPTION("802.11 wireless support: external (user mode) authenticator"); 72 | #ifdef MODULE_LICENSE 73 | MODULE_LICENSE("Dual BSD/GPL"); 74 | #endif 75 | 76 | /* 77 | * One module handles everything for now. May want 78 | * to split things up for embedded applications. 79 | */ 80 | static const struct ieee80211_authenticator xauth = { 81 | .ia_name = "external", 82 | .ia_attach = NULL, 83 | .ia_detach = NULL, 84 | .ia_node_join = NULL, 85 | .ia_node_leave = NULL, 86 | }; 87 | 88 | static int __init 89 | init_ieee80211_xauth(void) 90 | { 91 | ieee80211_authenticator_register(IEEE80211_AUTH_8021X, &xauth); 92 | ieee80211_authenticator_register(IEEE80211_AUTH_WPA, &xauth); 93 | return 0; 94 | } 95 | module_init(init_ieee80211_xauth); 96 | 97 | static void __exit 98 | exit_ieee80211_xauth(void) 99 | { 100 | ieee80211_authenticator_unregister(IEEE80211_AUTH_8021X); 101 | ieee80211_authenticator_unregister(IEEE80211_AUTH_WPA); 102 | } 103 | module_exit(exit_ieee80211_xauth); 104 | -------------------------------------------------------------------------------- /net80211/if_athproto.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004 Atheros Communications Inc. All rights reserved. 3 | * 4 | * $Id$ 5 | */ 6 | 7 | #ifndef _NET_IF_ATH_PROTO_H_ 8 | #define _NET_IF_ATH_PROTO_H_ 9 | 10 | /* 11 | * Atheros proprietary protocol info. 12 | */ 13 | 14 | /* 15 | * Atheros RSSI, Signal, Noise, etc. 16 | */ 17 | 18 | #define ATH_DEFAULT_NOISE -95 /* dBm */ 19 | 20 | /* 21 | * Atheros proprietary SuperG defines. 22 | */ 23 | 24 | #define ATH_ETH_TYPE 0x88bd 25 | #define ATH_SNAP_ORGCODE_0 0x00 26 | #define ATH_SNAP_ORGCODE_1 0x03 27 | #define ATH_SNAP_ORGCODE_2 0x7f 28 | 29 | struct athl2p_tunnel_hdr { 30 | #if (_BYTE_ORDER == _LITTLE_ENDIAN) 31 | u_int32_t offset:11, 32 | seqNum:11, 33 | optHdrLen32:2, 34 | frameType:2, 35 | proto:6; 36 | #else /* big endian */ 37 | u_int32_t proto:6, 38 | frameType:2, 39 | optHdrLen32:2, 40 | seqNum:11, 41 | offset:11; 42 | #endif 43 | } __packed; 44 | 45 | /* 46 | * The following defines control compiling Atheros-specific features 47 | * (see BuildCaps.inc): 48 | * 49 | * ATH_SUPERG_FF 50 | * set to 1 for fast-frame 51 | */ 52 | 53 | #define ATH_L2TUNNEL_PROTO_FF 0 54 | /* FF max payload: 55 | * 802.2 + FFHDR + HPAD + 802.3 + 802.2 + 1500 + SPAD + 802.3 + 802.2 + 1500: 56 | * 8 + 4 + 4 + 14 + 8 + 1500 + 6 + 14 + 8 + 1500 57 | * = 3066 58 | */ 59 | #define ATH_FF_MAX_HDR_PAD 4 60 | #define ATH_FF_MAX_SEP_PAD 6 61 | #define ATH_FF_MAX_HDR 30 62 | #define ATH_FF_MAX_PAYLOAD 3066 63 | #define ATH_FF_MAX_LEN (ATH_FF_MAX_PAYLOAD + IEEE80211_CRC_LEN + \ 64 | (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN)) 65 | 66 | /* 67 | * Store a magic number in skb->cb[] area to indicate FF within driver. 68 | * Offset of 8B into cb[] is used to preserve vlan tag info. 69 | */ 70 | #define ATH_FF_MAGIC_PUT(_skb) \ 71 | (SKB_CB(_skb)->flags |= M_FF) 72 | #define ATH_FF_MAGIC_CLR(_skb) \ 73 | (SKB_CB(_skb)->flags &= ~M_FF) 74 | #define ATH_FF_MAGIC_PRESENT(_skb) \ 75 | ((SKB_CB(_skb)->flags & M_FF) != 0) 76 | 77 | /* 78 | * default value for the minimum txq depth required for an ath_buf to be 79 | * placed on the FF staging queue. this value should be >=3 due to interaction 80 | * with HW compression. 81 | */ 82 | #define ATH_FF_TXQMIN 3 83 | 84 | /* 85 | * default maximum age an ath_buf is allowed to remain on the staging queue. 86 | * When this number of ath_bufs have been queued on the txq, after an ath_buf 87 | * was placed on the staging queue, that ath_buf on the staging queue will be 88 | * flushed. 89 | */ 90 | #define ATH_FF_STAGEQAGEMAX 5 91 | 92 | /* 93 | * Reserve enough buffer header length to avoid reallocation on fast-frame 94 | * rx and tx. 95 | */ 96 | #define USE_HEADERLEN_RESV 1 97 | 98 | #endif /* _NET_IF_ATH_PROTO_H_ */ 99 | -------------------------------------------------------------------------------- /net80211/if_ethersubr.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer, 10 | * without modification. 11 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer 12 | * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any 13 | * redistribution must be conditioned upon including a substantially 14 | * similar Disclaimer requirement for further binary redistribution. 15 | * 3. Neither the names of the above-listed copyright holders nor the names 16 | * of any contributors may be used to endorse or promote products derived 17 | * from this software without specific prior written permission. 18 | * 19 | * Alternatively, this software may be distributed under the terms of the 20 | * GNU General Public License ("GPL") version 2 as published by the Free 21 | * Software Foundation. 22 | * 23 | * NO WARRANTY 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 | * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY 27 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 28 | * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, 29 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 32 | * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 34 | * THE POSSIBILITY OF SUCH DAMAGES. 35 | * 36 | * $Id$ 37 | */ 38 | 39 | #ifndef _NET_IF_ETHERSUBR_H_ 40 | #define _NET_IF_ETHERSUBR_H_ 41 | 42 | #define ETHER_ADDR_LEN 6 /* length of an Ethernet address */ 43 | #define ETHER_TYPE_LEN 2 /* length of the Ethernet type field */ 44 | #define ETHER_CRC_LEN 4 /* length of the Ethernet CRC */ 45 | #define ETHER_HDR_LEN (ETHER_ADDR_LEN * 2 + ETHER_TYPE_LEN) 46 | #define ETHER_MAX_LEN 1518 47 | 48 | #define ETHERMTU (ETHER_MAX_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN) 49 | 50 | /* 51 | * Structure of a 10Mb/s Ethernet header. 52 | */ 53 | struct ether_header { 54 | u_char ether_dhost[ETHER_ADDR_LEN]; 55 | u_char ether_shost[ETHER_ADDR_LEN]; 56 | __be16 ether_type; 57 | } __packed; 58 | 59 | #ifndef ETHERTYPE_PAE 60 | #define ETHERTYPE_PAE 0x888e /* EAPOL PAE/802.1x */ 61 | #endif 62 | #ifndef ETHERTYPE_IP 63 | #define ETHERTYPE_IP 0x0800 /* IP protocol */ 64 | #endif 65 | 66 | /* 67 | * Structure of a 48-bit Ethernet address. 68 | */ 69 | struct ether_addr { 70 | u_char octet[ETHER_ADDR_LEN]; 71 | } __packed; 72 | 73 | #define ETHER_IS_MULTICAST(addr) (*(addr) & 0x01) /* is address mcast/bcast? */ 74 | 75 | #define VLAN_PRI_SHIFT 13 /* Shift to find VLAN user priority */ 76 | #define VLAN_PRI_MASK 7 /* Mask for user priority bits in VLAN */ 77 | 78 | 79 | #endif /* _NET_IF_ETHERSUBR_H_ */ 80 | -------------------------------------------------------------------------------- /patch-kernel/Config.in: -------------------------------------------------------------------------------- 1 | dep_bool ' Atheros 802.11(a/b/g) PCI/Cardbus support' CONFIG_ATHEROS $CONFIG_PCI $CONFIG_NET_RADIO 2 | if [ "$CONFIG_ATHEROS" = "y" ]; then 3 | 4 | choice ' Atheros: Default Transmission Rate Control Algorithm' \ 5 | "Minstrel CONFIG_ATHEROS_RATE_DEFAULT_MINSTREL \ 6 | Sample CONFIG_ATHEROS_RATE_DEFAULT_SAMPLE \ 7 | Onoe CONFIG_ATHEROS_RATE_DEFAULT_ONOE \ 8 | AMRR CONFIG_ATHEROS_RATE_DEFAULT_AMRR" Sample 9 | 10 | if [ "$CONFIG_ATHEROS_RATE_DEFAULT_AMRR" = "y" ]; then 11 | define_bool CONFIG_ATHEROS_RATE_AMRR y 12 | define_string CONFIG_ATHEROS_RATE_DEFAULT "amrr" 13 | else 14 | dep_bool ' Adaptive Multi-Rate Retry control algorithm' \ 15 | CONFIG_ATHEROS_RATE_AMRR $CONFIG_ATHEROS 16 | fi 17 | 18 | if [ "$CONFIG_ATHEROS_RATE_DEFAULT_ONOE" = "y" ]; then 19 | define_bool CONFIG_ATHEROS_RATE_ONOE y 20 | define_string CONFIG_ATHEROS_RATE_DEFAULT "onoe" 21 | else 22 | dep_bool ' Atsushi Onoe rate control algorithm' \ 23 | CONFIG_ATHEROS_RATE_ONOE $CONFIG_ATHEROS 24 | fi 25 | 26 | if [ "$CONFIG_ATHEROS_RATE_DEFAULT_SAMPLE" = "y" ]; then 27 | define_bool CONFIG_ATHEROS_RATE_SAMPLE y 28 | define_string CONFIG_ATHEROS_RATE_DEFAULT "sample" 29 | else 30 | dep_bool ' Sample Rate control algorithm' \ 31 | CONFIG_ATHEROS_RATE_SAMPLE $CONFIG_ATHEROS 32 | fi 33 | 34 | if [ "$CONFIG_ATHEROS_RATE_DEFAULT_MINSTREL" = "y" ]; then 35 | define_bool CONFIG_ATHEROS_RATE_MINSTREL y 36 | define_string CONFIG_ATHEROS_RATE_DEFAULT "minstrel" 37 | else 38 | dep_bool ' Minstrel Rate control algorithm' \ 39 | CONFIG_ATHEROS_RATE_MINSTREL $CONFIG_ATHEROS 40 | fi 41 | 42 | fi 43 | -------------------------------------------------------------------------------- /patch-kernel/Configure.help.patch: -------------------------------------------------------------------------------- 1 | --- Configure.help.orig Tue Sep 28 12:57:52 2004 2 | +++ Configure.help Tue Sep 28 12:57:58 2004 3 | @@ -6517,6 +6517,38 @@ 4 | kernel: saying N will just cause the configurator to skip all 5 | the questions about amateur radio. 6 | 7 | +Atheros wireless support 8 | +CONFIG_ATHEROS 9 | + Say Y here if you intend to attach an Atheros Cardbus or PCI 10 | + wireless Ethernet networking card to your computer. This driver 11 | + support the standard Linux Wireless Extensions. 12 | + 13 | + You will also very likely also need the Wireless Tools in order to 14 | + configure your card and that /etc/pcmcia/wireless.opts works: 15 | + . 16 | + 17 | + To compile this driver as a module, choose M here: the module will 18 | + be called ath_pci.o If unsure, say N. 19 | + 20 | +Rate control algorithm 21 | +CONFIG_ATHEROS_RATE_SAMPLE 22 | + Rate control algorithms determine how the transmission rate is 23 | + selected based on the quality of the connection. 24 | + 25 | + SampleRate chooses the bitrate it predicts will provide the most 26 | + throughput based on estimates of the expected per-packet transmission 27 | + time for each bitrate. SampleRate periodically sends packets at 28 | + bitrates other than the current one to estimate when another bitrate 29 | + will provide better performance. SampleRate switches to another 30 | + bitrate when its estimated per-packet transmission time becomes 31 | + smaller than the current bitrate's. SampleRate reduces the number of 32 | + bitrates it must sample by eliminating those that could not perform 33 | + better than the one currently being used. SampleRate also stops 34 | + probing at a bitrate if it experiences several successive losses. 35 | + 36 | + Also available are Atsushi Onoe's rate control algorithm and Adaptive 37 | + Multi Rate Retry rate control algorithm. 38 | + 39 | Amateur Radio AX.25 Level 2 protocol 40 | CONFIG_AX25 41 | This is the protocol used for computer communication over amateur 42 | -------------------------------------------------------------------------------- /patch-kernel/Kconfig: -------------------------------------------------------------------------------- 1 | 2 | comment "Atheros 802.11(a/b/g) PCI/Cardbus support" 3 | 4 | config ATHEROS 5 | tristate "Atheros PCI/Cardbus cards" 6 | depends on PCI && (NET_RADIO || WIRELESS_EXT) && CRYPTO 7 | ---help--- 8 | Say Y here if you intend to attach an Atheros Cardbus or PCI 9 | wireless Ethernet networking card to your computer. This 10 | driver support the standard Linux Wireless Extensions. 11 | 12 | You will also very likely also need the Wireless Tools in order to 13 | configure your card and that /etc/pcmcia/wireless.opts works: 14 | . 15 | 16 | To compile this driver as a module, choose M here: the module will be 17 | called ath_pci. If unsure, say N. 18 | 19 | config ATHEROS_DEBUG 20 | bool "Atheros: Debugging support for Atheros PCI/Cardbus cards" 21 | depends on ATHEROS 22 | default y 23 | help 24 | Enable diagnostic checks and log output. 25 | 26 | choice 27 | prompt "Atheros: Default Transmission Rate Control Algorithm" 28 | depends on ATHEROS 29 | default ATHEROS_RATE_DEFAULT_SAMPLE 30 | help 31 | Select the rate control algorithm to be used by default. You 32 | can select additional algorithms below. 33 | 34 | config ATHEROS_RATE_DEFAULT_AMRR 35 | bool "AMRR" 36 | select ATHEROS_RATE_AMRR 37 | 38 | config ATHEROS_RATE_DEFAULT_ONOE 39 | bool "Onoe" 40 | select ATHEROS_RATE_ONOE 41 | 42 | config ATHEROS_RATE_DEFAULT_SAMPLE 43 | bool "Sample" 44 | select ATHEROS_RATE_SAMPLE 45 | 46 | config ATHEROS_RATE_DEFAULT_MINSTREL 47 | bool "Minstrel" 48 | select ATHEROS_RATE_MINSTREL 49 | 50 | endchoice 51 | 52 | config ATHEROS_RATE_DEFAULT 53 | string 54 | default "amrr" if ATHEROS_RATE_DEFAULT_AMRR 55 | default "onoe" if ATHEROS_RATE_DEFAULT_ONOE 56 | default "sample" if ATHEROS_RATE_DEFAULT_SAMPLE 57 | default "minstrel" if ATHEROS_RATE_DEFAULT_MINSTREL 58 | 59 | config ATHEROS_RATE_AMRR 60 | bool "Adaptive Multi-Rate Retry control algorithm" 61 | depends on ATHEROS 62 | default y 63 | help 64 | Enable Adaptive Multi-Rate Retry control algorithm. 65 | 66 | config ATHEROS_RATE_ONOE 67 | bool "Atsushi Onoe's rate control algorithm" 68 | depends on ATHEROS 69 | default y 70 | help 71 | Enable Atsushi Onoe's rate control algorithm. 72 | 73 | config ATHEROS_RATE_SAMPLE 74 | bool "Sample Rate control algorithm" 75 | depends on ATHEROS 76 | default y 77 | help 78 | SampleRate chooses the bitrate it predicts will provide the 79 | most throughput based on estimates of the expected per-packet 80 | transmission time for each bitrate. SampleRate periodically 81 | sends packets at bitrates other than the current one to 82 | estimate when another bitrate will provide better performance. 83 | SampleRate switches to another bitrate when its estimated 84 | per-packet transmission time becomes smaller than the current 85 | bitrate's. SampleRate reduces the number of bitrates it must 86 | sample by eliminating those that could not perform better than 87 | the one currently being used. SampleRate also stops probing at 88 | a bitrate if it experiences several successive losses. 89 | 90 | 91 | config ATHEROS_RATE_MINSTREL 92 | bool "A wandering minstrel rate control algorithm" 93 | depends on ATHEROS 94 | default y 95 | help 96 | Similar to the SampleRate code base, except that it is 97 | a)more carefully written 98 | b)shown to give a throughput similar to what can be obtained by 99 | manually fixing either end to fixed rates 100 | c)verified by monitoring the network traffic with an ieee80211 101 | enabled ethereal 102 | d)responds to network changes and does modify the rate accordingly. 103 | Thus, on moving the two nodes together/apart, the ideal rate will 104 | be changed as appropriate. 105 | 106 | -------------------------------------------------------------------------------- /patch-kernel/README: -------------------------------------------------------------------------------- 1 | This directory contains the bits needed to integrate the Madwifi source 2 | distribution into a Linux kernel source tree. This is only recommended 3 | on embedded systems with no kernel module support. For standard 4 | installation, please refer to the files in the top level directory. 5 | 6 | To integrate MadWifi into the Linux kernel, unpack the kernel sources if 7 | needed, then run the install.sh script from this directory. 8 | 9 | If you want to patch the currently running system you can run install.sh 10 | without arguments, otherwise specify the source tree location on the 11 | command line: 12 | 13 | ./install.sh /usr/src/linux 14 | 15 | The driver sources will be copied into drivers/net/wireless/madwifi in 16 | the kernel sources. Some kernel files will be patched to know about 17 | this directory. Files called Makefile.kernel will be renamed to 18 | Makefile. 19 | 20 | Now you can run "make menuconfig" or similar command and configure the 21 | driver as you would normally do. If the kernel is already configured, 22 | run "make oldconfig", and you'll be asked only about Atheros driver. 23 | 24 | It's possible to build Madwifi modules when the driver is integrated 25 | into the Linux kernel, but most users should not need that. 26 | -------------------------------------------------------------------------------- /patch-kernel/install.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | # Shell script to integrate madwifi sources into a Linux 4 | # source tree so it can be built statically. Typically this 5 | # is done to simplify debugging with tools like kgdb. 6 | # 7 | 8 | set -e 9 | 10 | die() 11 | { 12 | echo "FATAL ERROR: $1" >&2 13 | exit 1 14 | } 15 | 16 | SRC=.. 17 | KERNEL_VERSION=$(uname -r) 18 | 19 | if test -n "$1"; then 20 | KERNEL_PATH="$1" 21 | else if test -e /lib/modules/${KERNEL_VERSION}/source; then 22 | KERNEL_PATH="/lib/modules/${KERNEL_VERSION}/source" 23 | else if test -e /lib/modules/${KERNEL_VERSION}/build; then 24 | KERNEL_PATH="/lib/modules/${KERNEL_VERSION}/build" 25 | else 26 | die "Cannot guess kernel source location" 27 | fi 28 | fi 29 | fi 30 | 31 | test -d ${KERNEL_PATH} || die "No kernel directory ${KERNEL_PATH}" 32 | 33 | PATCH() 34 | { 35 | patch -N $1 < $2 36 | } 37 | 38 | # 39 | # Location of various pieces. These mimic what is in Makefile.inc 40 | # and can be overridden from the environment. 41 | # 42 | SRC_HAL=${HAL:-${SRC}/ath_hal} 43 | test -d ${SRC_HAL} || die "No ath_hal directory ${SRC_HAL}" 44 | SRC_NET80211=${WLAN:-${SRC}/net80211} 45 | test -d ${SRC_NET80211} || die "No net80211 directory ${SRC_NET80211}" 46 | SRC_ATH=${ATH:-${SRC}/ath} 47 | test -d ${SRC_ATH} || die "No ath directory ${SRC_ATH}" 48 | SRC_ATH_RATE=${SRC}/ath_rate 49 | test -d ${SRC_ATH_RATE} || 50 | die "No rate control algorithm directory ${SRC_ATH_RATE}" 51 | SRC_COMPAT=${SRC}/include 52 | test -d ${SRC_COMPAT} || die "No compat directory ${SRC_COMPAT}" 53 | 54 | WIRELESS=${KERNEL_PATH}/drivers/net/wireless 55 | test -d ${WIRELESS} || die "No wireless directory ${WIRELESS}" 56 | 57 | echo "Copying top-level files" 58 | MADWIFI=${WIRELESS}/madwifi 59 | rm -rf ${MADWIFI} 60 | mkdir -p ${MADWIFI} 61 | cp -f ${SRC}/BuildCaps.inc ${SRC}/release.h ${MADWIFI} 62 | 63 | 64 | echo "Copying source files" 65 | FILES=$(cd ${SRC} && find ath ath_hal ath_rate include net80211 -name '*.[ch]') 66 | FILES="$FILES $(cd ${SRC} && find ath_hal -name '*.ini')" 67 | for f in $FILES; do 68 | case $f in 69 | *.mod.c) continue;; 70 | esac 71 | mkdir -p $(dirname ${MADWIFI}/$f) 72 | cp -f ${SRC}/$f ${MADWIFI}/$f 73 | done 74 | 75 | echo "Copying makefiles" 76 | FILES=$(cd ${SRC} && find . -name Makefile.kernel) 77 | for f in $FILES; do 78 | cp -f ${SRC}/$f $(dirname ${MADWIFI}/$f)/Makefile 79 | done 80 | 81 | 82 | echo "Patching the build system" 83 | cp -f Kconfig ${MADWIFI} 84 | sed -i '/madwifi/d;/^endmenu/i\ 85 | source "drivers/net/wireless/madwifi/Kconfig"' ${WIRELESS}/Kconfig 86 | sed -i '$a\ 87 | obj-$(CONFIG_ATHEROS) += madwifi/ 88 | /madwifi/d;' ${WIRELESS}/Makefile 89 | 90 | echo "Done" 91 | -------------------------------------------------------------------------------- /regression/Makefile: -------------------------------------------------------------------------------- 1 | obj := $(firstword $(obj) $(SUBDIRS) .) 2 | TOP = $(obj)/.. 3 | 4 | obj-y := ccmp/ tkip/ wep/ 5 | 6 | include $(TOP)/Makefile.inc 7 | 8 | modules: 9 | $(MAKE) -C $(KERNELPATH) SUBDIRS=$(shell pwd) modules 10 | 11 | install: 12 | for i in $(obj-y); do \ 13 | $(MAKE) -C $$i install || exit 1; \ 14 | done 15 | 16 | clean: 17 | for i in $(obj-y); do \ 18 | $(MAKE) -C $$i clean; \ 19 | done 20 | 21 | rm -f modules.order *.symvers 22 | rm -rf .tmp_versions 23 | -------------------------------------------------------------------------------- /regression/ccmp/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for the CCMP regression test. 3 | # 4 | obj := $(firstword $(obj) $(SUBDIRS) .) 5 | TOP = $(obj)/../.. 6 | 7 | obj-m += ath_test_ccmp.o 8 | ath_test_ccmp-objs := test_ccmp.o 9 | 10 | include $(TOP)/Makefile.inc 11 | 12 | INCS += -I$(TOP) -I$(WLAN) 13 | 14 | EXTRA_CFLAGS+= $(INCS) $(COPTS) 15 | 16 | -include $(TOPDIR)/Rules.make 17 | 18 | all: 19 | $(MAKE) -C $(KERNELPATH) SUBDIRS=$(shell pwd) modules 20 | 21 | install: 22 | test -d $(DESTDIR)/$(KMODPATH) || mkdir -p $(DESTDIR)/$(KMODPATH) 23 | install -m 0644 ath_test_ccmp.$(KMODSUF) $(DESTDIR)/$(KMODPATH) 24 | 25 | clean: 26 | -rm -f *~ *.o *.ko *.mod.c 27 | -rm -f modules.order .depend .version .*.o.flags .*.o.d .*.o.cmd .*.ko.cmd 28 | -rm -rf .tmp_versions 29 | 30 | ath_test_ccmp.o: $(ath_test_ccmp-objs) 31 | $(LD) $(LDOPTS) -o ath_test_ccmp.$(KMODSUF) -r $(ath_test_ccmp-objs) 32 | -------------------------------------------------------------------------------- /regression/tkip/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for the TKIP regression test. 3 | # 4 | obj := $(firstword $(obj) $(SUBDIRS) .) 5 | TOP = $(obj)/../.. 6 | 7 | obj-m += ath_test_tkip.o 8 | ath_test_tkip-objs := test_tkip.o 9 | 10 | include $(TOP)/Makefile.inc 11 | 12 | INCS += -I$(TOP) -I$(WLAN) 13 | 14 | EXTRA_CFLAGS+= $(INCS) $(COPTS) 15 | 16 | -include $(TOPDIR)/Rules.make 17 | 18 | all: 19 | $(MAKE) -C $(KERNELPATH) SUBDIRS=$(shell pwd) modules 20 | 21 | install: 22 | test -d $(DESTDIR)/$(KMODPATH) || mkdir -p $(DESTDIR)/$(KMODPATH) 23 | install -m 0644 ath_test_tkip.$(KMODSUF) $(DESTDIR)/$(KMODPATH) 24 | 25 | clean: 26 | -rm -f *~ *.o *.ko *.mod.c 27 | -rm -f modules.order .depend .version .*.o.flags .*.o.d .*.o.cmd .*.ko.cmd 28 | -rm -rf .tmp_versions 29 | 30 | ath_test_tkip.o: $(ath_test_tkip-objs) 31 | $(LD) $(LDOPTS) -o ath_test_tkip.$(KMODSUF) -r $(ath_test_tkip-objs) 32 | -------------------------------------------------------------------------------- /regression/wep/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for the WEP regression test. 3 | # 4 | obj := $(firstword $(obj) $(SUBDIRS) .) 5 | TOP = $(obj)/../.. 6 | 7 | obj-m += ath_test_wep.o 8 | ath_test_wep-objs := test_wep.o 9 | 10 | include $(TOP)/Makefile.inc 11 | 12 | INCS += -I$(TOP) -I$(WLAN) 13 | 14 | EXTRA_CFLAGS+= $(INCS) $(COPTS) 15 | 16 | -include $(TOPDIR)/Rules.make 17 | 18 | all: 19 | $(MAKE) -C $(KERNELPATH) SUBDIRS=$(shell pwd) modules 20 | 21 | install: 22 | test -d $(DESTDIR)/$(KMODPATH) || mkdir -p $(DESTDIR)/$(KMODPATH) 23 | install -m 0644 ath_test_wep.$(KMODSUF) $(DESTDIR)/$(KMODPATH) 24 | 25 | clean: 26 | -rm -f *~ *.o *.ko *.mod.c 27 | -rm -f modules.order .depend .version .*.o.flags .*.o.d .*.o.cmd .*.ko.cmd 28 | -rm -rf .tmp_versions 29 | 30 | ath_test_wep.o: $(ath_test_wep-objs) 31 | $(LD) $(LDOPTS) -o ath_test_wep.$(KMODSUF) -r $(ath_test_wep-objs) 32 | -------------------------------------------------------------------------------- /release.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer, 10 | * without modification. 11 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer 12 | * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any 13 | * redistribution must be conditioned upon including a substantially 14 | * similar Disclaimer requirement for further binary redistribution. 15 | * 3. Neither the names of the above-listed copyright holders nor the names 16 | * of any contributors may be used to endorse or promote products derived 17 | * from this software without specific prior written permission. 18 | * 19 | * Alternatively, this software may be distributed under the terms of the 20 | * GNU General Public License ("GPL") version 2 as published by the Free 21 | * Software Foundation. 22 | * 23 | * NO WARRANTY 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 | * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY 27 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 28 | * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, 29 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 32 | * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 34 | * THE POSSIBILITY OF SUCH DAMAGES. 35 | * 36 | * $Id$ 37 | */ 38 | #define RELEASE_TYPE "BETA" 39 | #define RELEASE_VERSION "trunk" 40 | -------------------------------------------------------------------------------- /scripts/find-madwifi-modules.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ -z "${1}" ] ; then 4 | echo "Purpose:" 5 | echo "Locate all madwifi-related kernel modules for a given kernel" 6 | echo "(including all its subdirectories)." 7 | echo 8 | echo "Usage:" 9 | echo "$0 [-l] [-r] [destdir]" 10 | echo 11 | echo ": the kernel release that madwifi has been compiled for" 12 | echo "[destdir]: destination directory for the compiled madwifi modules (optional)" 13 | echo "-l list the modules we find." 14 | echo "-r remove the modules we find." 15 | echo "If neither -l or -r is specified, the user will be prompted." 16 | echo 17 | exit 1 18 | fi 19 | 20 | LIST_CMD=0 21 | REMOVE_CMD=0 22 | while [ 1 ]; do 23 | case $1 in 24 | -l) 25 | LIST_CMD=1 26 | shift; 27 | ;; 28 | -r) 29 | REMOVE_CMD=1 30 | shift; 31 | ;; 32 | *) 33 | break; 34 | ;; 35 | esac; 36 | done; 37 | 38 | KVERS="${1}" 39 | 40 | if [ -n "${2}" ]; then 41 | KDEST="${2}" 42 | else 43 | KDEST="" 44 | fi 45 | 46 | SEARCH="${KDEST}/lib/modules/${KVERS}" 47 | 48 | PATTERN="^.*\/(ath_(hal|pci|rate_[^.]*)\.k?o)|(wlan(_(acl|ccmp|scan_(ap|sta)|tkip|wep|xauth))?\.k?o)$" 49 | OLD_MODULES=$(find ${SEARCH} -type f -regex '.*\.k?o' 2>/dev/null | grep -w -E "${PATTERN}") 50 | 51 | 52 | 53 | if [ -n "${OLD_MODULES}" ]; then 54 | if [ "$LIST_CMD" -eq 1 ] || [ "$REMOVE_CMD" -eq 1 ]; then 55 | if [ "$LIST_CMD" -eq 1 ]; then 56 | for m in ${OLD_MODULES}; do echo ${m}; done 57 | fi; 58 | if [ "$REMOVE_CMD" -eq 1 ]; then 59 | rm -f ${OLD_MODULES} 60 | fi; 61 | else 62 | echo "" 63 | echo "WARNING:" 64 | echo "It seems that there are modules left from previous MadWifi installations." 65 | echo "If you are unistalling the MadWifi modules please press \"r\" to remove them." 66 | echo "If you are installing new MadWifi modules, you should consider removing those" 67 | echo "already installed, or else you may experience problems during operation." 68 | echo "Remove old modules?" 69 | 70 | while true; do 71 | echo 72 | echo -n "[l]ist, [r]emove, [i]gnore or e[x]it (l,r,i,[x]) ? " 73 | echo 74 | read REPLY 75 | case ${REPLY} in 76 | l|L) 77 | for m in ${OLD_MODULES}; do echo ${m}; done 78 | continue 79 | ;; 80 | 81 | r|R) 82 | rm -f ${OLD_MODULES} 83 | exit 84 | ;; 85 | 86 | i|I) 87 | exit 0 88 | ;; 89 | 90 | x|X) 91 | exit 1 92 | ;; 93 | 94 | *) 95 | continue 96 | ;; 97 | esac 98 | done 99 | fi; 100 | fi 101 | 102 | exit 0 103 | -------------------------------------------------------------------------------- /scripts/madwifi-indent: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Based on Lindent script from Linux with extra types. 4 | # GNU indent doesn't seen to be able to identify types from their 5 | # position in the code. 6 | 7 | indent -npro -kr -i8 -ts8 -sob -l80 -ss -ncs \ 8 | -T s8 -T s16 -T s32 -T s64 \ 9 | -T __s8 -T __s16 -T __s32 -T __s64 \ 10 | -T u8 -T u16 -T u32 -T u64 \ 11 | -T __u8 -T __u16 -T __u32 -T __u64 \ 12 | -T __be16 -T __be32 -T __be64 \ 13 | -T __le16 -T __le32 -T __le64 \ 14 | -T size_t -T u_int8_t -T u_int16_t -T u_int32_t -T u_int64_t \ 15 | -T HAL_BEACON_STATE -T HAL_BEACON_TIMERS -T HAL_BOOL -T HAL_CHANNEL \ 16 | -T HAL_TXQ_INFO -T HAL_INT -T HAL_KEYVAL -T HAL_MIB_STATS \ 17 | -T HAL_NODE_STATS -T HAL_RATE_TABLE -T HAL_STATUS \ 18 | "$@" 19 | 20 | for i in "$@"; do 21 | sed -i -e 's/^ *\([^ :]\+:\)$/\1/;s/\(__attribute__\) ((/\1((/g' $i 22 | done 23 | -------------------------------------------------------------------------------- /scripts/madwifi-unload: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | : ${PATTERN='\(ath_.*\|wlan_.*\|wlan\)$'} 4 | : ${MAX_TRIES=10} 5 | 6 | test "$(id -u)" = 0 || { 7 | echo "ERROR: You must be root to run this script" >&2 8 | exit 1 9 | } 10 | 11 | test -r /proc/modules || { 12 | echo "ERROR: Cannot read /proc/modules" >&2 13 | exit 1 14 | } 15 | 16 | tries="$MAX_TRIES" 17 | while test "$tries" != "0"; do 18 | skipped=0 19 | IFS=' 20 | ' 21 | for line in $(cat /proc/modules); do 22 | IFS=' ' 23 | set x $line 24 | name="$2" 25 | size="$3" 26 | use_count="$4" 27 | use_name="$5" 28 | state="$6" 29 | expr "$name" : "$PATTERN" >/dev/null || continue 30 | 31 | if test "$state" != "Live" || test "$use_count" != "0" || \ 32 | test "$use_name" != "-"; then 33 | # Don't skip unload in the last run 34 | if test "$tries" != "1"; then 35 | skipped=1 36 | continue 37 | fi 38 | fi 39 | 40 | echo "Unloading \"$name\"" 41 | sync # to be safe 42 | /sbin/rmmod "$name" || { 43 | echo "ERROR: cannot unload module \"$name\"" >&2 44 | exit 1 45 | } 46 | sync # to be even safer 47 | done 48 | test "$skipped" = "0" && break 49 | tries=$(($tries - 1)) 50 | done 51 | 52 | exit 0 53 | -------------------------------------------------------------------------------- /tools/.gitignore: -------------------------------------------------------------------------------- 1 | 80211debug 2 | 80211stats 3 | athchans 4 | athctrl 5 | athdebug 6 | athkey 7 | athstats 8 | wlanconfig 9 | wpakey 10 | -------------------------------------------------------------------------------- /tools/Makefile: -------------------------------------------------------------------------------- 1 | # $FreeBSD: src/tools/tools/ath/Makefile,v 1.3 2003/12/07 21:38:44 sam Exp $ 2 | # 3 | # Copyright (c) 2002-2005 Sam Leffler, Errno Consulting 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions 8 | # are met: 9 | # 1. Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # 2. Redistributions in binary form must reproduce the above copyright 12 | # notice, this list of conditions and the following disclaimer in the 13 | # documentation and/or other materials provided with the distribution. 14 | # 15 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 | # SUCH DAMAGE. 26 | # 27 | TOP = .. 28 | 29 | # USER_CROSS_COMPILE is a string that is prepended to all toolchain 30 | # executables, such as gcc, ld, as, objcopy etc. This is used for 31 | # cross-compiling userspace binaries. If not defined, CROSS_COMPILE 32 | # is used. 33 | USER_CROSS_COMPILE ?= $(CROSS_COMPILE) 34 | STRIP ?= $(USER_CROSS_COMPILE)strip 35 | CC = $(USER_CROSS_COMPILE)gcc 36 | 37 | BINDIR ?= /usr/local/bin 38 | MANDIR ?= /usr/local/man 39 | 40 | # 41 | # Path to the HAL source code. 42 | # 43 | ifeq ($(HAL),) 44 | HAL = $(TOP)/ath_hal 45 | endif 46 | 47 | 48 | PROGRAMS = athstats 80211stats athkey athchans athctrl \ 49 | athdebug 80211debug wlanconfig wpakey 50 | 51 | INCS = -I. -I$(HAL) -I$(TOP) 52 | CFLAGS = -g -O2 -Wall 53 | ALL_CFLAGS = $(CFLAGS) $(INCS) 54 | LDFLAGS = 55 | 56 | all: $(PROGRAMS) 57 | 58 | athstats: athstats.c 59 | $(CC) -o athstats $(ALL_CFLAGS) -I$(TOP)/ath $(LDFLAGS) athstats.c 60 | 80211stats: 80211stats.c 61 | $(CC) -o 80211stats $(ALL_CFLAGS) $(LDFLAGS) 80211stats.c 62 | athkey: athkey.c 63 | $(CC) -o athkey $(ALL_CFLAGS) $(LDFLAGS) athkey.c 64 | athchans: athchans.c 65 | $(CC) -o athchans $(ALL_CFLAGS) $(LDFLAGS) athchans.c 66 | athctrl: athctrl.c 67 | $(CC) -o athctrl $(ALL_CFLAGS) $(LDFLAGS) athctrl.c 68 | athdebug: athdebug.c 69 | $(CC) -o athdebug $(ALL_CFLAGS) $(LDFLAGS) athdebug.c 70 | wlanconfig: wlanconfig.c 71 | $(CC) -o wlanconfig $(ALL_CFLAGS) $(LDFLAGS) wlanconfig.c 72 | 80211debug: 80211debug.c 73 | $(CC) -o 80211debug $(ALL_CFLAGS) $(LDFLAGS) 80211debug.c 74 | wpakey: wpakey.c 75 | $(CC) -o wpakey $(ALL_CFLAGS) $(LDFLAGS) wpakey.c 76 | 77 | install: all 78 | install -d $(DESTDIR)$(BINDIR) 79 | for i in $(PROGRAMS); do \ 80 | install $$i $(DESTDIR)$(BINDIR)/$$i; \ 81 | $(STRIP) $(DESTDIR)$(BINDIR)/$$i; \ 82 | done 83 | install -d $(DESTDIR)$(MANDIR)/man8 84 | install -m 0644 man/*.8 $(DESTDIR)$(MANDIR)/man8 85 | install $(TOP)/scripts/madwifi-unload $(DESTDIR)$(BINDIR)/madwifi-unload 86 | 87 | uninstall: 88 | for i in $(PROGRAMS); do \ 89 | rm -f $(DESTDIR)$(BINDIR)/$$i; \ 90 | done 91 | for i in $(PROGRAMS:=.8); do \ 92 | rm -f $(DESTDIR)$(MANDIR)/man8/$$i; \ 93 | done 94 | 95 | clean: 96 | rm -f $(PROGRAMS) core a.out 97 | 98 | .PHONY: all clean install uninstall 99 | -------------------------------------------------------------------------------- /tools/athctrl.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2002-2004 Gunter Burchardt, Local-Web AG 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer, 10 | * without modification. 11 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer 12 | * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any 13 | * redistribution must be conditioned upon including a substantially 14 | * similar Disclaimer requirement for further binary redistribution. 15 | * 3. Neither the names of the above-listed copyright holders nor the names 16 | * of any contributors may be used to endorse or promote products derived 17 | * from this software without specific prior written permission. 18 | * 19 | * Alternatively, this software may be distributed under the terms of the 20 | * GNU General Public License ("GPL") version 2 as published by the Free 21 | * Software Foundation. 22 | * 23 | * NO WARRANTY 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 | * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY 27 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 28 | * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, 29 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 32 | * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 34 | * THE POSSIBILITY OF SUCH DAMAGES. 35 | * 36 | * $Id$ 37 | */ 38 | 39 | /* 40 | * Simple Atheros-specific tool to inspect and set atheros specific values 41 | * athctrl [-i interface] [-d distance] 42 | * (default interface is wifi0). 43 | */ 44 | #include 45 | #include 46 | 47 | #include 48 | 49 | #include 50 | #include 51 | #include 52 | #include 53 | 54 | #include 55 | 56 | static int 57 | setsysctrl(const char *dev, const char *control , u_long value) 58 | { 59 | char buffer[256]; 60 | FILE * fd; 61 | 62 | snprintf(buffer, sizeof(buffer), "/proc/sys/dev/%s/%s", dev, control); 63 | fd = fopen(buffer, "w"); 64 | if (fd != NULL) { 65 | fprintf(fd, "%li", value); 66 | fclose(fd); 67 | } else 68 | fprintf(stderr, "Could not open %s for writing!\n", buffer); 69 | 70 | return 0; 71 | } 72 | 73 | static void usage(void) 74 | { 75 | fprintf(stderr, 76 | "Atheros driver control\n" 77 | "Copyright (c) 2002-2004 Gunter Burchardt, Local-Web AG\n" 78 | "\n" 79 | "usage: athctrl [-i interface] [-d distance]\n" 80 | "\n" 81 | "options:\n" 82 | " -h show this usage\n" 83 | " -i interface (default interface is wifi0)\n" 84 | " -d specify the maximum distance of a sta or the distance\n" 85 | " of the master\n"); 86 | 87 | exit(1); 88 | } 89 | 90 | int 91 | main(int argc, char *argv[]) 92 | { 93 | char device[IFNAMSIZ + 1]; 94 | int distance = -1; 95 | int c; 96 | 97 | strncpy(device, "wifi0", sizeof (device)); 98 | 99 | for (;;) { 100 | c = getopt(argc, argv, "d:i:h"); 101 | if (c < 0) 102 | break; 103 | switch (c) { 104 | case 'h': 105 | usage(); 106 | break; 107 | case 'd': 108 | distance = atoi(optarg); 109 | break; 110 | case 'i': 111 | strncpy(device, optarg, sizeof (device)); 112 | break; 113 | default: 114 | usage(); 115 | break; 116 | } 117 | } 118 | 119 | if (distance >= 0) { 120 | printf("Setting distance on interface %s to %i meters\n", 121 | device, distance); 122 | setsysctrl(device, "distance", distance); 123 | } else 124 | usage(); 125 | return 0; 126 | } 127 | -------------------------------------------------------------------------------- /tools/man/80211debug.8: -------------------------------------------------------------------------------- 1 | .TH "80211DEBUG" "8" "February 2006" "" "" 2 | .SH "NAME" 3 | \fB80211debug\fP \- control the debug output from the madwifi 802.11 stack 4 | .SH "SYNOPSIS" 5 | .B 80211debug 6 | [-i interface] +/\- bitmap 7 | .SH "DESCRIPTION" 8 | Set and clear debug bitmaps for the madwifi 802.11 stack. Each argument is a 9 | bitmap or its alias. If a bitmap alias is used then it must be prefixed by 10 | either "-" to clear or "+" to set the corresponding bitmap. 11 | .PP 12 | .SH "OPTIONS" 13 | .TP 14 | .B \-? 15 | Display usage and list all debug bitmaps. 16 | .TP 17 | .B \-i interface 18 | The madwifi interface to debug. If no interface is specified, \fB80211debug\fP 19 | defaults to ath0. 20 | .TP 21 | .B +/\- bitmap 22 | Set (+) or clear (-) a bitmap. It's quite tedious to remember the bitmaps, 23 | fortunately there is a user friendly interface which can be used to enable or 24 | disable debugging output by giving the name of the component or subsystem. 25 | .PP 26 | All debugging output can be enabled with 0xffffffff bitmap, while 0x0 27 | disables all debug output. 28 | .PP 29 | .SH "BITMAP ALIASES" 30 | .BI debug 31 | \- IFF_DEBUG equivalent 32 | .br 33 | .BI dumppkts 34 | \- IFF_LINK2 equivalent, dump packets 35 | .br 36 | .BI crypto 37 | \- crypto modules 38 | .br 39 | .BI input 40 | \- packet input handling 41 | .br 42 | .BI xrate 43 | \- rate set handling 44 | .br 45 | .BI elemid 46 | \- element id parsing 47 | .br 48 | .BI node 49 | \- node management 50 | .br 51 | .BI assoc 52 | \- association handling 53 | .br 54 | .BI auth 55 | \- authentication handling 56 | .br 57 | .BI scan 58 | \- scanning 59 | .br 60 | .BI output 61 | \- packet output handling 62 | .br 63 | .BI state 64 | \- 802.11 state machine 65 | .br 66 | .BI power 67 | \- power save functions 68 | .br 69 | .BI dot1x 70 | \- 802.1x authenticator 71 | .br 72 | .BI dot1xsm 73 | \- 802.1x state machine 74 | .br 75 | .BI radius 76 | \- 802.1x radius client 77 | .br 78 | .BI raddump 79 | \- 802.1x radius packet dump 80 | .br 81 | .BI radkeys 82 | \- 802.1x key dump 83 | .br 84 | .BI wpa 85 | \- WPA/RSN protocol 86 | .br 87 | .BI ac1 88 | \- ACL handling 89 | .br 90 | .BI wme 91 | \- WME protocol 92 | .br 93 | .BI superg 94 | \- super G turbo mode 95 | .br 96 | .BI doth 97 | \- 802.11h (DFS/TPC) handling 98 | .br 99 | .BI inact 100 | \- timeout of inactive nodes 101 | .br 102 | .BI roam 103 | \- station mode roaming 104 | .br 105 | .PP 106 | .SH "EXAMPLES" 107 | .TP 108 | .B 80211debug \-i ath1 0xffffffff 109 | Enable all debug bitmaps on ath1. 110 | .TP 111 | .B 80211debug +state +assoc 112 | Set state and assoc bitmaps to on for ath0. 113 | .TP 114 | .B 80211debug \-state 115 | Disable state bitmap for ath0. 116 | .PP 117 | .SH "SEE ALSO" 118 | \fBathdebug\fP(8), \fBhttp://madwifi-project.org/wiki/DevDocs/AthDebug\fP 119 | .SH "AUTHOR" 120 | This manual page was written by Kel Modderman and was based 121 | upon previous text written by Eric S. Raymond. 122 | -------------------------------------------------------------------------------- /tools/man/80211stats.8: -------------------------------------------------------------------------------- 1 | .TH "80211STATS" "8" "February 2006" "" "" 2 | .SH "NAME" 3 | \fB80211stats\fP \- simple tool to display collected madwifi 802.11 statistics 4 | .SH "SYNOPSIS" 5 | .B 80211stats 6 | .I "[\-i interface] [-a] [mac...]" 7 | .SH "DESCRIPTION" 8 | Provide statistics about the madwifi 802.11 stack. \fB80211stats\fP will print 9 | a summary of statistical elements including rx errors, node, crypto and key 10 | management data. 11 | .PP 12 | If a madwifi interface is specified, \fB80211stats\fP will contain the output of 13 | statistics derived from interactions between the specified interface and the 14 | madwifi 802.11 stack. 15 | .SH "OPTIONS" 16 | .TP 17 | .B \-i interface 18 | The madwifi interface to derive statistics for. If no interface is specified, 19 | \fB80211stats\fP defaults to ath0. 20 | .TP 21 | .B \-a 22 | Print statstics for each station/neighbor in interface. 23 | .TP 24 | .B mac... 25 | Print statistics for given list of MAC addresses. 26 | .PP 27 | .SH "EXAMPLES" 28 | .TP 29 | .B 80211stats 30 | Print summary of statistics derived from the madwifi 802.11 stack, not specific 31 | to any madwifi device present in the system. 32 | .TP 33 | .B 80211stats \-i ath0 34 | Print summary of statistics specific for ath0. 35 | .PP 36 | .SH "SEE ALSO" 37 | \fBathstats\fP(8) 38 | .SH "AUTHOR" 39 | This manual page was written by Kel Modderman . 40 | -------------------------------------------------------------------------------- /tools/man/athchans.8: -------------------------------------------------------------------------------- 1 | .TH "ATHCHANS" "8" "February 2006" "" "" 2 | .SH "NAME" 3 | \fBathchans\fP \- define channel range of madwifi devices 4 | .SH "SYNOPSIS" 5 | .B athchans 6 | [-i device] channel_range 7 | .SH "DESCRIPTION" 8 | Athchans constrains the set of channels used when scanning for access points, 9 | peers in an IBSS network, or looking for unoccupied channels when operating as 10 | an access point. 11 | .PP 12 | The set of channels is specified as a range of the form x-y. Channel numbers 13 | must be in the range 1 to 255 and be permissible according to the operating 14 | characteristics of the device. 15 | .PP 16 | .SH "OPTIONS" 17 | .TP 18 | .B \-i device 19 | The madwifi device to apply the settings to. If no device is specified, 20 | \fBathchans\fP defaults to wifi0. 21 | .TP 22 | .B channel_range 23 | Range of channel constraint applied to the specified device. The range must 24 | be specified in the form of \fBx-y\fP and be within 1 to 255. 25 | .PP 26 | .SH "EXAMPLES" 27 | .B athchans 5\-9 28 | Restrict wifi0 to channels in the range of 5 to 9. 29 | .TP 30 | .B athchans \-i wifi1 1\-3 31 | Restrict wifi1 to channels in the range of 1 to 3. 32 | .TP 33 | .PP 34 | .SH "SEE ALSO" 35 | \fBathctrl\fP(8), \fBathkey\fP(8), \fBathstats\fP(8) 36 | .SH "AUTHOR" 37 | This manual page was written by Kel Modderman and was based 38 | upon previous text written by Eric S. Raymond and Thorsten von Eicken. 39 | -------------------------------------------------------------------------------- /tools/man/athctrl.8: -------------------------------------------------------------------------------- 1 | .TH "ATHCTRL" "8" "February 2006" "" "" 2 | .SH "NAME" 3 | \fBathctrl\fP \- sets the maximum distance between communicating stations 4 | .SH "SYNOPSIS" 5 | .B athctrl 6 | [-h] [-i device] [-d distance] 7 | .SH "DESCRIPTION" 8 | \fBathctrl\fP sets the maximum distance in meters of stations with which 9 | communication occurs. This distance metric determines how much time the radio 10 | waits for an acknowledgment after every transmission and it sets a few other 11 | derived timing parameters. This limits the distance between two stations at 12 | which the collision avoidance, acknowledgment, retransmission protocols will 13 | work correctly. 14 | .PP 15 | In particular, when transmitting to too distant stations the radio will start 16 | retransmitting packets before an ACK can possibly have been received causing 17 | unnecessary retransmissions and collisions. The distance parameter needs to be 18 | set properly on all stations that perform long-distance communication 19 | irrespective of their mode of operation (master/managed/ad-hoc). For best 20 | operation all stations communicating with each other should be set to the same 21 | value. 22 | .PP 23 | .SH "OPTIONS" 24 | .TP 25 | .B \-i device 26 | The madwifi device to apply the settings to. If no device is specified, 27 | \fBathctrl\fP defaults to wifi0. 28 | .TP 29 | .B \-d distance 30 | Distance in metric meters. 31 | .TP 32 | .B \-h 33 | Display usage. 34 | .PP 35 | .SH "EXAMPLES" 36 | .TP 37 | .B athctrl \-i wifi1 \-d 500 38 | Set maximum distance of 500m for wifi1. 39 | .TP 40 | .B athctrl 1000 41 | Set maximum distance of 1000m for wifi0. 42 | .PP 43 | .SH "SEE ALSO" 44 | \fBathchans\fP(8), \fBathkey\fP(8), \fBathstats\fP(8) 45 | .SH "AUTHOR" 46 | This manual page was written by Kel Modderman and was based 47 | upon previous text written by Eric S. Raymond and Thorsten von Eicken. 48 | -------------------------------------------------------------------------------- /tools/man/athdebug.8: -------------------------------------------------------------------------------- 1 | .TH "ATHDEBUG" "8" "February 2006" "" "" 2 | .SH "NAME" 3 | \fBathdebug\fP \- control the debug output from the madwifi device subsystem 4 | .SH "SYNOPSIS" 5 | .B athdebug 6 | [-i device] +/\- bitmap 7 | .SH "DESCRIPTION" 8 | Set and clear debug bitmaps for the madwifi ath device subsystem. Each argument 9 | is a bitmap or its alias. If a bitmap alias is used then it must be prefixed by 10 | either "-" to clear or "+" to set the corresponding bitmap. 11 | .PP 12 | All debugging output can be enabled with the 0xffffffff bitmap, while 0x0 13 | disables all debug output. 14 | .PP 15 | .SH "OPTIONS" 16 | .TP 17 | .B \-? 18 | Display usage and list all debug flags. 19 | .TP 20 | .B \-i device 21 | The madwifi device to apply the settings to. If no interface is specified, 22 | \fBathdebug\fP defaults to wifi0. 23 | .TP 24 | .B +/\- bitmap 25 | Set (+) or clear (-) a debug flag. 26 | .PP 27 | .SH "BITMAP ALIASES" 28 | .BI xmit 29 | \- transmit of packets, just before they go out to the HW 30 | .br 31 | .BI xmit_desc 32 | \- transmit descriptors 33 | .br 34 | .BI recv 35 | \- received packets, directly from the HW 36 | .br 37 | .BI recv_desc 38 | \- recv descriptors 39 | .br 40 | .BI rate 41 | \- rate control modules 42 | .br 43 | .BI reset 44 | \- reset processing and inititalization 45 | .br 46 | .BI mode 47 | \- mode initialization and changes 48 | .br 49 | .BI beacon 50 | \- beacon handling 51 | .br 52 | .BI watchdog 53 | \- watchdog timeout 54 | .br 55 | .BI intr 56 | \- interrupt processing 57 | .br 58 | .BI xmit_proc 59 | \- processing of transmit descriptors 60 | .br 61 | .BI recv_proc 62 | \- processing of receive descriptors 63 | .br 64 | .BI beacon_proc 65 | \- beacon processing 66 | .br 67 | .BI calibrate 68 | \- periodic re-calibration 69 | .br 70 | .BI keycache 71 | \- key cache management 72 | .br 73 | .BI state 74 | \- 802.11 state transitions 75 | .br 76 | .BI node 77 | \- node management 78 | .BI ff 79 | \- fast frame handling 80 | .br 81 | .BI fatal 82 | fatal errors 83 | .br 84 | .PP 85 | .SH "EXAMPLES" 86 | .TP 87 | .B athdebug \-i wifi1 0xffffffff 88 | Enable all debug bitmaps on wifi1. 89 | .TP 90 | .B athdebug +rate 91 | Enable rate debug bitmap on wifi0. 92 | .TP 93 | .B athdebug \-rate 94 | Clear rate bitmap on wifi0. 95 | .PP 96 | .SH "SEE ALSO" 97 | \fB80211debug\fP(8), \fBhttp://madwifi-project.org/wiki/DevDocs/AthDebug\fP 98 | .SH "AUTHOR" 99 | This manual page was written by Kel Modderman and was based 100 | upon previous text written by Eric S. Raymond. 101 | -------------------------------------------------------------------------------- /tools/man/athkey.8: -------------------------------------------------------------------------------- 1 | .TH "ATHKEY" "8" "February 2006" "" "" 2 | .SH "NAME" 3 | \fBathkey\fP \- manage encryption type and keys of madwifi devices 4 | .SH "SYNOPSIS" 5 | .B athkey 6 | [-i device] [-d] keyix cipher keyval [mac] 7 | .SH "DESCRIPTION" 8 | Each device may have up to four keys; the first argument required is the key 9 | index. The "-d" option may be specified to delete the key associated with the 10 | selected key index. Otherwise, the other arguments required are a cipher type 11 | and a key value encoded as a hexadecimal literal. A MAC address may be given as 12 | a final argument; if given, the key will be considered valid only for the 13 | specified MAC address. 14 | .PP 15 | .SH "OPTIONS" 16 | .TP 17 | .B \-i device 18 | The madwifi device to apply the settings to. If no device is specified, 19 | \fBathkey\fP defaults to wifi0. 20 | .TP 21 | .B \-d keyix 22 | Delete a specified key index. 23 | .TP 24 | .B keyix 25 | A key index of 1, 2, 3 or 4. 26 | .TP 27 | .B cipher 28 | Cipher type values: [wep|tkip|ocb|ccm|aes|ckip|none] 29 | .TP 30 | .B keyval 31 | A key value encoded as a hexadecimal literal with an optional leading 0x or 0X. 32 | Embedded periods, colons and dashes are ignored. 33 | .TP 34 | .B mac 35 | MAC address encoded as an hexadecimal literal. If a MAC address is specified when 36 | adding a key value, the key will be valid only for the specified MAC. 37 | .PP 38 | .SH "EXAMPLES" 39 | .TP 40 | .B athkey \-i wifi1 \-d 1 41 | Remove key value of index 1 for wifi1. 42 | .TP 43 | .B athkey 1 wep 0123456789 44 | Set a wep key of "0123456789" on index 1 on wifi0. 45 | .TP 46 | .B athkey \-i wifi2 2 tkip 0123456789 00:9b:5c:63:e6:b4 47 | Set a key of 0123456789 using the tkip cipher for a MAC of 00:9b:5c:63:e6:b4 48 | on index 2 on wifi2. 49 | .PP 50 | .SH "SEE ALSO" 51 | \fBathchans\fP(8), \fBathctrl\fP(8), \fBathstats\fP(8) 52 | .SH "AUTHOR" 53 | This manual page was written by Kel Modderman and was based 54 | upon previous text written by Eric S. Raymond and Thorsten von Eicken. 55 | -------------------------------------------------------------------------------- /tools/man/athstats.8: -------------------------------------------------------------------------------- 1 | .TH "ATHSTATS" "8" "February 2006" "" "" 2 | .SH "NAME" 3 | \fBathstats\fP \- simple tool to inspect and monitor network traffic statistics 4 | .SH "SYNOPSIS" 5 | .B athstats 6 | .I "[\-i device] [interval]" 7 | .SH "DESCRIPTION" 8 | Provide statistics about a madwifi device. Without any arguments, 9 | \fBathstats\fP will print a summary of statistical elements for the specified 10 | device (defaults to wifi0 when no device is given). If an additional argument 11 | is given as an integer, athstats will print progressive statistical data at an 12 | interval equal to the integer in seconds. 13 | .PP 14 | Statistical elements of the summary report include packets sent/received, tx/rx 15 | errors, calibration information and antenna profile data. 16 | .PP 17 | The progressive report elements include packet input/output as well as altrate, 18 | short, long, xretry, crcerr, crypt, phyerror packet count, rssi and rate data. 19 | .PP 20 | The statistical data is derived from device ioctls and /proc/net/dev. For 21 | further understanding of how the statistical information is collected and what 22 | it represents, please refer to the \fBathstats\fP source code 23 | (tools/athstats.c). 24 | .SH "OPTIONS" 25 | .TP 26 | .B \-i device 27 | The madwifi device to apply the settings to. If no device is specified, 28 | \fBathstats\fP defaults to wifi0. 29 | .TP 30 | .B interval 31 | Define the interval between realtime statistical feedback in seconds. 32 | .PP 33 | .SH "EXAMPLES" 34 | .TP 35 | .B athstats 36 | Print summary of statistics for wifi0. 37 | .TP 38 | .B athstats 1 39 | Update a progressive statistical report every 1 second for wifi0. 40 | .TP 41 | .B athstats \-i wifi1 5 42 | Update a progressive statistical report every 5 seconds for wifi1. 43 | .PP 44 | .SH "SEE ALSO" 45 | \fB80211stats\fP(8) 46 | .SH "AUTHOR" 47 | This manual page was written by Kel Modderman . 48 | -------------------------------------------------------------------------------- /tools/man/wlanconfig.8: -------------------------------------------------------------------------------- 1 | .TH "WLANCONFIG" "8" "October 2005" 2 | .SH "NAME" 3 | \fBwlanconfig\fP \- Create, destroy and manipulate madwifi VAPs 4 | .SH "SYNOPSIS" 5 | \fBwlanconfig create wlandev wlanmode 6 | .TP 7 | \fBwlanconfig destroy 8 | .TP 9 | \fBwlanconfig list 10 | .SH "DESCRIPTION" 11 | The current MadWifi driver supports multiple APs and concurrent AP/Station 12 | mode operation on the same device. The devices are restricted to using the 13 | same underlying hardware, thus are limited to coexisting on the same channel 14 | and using the same physical layer features. Each instance of an AP or station 15 | is called a Virtual AP (or VAP). Each VAP can be in either AP mode, Station 16 | Mode, "special" station mode, and Monitor mode. Every VAP has an associated 17 | underlying base device which is created when the driver is loaded. 18 | .PP 19 | .SH "ARGUMENTS" 20 | .TP 21 | .B create [nounit] wlandev wlanmode [uniquebssid] 22 | Create the interface using the specified and . can either be a full interface name (e.g. 'ath0'), or just the suffix (e.g. 'ath'), in which case, the kernel will automatically append the next vacant integer. [nounit] will turn off the automatic integer increments. 23 | .TP 24 | .B destroy 25 | Removes the given VAP interface. You must specify the full interface name. I.e 'ath0' rather than just 'ath'. 26 | .TP 27 | .B list 28 | Show information about connected peers, keys, channels etc. 29 | .PP 30 | .SH "AVAILABLE MODES" 31 | .TP 32 | .B ahdemo 33 | Create the station in ad-hoc demo (aka pseudo IBSS) mode. 34 | .TP 35 | .B adhoc 36 | Create the station in ad-hoc mode. 37 | .TP 38 | .B ap 39 | Create the VAP in AP mode. 40 | .TP 41 | .B monitor 42 | Create the station in monitor mode. 43 | .TP 44 | .B sta 45 | Create the VAP in station mode. 46 | .TP 47 | .B wds 48 | Create the station in WDS mode. 49 | .PP 50 | .SH "OPTIONS" 51 | .TP 52 | .B uniquebssid 53 | Create the VAP using a new unique MAC address, different from the underlying device. 54 | .TP 55 | .B bssid 56 | Synonym for uniquebssid, for backward compatibility. 57 | .TP 58 | .B \-bssid 59 | Ignored for backward compatibility. 60 | .TP 61 | .B nosbeacon 62 | Ignored for backward compatibility. 63 | .PP 64 | .SH "LIST ITEMS" 65 | .TP 66 | .B sta or no parameters. 67 | Show information on associated stations. 68 | .TP 69 | .B scan or ap 70 | List all visible stations. 71 | .TP 72 | .B chan or freq 73 | List all channels and frequencies. 74 | .TP 75 | .B active 76 | List all available channels and frequencies. 77 | .TP 78 | .B keys 79 | List all of the keys associated with the VAP 80 | .TP 81 | .B caps 82 | List the capabilities of the given VAP. 83 | .TP 84 | .B wme 85 | List WME (Wireless multimedia extensions, aka WMM) parameters. 86 | .PP 87 | .SH "EXAMPLES" 88 | .TP 89 | \fBwlanconfig ath create wlandev wifi0 wlanmode sta 90 | Create a station mode VAP, using wifi0 as the underlying device. The interface wil be called athN, where N is the first free integer. The MAC address will be the same as the underlying device. 91 | .TP 92 | \fBwlanconfig ath0 create wlandev wifi0 wlanmode sta 93 | Create a station mode VAP (ath0) using wifi0 as the underlying device. The MAC address will be the same as the underlying device. 94 | .TP 95 | \fBwlanconfig ath0 create wlandev wifi0 wlanmode ap 96 | .RS 0 97 | \fBwlanconfig ath1 create wlandev wifi0 wlanmode sta nosbeacon 98 | .RS 7 99 | \fRCreate both an AP and a station mode interface. 100 | .RS -7 101 | .TP 102 | \fBwlanconfig ath0 destroy 103 | Destroy VAP ath0. 104 | .TP 105 | \fBwlanconfig ath0 list scan 106 | Scan for local stations and access points. 107 | .TP 108 | \fBwlanconfig ath0 create wlandev wifi0 wlanmode ap 109 | .RS 0 110 | \fBwlanconfig ath1 create wlandev wifi0 wlanmode wds 111 | .RS 0 112 | \fBiwconfig ath0 essid "Normal atheros AP" channel 1 113 | .RS 0 114 | \fBiwpriv ath1 wds_add 115 | .RS 0 116 | \fBiwpriv ath1 wds 1 117 | .RS 0 118 | \fBifconfig ath1 up 119 | .RS 0 120 | \fBifconfig ath0 up 121 | .RS 0 122 | \fBbrctl addbr br0 123 | .RS 0 124 | \fBbrctl addif br0 ath1 125 | .RS 0 126 | \fBbrctl addif br0 ath0 127 | .RS 0 128 | \fBifconfig br0 up 129 | .RS 7 130 | \fRCreate a WDS bridge. See http://madwifi-project.org/ for more information. 131 | .RS -7 132 | .PP 133 | .SH "AUTHOR" 134 | This manual page was written by Matt Foster , using information from the Atheros user documentation, and MadWiFi users mailing list. 135 | --------------------------------------------------------------------------------