svn commit: r187322 - in head/tools/tools/ath: . athrd

Sam Leffler sam at FreeBSD.org
Thu Jan 15 15:38:22 PST 2009


Author: sam
Date: Thu Jan 15 23:38:21 2009
New Revision: 187322
URL: http://svn.freebsd.org/changeset/base/187322

Log:
  add athrd tool that dumps ath hal regulatory info; note this is soon to
  obsolete but commit now so it's available for anyone that's interested

Added:
  head/tools/tools/ath/athrd/
  head/tools/tools/ath/athrd/Makefile   (contents, props changed)
  head/tools/tools/ath/athrd/athrd.1   (contents, props changed)
  head/tools/tools/ath/athrd/athrd.c   (contents, props changed)
  head/tools/tools/ath/athrd/run.sh   (contents, props changed)
Modified:
  head/tools/tools/ath/Makefile
  head/tools/tools/ath/Makefile.inc

Modified: head/tools/tools/ath/Makefile
==============================================================================
--- head/tools/tools/ath/Makefile	Thu Jan 15 23:14:59 2009	(r187321)
+++ head/tools/tools/ath/Makefile	Thu Jan 15 23:38:21 2009	(r187322)
@@ -1,5 +1,5 @@
 #	$FreeBSD$
 
-SUBDIR=	athdebug athkey athprom athregs athstats
+SUBDIR=	athdebug athkey athprom athrd athregs athstats
 
 .include <bsd.subdir.mk>

Modified: head/tools/tools/ath/Makefile.inc
==============================================================================
--- head/tools/tools/ath/Makefile.inc	Thu Jan 15 23:14:59 2009	(r187321)
+++ head/tools/tools/ath/Makefile.inc	Thu Jan 15 23:38:21 2009	(r187322)
@@ -6,6 +6,7 @@ NO_MAN=
 ATH_DEFAULT=	ath0
 
 CFLAGS+=-DATH_DEFAULT='"${ATH_DEFAULT}"'
-CFLAGS+=-I../common
-CFLAGS+=-I../../../../sys/dev/ath
-CFLAGS+=-I../../../../sys/dev/ath/ath_hal
+CFLAGS+=-I${.CURDIR}
+CFLAGS+=-I${.CURDIR}/../common
+CFLAGS+=-I${.CURDIR}/../../../../sys/dev/ath
+CFLAGS+=-I${.CURDIR}/../../../../sys/dev/ath/ath_hal

Added: head/tools/tools/ath/athrd/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/tools/ath/athrd/Makefile	Thu Jan 15 23:38:21 2009	(r187322)
@@ -0,0 +1,21 @@
+# $FreeBSD$
+
+.PATH:	${.CURDIR}/../../../../sys/dev/ath/ath_hal
+
+PROG=	athrd
+
+SRCS=	athrd.c ah_regdomain.c opt_ah.h
+
+CLEANFILES+=	opt_ah.h
+
+CFLAGS+= -fno-inline
+
+.include <../Makefile.inc>
+
+MAN=	athrd.1
+
+opt_ah.h:
+	echo "#define AH_DEBUG 1" > opt_ah.h
+	echo "#define AH_DEBUG_COUNTRY 1" >> opt_ah.h
+
+.include <bsd.prog.mk>

Added: head/tools/tools/ath/athrd/athrd.1
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/tools/ath/athrd/athrd.1	Thu Jan 15 23:38:21 2009	(r187322)
@@ -0,0 +1,176 @@
+.\"-
+.\" Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
+.\" All rights reserved.
+.\""
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer,
+.\"    without modification.
+.\" 2. Redistributions in binary form must reproduce at minimum a disclaimer
+.\"    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+.\"    redistribution must be conditioned upon including a substantially
+.\"    similar Disclaimer requirement for further binary redistribution.
+.\"
+.\" NO WARRANTY
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+.\" LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
+.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+.\" THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
+.\" OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGES.
+.\"
+.\" $FreeBSD$
+.\"/
+.Dd January 15, 2009
+.Dt ATHRD 1
+.Os
+.Sh NAME
+.Nm athrd
+.Nd list channels and transmit power for a country/regulatory domain
+.Sh SYNOPSIS
+.Nm
+.Op Fl aioedlpcfr4ABGT
+.Op Fl m Ar mode
+.Bk
+.Op Ar country
+.Ek
+.Sh DESCRIPTION
+.Nm
+displays the list of frequencies and the associated maximum transmit
+power permitted within a regulatory domain and/or country.
+.Pp
+If no command line options are given, a default country (\c
+.Ql US )
+is used.
+Country and regulatory names are case insensitive.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl a
+By default
+.Nm
+will display B channels only if they are not also marked as available for
+use as G channels and similary for A and T channels.
+With this option
+.Nm
+will list all channels.
+.It Fl i
+Calculate channels based on indoor use.
+.It Fl o
+Calculate channels based on outdoor use (default).
+.It Fl e
+Calculate channels not assuming extended channel mode.
+.It Fl d
+Enabling debugging in the HAL code that calculates the available channels
+and transmit power values.
+.It Fl l
+Provide a list of all known country and regulatory domain names.
+.It Fl m Ar mode
+Calculate channels and transmit power for operation in
+.Ql mode ;
+one of
+.Ql station ,
+.Ql ibss ,
+.Ql monitor ,
+and
+.Ql ap
+(or the first two letters).
+.It Fl p
+Mark passive scan channels with lower case letters and active
+scan channels with upper case letters.
+.It Fl r
+Mark channels that require DFS with a 
+.Ql * .
+.It Fl 4
+Mark channels that have a 4ms packet limit with a 
+.Ql 4 .
+.It Fl c
+Display IEEE channel numbers instead of frequencies.
+.It Fl f
+Display frequencies (default).
+.It Fl A
+Display only 11A channels.
+.It Fl B
+Display only 11B channels.
+.It Fl G
+Display only 11G channels.
+.It Fl T
+Display only Turbo channels.
+.El
+.Sh EXAMPLES
+The following demonstrates how to list the permissible frequencies
+and maximum transport power per channel for use in Spain:
+.Pp
+.nf
+tubby% athrd es
+\&
+SPAIN (ES, 0x2d4, 724) NULL1_WORLD (0x3, 3)
+2412G 14.0 2417G 14.0 2422G 14.0 2427G 17.0 2432G 14.0 2437G 17.0
+2442G 14.0 2447G 17.0 2452G 17.0 2457G 14.0 2462G 17.0
+.fi
+.Pp
+Each frequency has a suffix that is one of:
+.Ql G ,
+.Ql B ,
+.Ql A ,
+or
+.Ql T 
+according to whether the channel is usable with 802.11g, 802.11b,
+802.11a, or Atheros Turbo mode.
+All channels listed as 
+.Ql G
+are also usable in
+.Ql B .
+Likewise, all channels listed as
+.Ql A
+are usable in
+.Ql T .
+Channels listed as
+.Ql B
+or
+.Ql T
+are only usable in those modes.
+(Note that when the
+.Fl p
+option is specified passive scan channels are marked with a lower case
+.Ql g ,
+.Ql b ,
+.Ql a ,
+or
+.Ql t .)
+The transmit power is given in units of dbM.
+.Sh DIAGNOSTICS
+Various diagnostics about unknown regulatory domains and/or country
+codes may be encountered.
+Use the
+.Fl l
+option for a list of valid names.
+.Sh SEE ALSO
+.Xr ath 4 ,
+.Xr ath_hal 4
+.Sh STANDARDS
+Lots belong here.
+.Sh NOTES
+.Nm
+use the HAL to calculate the set of channels.
+The transmit power calculations are done by emulating
+how the HAL works.
+Because 
+.Nm
+does not
+read the actual EEPROM contents from a device this emulation may lag
+behind current practice.
+.Sh BUGS
+The HAL reset logic should be used to calculate the transmit power
+for each channel instead of using a separate copy of the code.
+The data presented by
+.Nm
+are the expected values; for compliance testing one must measure the actual
+operation of the driver and the HAL.

Added: head/tools/tools/ath/athrd/athrd.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/tools/ath/athrd/athrd.c	Thu Jan 15 23:38:21 2009	(r187322)
@@ -0,0 +1,1887 @@
+/*-
+ * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ *    redistribution must be conditioned upon including a substantially
+ *    similar Disclaimer requirement for further binary redistribution.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ * $FreeBSD$
+ */
+#include "opt_ah.h"
+
+#include "ah.h"
+#include "ah_internal.h"
+#include "ah_eeprom_v3.h"		/* XXX */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <unistd.h>
+
+#define	IEEE80211_CHAN_MAX	255
+#define IEEE80211_REGCLASSIDS_MAX	10
+
+int		ath_hal_debug = 0;
+HAL_CTRY_CODE	cc = CTRY_DEFAULT;
+HAL_REG_DOMAIN	rd = 169;		/* FCC */
+HAL_BOOL	outdoor = AH_TRUE;
+HAL_BOOL	Amode = 1;
+HAL_BOOL	Bmode = 1;
+HAL_BOOL	Gmode = 1;
+HAL_BOOL	HT20mode = 1;
+HAL_BOOL	HT40mode = 1;
+HAL_BOOL	turbo5Disable = AH_FALSE;
+HAL_BOOL	turbo2Disable = AH_FALSE;
+
+u_int16_t	_numCtls = 8;
+u_int16_t	_ctl[32] =
+	{ 0x10, 0x13, 0x40, 0x30, 0x11, 0x31, 0x12, 0x32 };
+RD_EDGES_POWER	_rdEdgesPower[NUM_EDGES*NUM_CTLS] = {
+	{ 5180, 28, 0 },	/* 0x10 */
+	{ 5240, 60, 0 },
+	{ 5260, 36, 0 },
+	{ 5320, 27, 0 },
+	{ 5745, 36, 0 },
+	{ 5765, 36, 0 },
+	{ 5805, 36, 0 },
+	{ 5825, 36, 0 },
+
+	{ 5210, 28, 0 },	/* 0x13 */
+	{ 5250, 28, 0 },
+	{ 5290, 30, 0 },
+	{ 5760, 36, 0 },
+	{ 5800, 36, 0 },
+	{ 0, 0, 0 },
+	{ 0, 0, 0 },
+	{ 0, 0, 0 },
+
+	{ 5170, 60, 0 },	/* 0x40 */
+	{ 5230, 60, 0 },
+	{ 0, 0, 0 },
+	{ 0, 0, 0 },
+	{ 0, 0, 0 },
+	{ 0, 0, 0 },
+	{ 0, 0, 0 },
+	{ 0, 0, 0 },
+
+	{ 5180, 33, 0 },	/* 0x30 */
+	{ 5320, 33, 0 },
+	{ 5500, 34, 0 },
+	{ 5700, 34, 0 },
+	{ 5745, 35, 0 },
+	{ 5765, 35, 0 },
+	{ 5785, 35, 0 },
+	{ 5825, 35, 0 },
+
+	{ 2412, 36, 0 },	/* 0x11 */
+	{ 2417, 36, 0 },
+	{ 2422, 36, 0 },
+	{ 2432, 36, 0 },
+	{ 2442, 36, 0 },
+	{ 2457, 36, 0 },
+	{ 2467, 36, 0 },
+	{ 2472, 36, 0 },
+
+	{ 2412, 36, 0 },	/* 0x31 */
+	{ 2417, 36, 0 },
+	{ 2422, 36, 0 },
+	{ 2432, 36, 0 },
+	{ 2442, 36, 0 },
+	{ 2457, 36, 0 },
+	{ 2467, 36, 0 },
+	{ 2472, 36, 0 },
+
+	{ 2412, 36, 0 },	/* 0x12 */
+	{ 2417, 36, 0 },
+	{ 2422, 36, 0 },
+	{ 2432, 36, 0 },
+	{ 2442, 36, 0 },
+	{ 2457, 36, 0 },
+	{ 2467, 36, 0 },
+	{ 2472, 36, 0 },
+
+	{ 2412, 28, 0 },	/* 0x32 */
+	{ 2417, 28, 0 },
+	{ 2422, 28, 0 },
+	{ 2432, 28, 0 },
+	{ 2442, 28, 0 },
+	{ 2457, 28, 0 },
+	{ 2467, 28, 0 },
+	{ 2472, 28, 0 },
+};
+
+u_int16_t	turbo2WMaxPower5 = 32;
+u_int16_t	turbo2WMaxPower2;
+int8_t		antennaGainMax[2] = { 0, 0 };	/* XXX */
+int		eeversion = AR_EEPROM_VER3_1;
+TRGT_POWER_ALL_MODES tpow = {
+	8, {
+	    { 22, 24, 28, 32, 5180 },
+	    { 22, 24, 28, 32, 5200 },
+	    { 22, 24, 28, 32, 5320 },
+	    { 26, 30, 34, 34, 5500 },
+	    { 26, 30, 34, 34, 5700 },
+	    { 20, 30, 34, 36, 5745 },
+	    { 20, 30, 34, 36, 5825 },
+	    { 20, 30, 34, 36, 5850 },
+	},
+	2, {
+	    { 23, 27, 31, 34, 2412 },
+	    { 23, 27, 31, 34, 2447 },
+	},
+	2, {
+	    { 36, 36, 36, 36, 2412 },
+	    { 36, 36, 36, 36, 2484 },
+	}
+};
+#define	numTargetPwr_11a	tpow.numTargetPwr_11a
+#define	trgtPwr_11a		tpow.trgtPwr_11a
+#define	numTargetPwr_11g	tpow.numTargetPwr_11g
+#define	trgtPwr_11g		tpow.trgtPwr_11g
+#define	numTargetPwr_11b	tpow.numTargetPwr_11b
+#define	trgtPwr_11b		tpow.trgtPwr_11b
+
+static HAL_BOOL
+getChannelEdges(struct ath_hal *ah, u_int16_t flags, u_int16_t *low, u_int16_t *high)
+{
+	struct ath_hal_private *ahp = AH_PRIVATE(ah);
+	HAL_CAPABILITIES *pCap = &ahp->ah_caps;
+
+	if (flags & CHANNEL_5GHZ) {
+		*low = pCap->halLow5GhzChan;
+		*high = pCap->halHigh5GhzChan;
+		return AH_TRUE;
+	}
+	if (flags & CHANNEL_2GHZ) {
+		*low = pCap->halLow2GhzChan;
+		*high = pCap->halHigh2GhzChan;
+		return AH_TRUE;
+	}
+	return AH_FALSE;
+}
+
+static u_int
+getWirelessModes(struct ath_hal *ah)
+{
+	u_int mode = 0;
+
+	if (Amode) {
+		mode = HAL_MODE_11A;
+		if (!turbo5Disable)
+			mode |= HAL_MODE_TURBO;
+	}
+	if (Bmode)
+		mode |= HAL_MODE_11B;
+	if (Gmode) {
+		mode |= HAL_MODE_11G;
+		if (!turbo2Disable) 
+			mode |= HAL_MODE_108G;
+	}
+	if (HT20mode)
+		mode |= HAL_MODE_11NG_HT20|HAL_MODE_11NA_HT20;
+	if (HT40mode)
+		mode |= HAL_MODE_11NG_HT40PLUS|HAL_MODE_11NA_HT40PLUS
+		     |  HAL_MODE_11NG_HT40MINUS|HAL_MODE_11NA_HT40MINUS
+		     ;
+	return mode;
+}
+
+/*
+ * Country/Region Codes from MS WINNLS.H
+ * Numbering from ISO 3166
+ */
+enum CountryCode {
+    CTRY_ALBANIA              = 8,       /* Albania */
+    CTRY_ALGERIA              = 12,      /* Algeria */
+    CTRY_ARGENTINA            = 32,      /* Argentina */
+    CTRY_ARMENIA              = 51,      /* Armenia */
+    CTRY_AUSTRALIA            = 36,      /* Australia */
+    CTRY_AUSTRIA              = 40,      /* Austria */
+    CTRY_AZERBAIJAN           = 31,      /* Azerbaijan */
+    CTRY_BAHRAIN              = 48,      /* Bahrain */
+    CTRY_BELARUS              = 112,     /* Belarus */
+    CTRY_BELGIUM              = 56,      /* Belgium */
+    CTRY_BELIZE               = 84,      /* Belize */
+    CTRY_BOLIVIA              = 68,      /* Bolivia */
+    CTRY_BRAZIL               = 76,      /* Brazil */
+    CTRY_BRUNEI_DARUSSALAM    = 96,      /* Brunei Darussalam */
+    CTRY_BULGARIA             = 100,     /* Bulgaria */
+    CTRY_CANADA               = 124,     /* Canada */
+    CTRY_CHILE                = 152,     /* Chile */
+    CTRY_CHINA                = 156,     /* People's Republic of China */
+    CTRY_COLOMBIA             = 170,     /* Colombia */
+    CTRY_COSTA_RICA           = 188,     /* Costa Rica */
+    CTRY_CROATIA              = 191,     /* Croatia */
+    CTRY_CYPRUS               = 196,
+    CTRY_CZECH                = 203,     /* Czech Republic */
+    CTRY_DENMARK              = 208,     /* Denmark */
+    CTRY_DOMINICAN_REPUBLIC   = 214,     /* Dominican Republic */
+    CTRY_ECUADOR              = 218,     /* Ecuador */
+    CTRY_EGYPT                = 818,     /* Egypt */
+    CTRY_EL_SALVADOR          = 222,     /* El Salvador */
+    CTRY_ESTONIA              = 233,     /* Estonia */
+    CTRY_FAEROE_ISLANDS       = 234,     /* Faeroe Islands */
+    CTRY_FINLAND              = 246,     /* Finland */
+    CTRY_FRANCE               = 250,     /* France */
+    CTRY_FRANCE2              = 255,     /* France2 */
+    CTRY_GEORGIA              = 268,     /* Georgia */
+    CTRY_GERMANY              = 276,     /* Germany */
+    CTRY_GREECE               = 300,     /* Greece */
+    CTRY_GSM                  = 843,     /* 900MHz/GSM */
+    CTRY_GUATEMALA            = 320,     /* Guatemala */
+    CTRY_HONDURAS             = 340,     /* Honduras */
+    CTRY_HONG_KONG            = 344,     /* Hong Kong S.A.R., P.R.C. */
+    CTRY_HUNGARY              = 348,     /* Hungary */
+    CTRY_ICELAND              = 352,     /* Iceland */
+    CTRY_INDIA                = 356,     /* India */
+    CTRY_INDONESIA            = 360,     /* Indonesia */
+    CTRY_IRAN                 = 364,     /* Iran */
+    CTRY_IRAQ                 = 368,     /* Iraq */
+    CTRY_IRELAND              = 372,     /* Ireland */
+    CTRY_ISRAEL               = 376,     /* Israel */
+    CTRY_ITALY                = 380,     /* Italy */
+    CTRY_JAMAICA              = 388,     /* Jamaica */
+    CTRY_JAPAN                = 392,     /* Japan */
+    CTRY_JAPAN1               = 393,     /* Japan (JP1) */
+    CTRY_JAPAN2               = 394,     /* Japan (JP0) */
+    CTRY_JAPAN3               = 395,     /* Japan (JP1-1) */
+    CTRY_JAPAN4               = 396,     /* Japan (JE1) */
+    CTRY_JAPAN5               = 397,     /* Japan (JE2) */
+    CTRY_JAPAN6               = 399,     /* Japan (JP6) */
+
+    CTRY_JAPAN7		      = 4007,	 /* Japan (J7) */
+    CTRY_JAPAN8		      = 4008,	 /* Japan (J8) */
+    CTRY_JAPAN9		      = 4009,	 /* Japan (J9) */
+
+    CTRY_JAPAN10	      = 4010,	 /* Japan (J10) */
+    CTRY_JAPAN11	      = 4011,	 /* Japan (J11) */
+    CTRY_JAPAN12	      = 4012,	 /* Japan (J12) */
+
+    CTRY_JAPAN13	      = 4013,	 /* Japan (J13) */
+    CTRY_JAPAN14	      = 4014,	 /* Japan (J14) */
+    CTRY_JAPAN15	      = 4015,	 /* Japan (J15) */
+
+    CTRY_JAPAN16	      = 4016,	 /* Japan (J16) */
+    CTRY_JAPAN17	      = 4017,	 /* Japan (J17) */
+    CTRY_JAPAN18	      = 4018,	 /* Japan (J18) */
+
+    CTRY_JAPAN19	      = 4019,	 /* Japan (J19) */
+    CTRY_JAPAN20	      = 4020,	 /* Japan (J20) */
+    CTRY_JAPAN21	      = 4021,	 /* Japan (J21) */
+
+    CTRY_JAPAN22	      = 4022,	 /* Japan (J22) */
+    CTRY_JAPAN23	      = 4023,	 /* Japan (J23) */
+    CTRY_JAPAN24	      = 4024,	 /* Japan (J24) */
+ 
+    CTRY_JORDAN               = 400,     /* Jordan */
+    CTRY_KAZAKHSTAN           = 398,     /* Kazakhstan */
+    CTRY_KENYA                = 404,     /* Kenya */
+    CTRY_KOREA_NORTH          = 408,     /* North Korea */
+    CTRY_KOREA_ROC            = 410,     /* South Korea */
+    CTRY_KOREA_ROC2           = 411,     /* South Korea */
+    CTRY_KOREA_ROC3           = 412,     /* South Korea */
+    CTRY_KUWAIT               = 414,     /* Kuwait */
+    CTRY_LATVIA               = 428,     /* Latvia */
+    CTRY_LEBANON              = 422,     /* Lebanon */
+    CTRY_LIBYA                = 434,     /* Libya */
+    CTRY_LIECHTENSTEIN        = 438,     /* Liechtenstein */
+    CTRY_LITHUANIA            = 440,     /* Lithuania */
+    CTRY_LUXEMBOURG           = 442,     /* Luxembourg */
+    CTRY_MACAU                = 446,     /* Macau */
+    CTRY_MACEDONIA            = 807,     /* the Former Yugoslav Republic of Macedonia */
+    CTRY_MALAYSIA             = 458,     /* Malaysia */
+    CTRY_MALTA		          = 470,	 /* Malta */
+    CTRY_MEXICO               = 484,     /* Mexico */
+    CTRY_MONACO               = 492,     /* Principality of Monaco */
+    CTRY_MOROCCO              = 504,     /* Morocco */
+    CTRY_NETHERLANDS          = 528,     /* Netherlands */
+    CTRY_NEW_ZEALAND          = 554,     /* New Zealand */
+    CTRY_NICARAGUA            = 558,     /* Nicaragua */
+    CTRY_NORWAY               = 578,     /* Norway */
+    CTRY_OMAN                 = 512,     /* Oman */
+    CTRY_PAKISTAN             = 586,     /* Islamic Republic of Pakistan */
+    CTRY_PANAMA               = 591,     /* Panama */
+    CTRY_PARAGUAY             = 600,     /* Paraguay */
+    CTRY_PERU                 = 604,     /* Peru */
+    CTRY_PHILIPPINES          = 608,     /* Republic of the Philippines */
+    CTRY_POLAND               = 616,     /* Poland */
+    CTRY_PORTUGAL             = 620,     /* Portugal */
+    CTRY_PUERTO_RICO          = 630,     /* Puerto Rico */
+    CTRY_QATAR                = 634,     /* Qatar */
+    CTRY_ROMANIA              = 642,     /* Romania */
+    CTRY_RUSSIA               = 643,     /* Russia */
+    CTRY_SAUDI_ARABIA         = 682,     /* Saudi Arabia */
+    CTRY_SINGAPORE            = 702,     /* Singapore */
+    CTRY_SLOVAKIA             = 703,     /* Slovak Republic */
+    CTRY_SLOVENIA             = 705,     /* Slovenia */
+    CTRY_SOUTH_AFRICA         = 710,     /* South Africa */
+    CTRY_SPAIN                = 724,     /* Spain */
+    CTRY_SWEDEN               = 752,     /* Sweden */
+    CTRY_SWITZERLAND          = 756,     /* Switzerland */
+    CTRY_SYRIA                = 760,     /* Syria */
+    CTRY_TAIWAN               = 158,     /* Taiwan */
+    CTRY_THAILAND             = 764,     /* Thailand */
+    CTRY_TRINIDAD_Y_TOBAGO    = 780,     /* Trinidad y Tobago */
+    CTRY_TUNISIA              = 788,     /* Tunisia */
+    CTRY_TURKEY               = 792,     /* Turkey */
+    CTRY_UAE                  = 784,     /* U.A.E. */
+    CTRY_UKRAINE              = 804,     /* Ukraine */
+    CTRY_UNITED_KINGDOM       = 826,     /* United Kingdom */
+    CTRY_UNITED_STATES        = 840,     /* United States */
+    CTRY_UNITED_STATES_FCC49  = 842,     /* United States (Public Safety)*/
+    CTRY_URUGUAY              = 858,     /* Uruguay */
+    CTRY_UZBEKISTAN           = 860,     /* Uzbekistan */
+    CTRY_VENEZUELA            = 862,     /* Venezuela */
+    CTRY_VIET_NAM             = 704,     /* Viet Nam */
+    CTRY_YEMEN                = 887,     /* Yemen */
+    CTRY_ZIMBABWE             = 716      /* Zimbabwe */
+};
+
+
+/* Enumerated Regulatory Domain Information 8 bit values indicate that
+ * the regdomain is really a pair of unitary regdomains.  12 bit values
+ * are the real unitary regdomains and are the only ones which have the
+ * frequency bitmasks and flags set.
+ */
+
+enum EnumRd {
+	/*
+	 * The following regulatory domain definitions are
+	 * found in the EEPROM. Each regulatory domain
+	 * can operate in either a 5GHz or 2.4GHz wireless mode or
+	 * both 5GHz and 2.4GHz wireless modes.
+	 * In general, the value holds no special
+	 * meaning and is used to decode into either specific
+	 * 2.4GHz or 5GHz wireless mode for that particular
+	 * regulatory domain.
+	 */
+	NO_ENUMRD	= 0x00,
+	NULL1_WORLD	= 0x03,		/* For 11b-only countries (no 11a allowed) */
+	NULL1_ETSIB	= 0x07,		/* Israel */
+	NULL1_ETSIC	= 0x08,
+	NULL1_GSM	= 0x09,		/* GSM-only operation */
+	FCC1_FCCA	= 0x10,		/* USA */
+	FCC1_WORLD	= 0x11,		/* Hong Kong */
+	FCC4_FCCA	= 0x12,		/* USA - Public Safety */
+
+	FCC2_FCCA	= 0x20,		/* Canada */
+	FCC2_WORLD	= 0x21,		/* Australia & HK */
+	FCC2_ETSIC	= 0x22,
+	FRANCE_RES	= 0x31,		/* Legacy France for OEM */
+	FCC3_FCCA	= 0x3A,		/* USA & Canada w/5470 band, 11h, DFS enabled */
+	FCC3_WORLD  = 0x3B,     /* USA & Canada w/5470 band, 11h, DFS enabled */
+
+	ETSI1_WORLD	= 0x37,
+	ETSI3_ETSIA	= 0x32,		/* France (optional) */
+	ETSI2_WORLD	= 0x35,		/* Hungary & others */
+	ETSI3_WORLD	= 0x36,		/* France & others */
+	ETSI4_WORLD	= 0x30,
+	ETSI4_ETSIC	= 0x38,
+	ETSI5_WORLD	= 0x39,
+	ETSI6_WORLD	= 0x34,		/* Bulgaria */
+	ETSI_RESERVED	= 0x33,		/* Reserved (Do not used) */
+
+	MKK1_MKKA	= 0x40,		/* Japan (JP1) */
+	MKK1_MKKB	= 0x41,		/* Japan (JP0) */
+	APL4_WORLD	= 0x42,		/* Singapore */
+	MKK2_MKKA	= 0x43,		/* Japan with 4.9G channels */
+	APL_RESERVED	= 0x44,		/* Reserved (Do not used)  */
+	APL2_WORLD	= 0x45,		/* Korea */
+	APL2_APLC	= 0x46,
+	APL3_WORLD	= 0x47,
+	MKK1_FCCA	= 0x48,		/* Japan (JP1-1) */
+	APL2_APLD	= 0x49,		/* Korea with 2.3G channels */
+	MKK1_MKKA1	= 0x4A,		/* Japan (JE1) */
+	MKK1_MKKA2	= 0x4B,		/* Japan (JE2) */
+	MKK1_MKKC	= 0x4C,		/* Japan (MKK1_MKKA,except Ch14) */
+
+	APL3_FCCA   = 0x50,
+	APL1_WORLD	= 0x52,		/* Latin America */
+	APL1_FCCA	= 0x53,
+	APL1_APLA	= 0x54,
+	APL1_ETSIC	= 0x55,
+	APL2_ETSIC	= 0x56,		/* Venezuela */
+	APL5_WORLD	= 0x58,		/* Chile */
+	APL6_WORLD	= 0x5B,		/* Singapore */
+	APL7_FCCA   = 0x5C,     /* Taiwan 5.47 Band */
+	APL8_WORLD  = 0x5D,     /* Malaysia 5GHz */
+	APL9_WORLD  = 0x5E,     /* Korea 5GHz */
+
+	/*
+	 * World mode SKUs
+	 */
+	WOR0_WORLD	= 0x60,		/* World0 (WO0 SKU) */
+	WOR1_WORLD	= 0x61,		/* World1 (WO1 SKU) */
+	WOR2_WORLD	= 0x62,		/* World2 (WO2 SKU) */
+	WOR3_WORLD	= 0x63,		/* World3 (WO3 SKU) */
+	WOR4_WORLD	= 0x64,		/* World4 (WO4 SKU) */	
+	WOR5_ETSIC	= 0x65,		/* World5 (WO5 SKU) */    
+
+	WOR01_WORLD	= 0x66,		/* World0-1 (WW0-1 SKU) */
+	WOR02_WORLD	= 0x67,		/* World0-2 (WW0-2 SKU) */
+	EU1_WORLD	= 0x68,		/* Same as World0-2 (WW0-2 SKU), except active scan ch1-13. No ch14 */
+
+	WOR9_WORLD	= 0x69,		/* World9 (WO9 SKU) */	
+	WORA_WORLD	= 0x6A,		/* WorldA (WOA SKU) */	
+
+	MKK3_MKKB	= 0x80,		/* Japan UNI-1 even + MKKB */
+	MKK3_MKKA2	= 0x81,		/* Japan UNI-1 even + MKKA2 */
+	MKK3_MKKC	= 0x82,		/* Japan UNI-1 even + MKKC */
+
+	MKK4_MKKB	= 0x83,		/* Japan UNI-1 even + UNI-2 + MKKB */
+	MKK4_MKKA2	= 0x84,		/* Japan UNI-1 even + UNI-2 + MKKA2 */
+	MKK4_MKKC	= 0x85,		/* Japan UNI-1 even + UNI-2 + MKKC */
+
+	MKK5_MKKB	= 0x86,		/* Japan UNI-1 even + UNI-2 + mid-band + MKKB */
+	MKK5_MKKA2	= 0x87,		/* Japan UNI-1 even + UNI-2 + mid-band + MKKA2 */
+	MKK5_MKKC	= 0x88,		/* Japan UNI-1 even + UNI-2 + mid-band + MKKC */
+
+	MKK6_MKKB	= 0x89,		/* Japan UNI-1 even + UNI-1 odd MKKB */
+	MKK6_MKKA2	= 0x8A,		/* Japan UNI-1 even + UNI-1 odd + MKKA2 */
+	MKK6_MKKC	= 0x8B,		/* Japan UNI-1 even + UNI-1 odd + MKKC */
+
+	MKK7_MKKB	= 0x8C,		/* Japan UNI-1 even + UNI-1 odd + UNI-2 + MKKB */
+	MKK7_MKKA2	= 0x8D,		/* Japan UNI-1 even + UNI-1 odd + UNI-2 + MKKA2 */
+	MKK7_MKKC	= 0x8E,		/* Japan UNI-1 even + UNI-1 odd + UNI-2 + MKKC */
+
+	MKK8_MKKB	= 0x8F,		/* Japan UNI-1 even + UNI-1 odd + UNI-2 + mid-band + MKKB */
+	MKK8_MKKA2	= 0x90,		/* Japan UNI-1 even + UNI-1 odd + UNI-2 + mid-band + MKKA2 */
+	MKK8_MKKC	= 0x91,		/* Japan UNI-1 even + UNI-1 odd + UNI-2 + mid-band + MKKC */
+
+	/* Following definitions are used only by s/w to map old
+ 	 * Japan SKUs.
+	 */
+	MKK3_MKKA       = 0xF0,         /* Japan UNI-1 even + MKKA */
+	MKK3_MKKA1      = 0xF1,         /* Japan UNI-1 even + MKKA1 */
+	MKK3_FCCA       = 0xF2,         /* Japan UNI-1 even + FCCA */
+	MKK4_MKKA       = 0xF3,         /* Japan UNI-1 even + UNI-2 + MKKA */
+	MKK4_MKKA1      = 0xF4,         /* Japan UNI-1 even + UNI-2 + MKKA1 */
+	MKK4_FCCA       = 0xF5,         /* Japan UNI-1 even + UNI-2 + FCCA */
+	MKK9_MKKA       = 0xF6,         /* Japan UNI-1 even + 4.9GHz */
+	MKK10_MKKA      = 0xF7,         /* Japan UNI-1 even + UNI-2 + 4.9GHz */
+
+	/*
+	 * Regulator domains ending in a number (e.g. APL1,
+	 * MK1, ETSI4, etc) apply to 5GHz channel and power
+	 * information.  Regulator domains ending in a letter
+	 * (e.g. APLA, FCCA, etc) apply to 2.4GHz channel and
+	 * power information.
+	 */
+	APL1		= 0x0150,	/* LAT & Asia */
+	APL2		= 0x0250,	/* LAT & Asia */
+	APL3		= 0x0350,	/* Taiwan */
+	APL4		= 0x0450,	/* Jordan */
+	APL5		= 0x0550,	/* Chile */
+	APL6		= 0x0650,	/* Singapore */
+	APL8		= 0x0850,	/* Malaysia */
+	APL9		= 0x0950,	/* Korea (South) ROC 3 */
+
+	ETSI1		= 0x0130,	/* Europe & others */
+	ETSI2		= 0x0230,	/* Europe & others */
+	ETSI3		= 0x0330,	/* Europe & others */
+	ETSI4		= 0x0430,	/* Europe & others */
+	ETSI5		= 0x0530,	/* Europe & others */
+	ETSI6		= 0x0630,	/* Europe & others */
+	ETSIA		= 0x0A30,	/* France */
+	ETSIB		= 0x0B30,	/* Israel */
+	ETSIC		= 0x0C30,	/* Latin America */
+
+	FCC1		= 0x0110,	/* US & others */
+	FCC2		= 0x0120,	/* Canada, Australia & New Zealand */
+	FCC3		= 0x0160,	/* US w/new middle band & DFS */    
+	FCC4          	= 0x0165,     	/* US Public Safety */
+	FCCA		= 0x0A10,	 
+
+	APLD		= 0x0D50,	/* South Korea */
+
+	MKK1		= 0x0140,	/* Japan (UNI-1 odd)*/
+	MKK2		= 0x0240,	/* Japan (4.9 GHz + UNI-1 odd) */
+	MKK3		= 0x0340,	/* Japan (UNI-1 even) */
+	MKK4		= 0x0440,	/* Japan (UNI-1 even + UNI-2) */
+	MKK5		= 0x0540,	/* Japan (UNI-1 even + UNI-2 + mid-band) */
+	MKK6		= 0x0640,	/* Japan (UNI-1 odd + UNI-1 even) */
+	MKK7		= 0x0740,	/* Japan (UNI-1 odd + UNI-1 even + UNI-2 */
+	MKK8		= 0x0840,	/* Japan (UNI-1 odd + UNI-1 even + UNI-2 + mid-band) */
+	MKK9            = 0x0940,       /* Japan (UNI-1 even + 4.9 GHZ) */
+	MKK10           = 0x0B40,       /* Japan (UNI-1 even + UNI-2 + 4.9 GHZ) */
+	MKKA		= 0x0A40,	/* Japan */
+	MKKC		= 0x0A50,
+
+	NULL1		= 0x0198,
+	WORLD		= 0x0199,
+	GSM		= 0x019a,
+	DEBUG_REG_DMN	= 0x01ff,
+};
+#define DEF_REGDMN		FCC1_FCCA
+
+static struct {
+	const char *name;
+	HAL_REG_DOMAIN rd;
+} domains[] = {
+#define	D(_x)	{ #_x, _x }
+	D(NO_ENUMRD),
+	D(NULL1_WORLD),		/* For 11b-only countries (no 11a allowed) */
+	D(NULL1_ETSIB),		/* Israel */
+	D(NULL1_ETSIC),
+	D(NULL1_GSM),		/* GSM-only operation */
+	D(FCC1_FCCA),		/* USA */
+	D(FCC1_WORLD),		/* Hong Kong */
+	D(FCC4_FCCA),		/* USA - Public Safety */
+
+	D(FCC2_FCCA),		/* Canada */
+	D(FCC2_WORLD),		/* Australia & HK */
+	D(FCC2_ETSIC),
+	D(FRANCE_RES),		/* Legacy France for OEM */
+	D(FCC3_FCCA),
+	D(FCC3_WORLD),
+
+	D(ETSI1_WORLD),
+	D(ETSI3_ETSIA),		/* France (optional) */
+	D(ETSI2_WORLD),		/* Hungary & others */
+	D(ETSI3_WORLD),		/* France & others */
+	D(ETSI4_WORLD),
+	D(ETSI4_ETSIC),
+	D(ETSI5_WORLD),
+	D(ETSI6_WORLD),		/* Bulgaria */
+	D(ETSI_RESERVED),		/* Reserved (Do not used) */
+
+	D(MKK1_MKKA),		/* Japan (JP1) */
+	D(MKK1_MKKB),		/* Japan (JP0) */
+	D(APL4_WORLD),		/* Singapore */
+	D(MKK2_MKKA),		/* Japan with 4.9G channels */
+	D(APL_RESERVED),		/* Reserved (Do not used)  */
+	D(APL2_WORLD),		/* Korea */
+	D(APL2_APLC),
+	D(APL3_WORLD),
+	D(MKK1_FCCA),		/* Japan (JP1-1) */
+	D(APL2_APLD),		/* Korea with 2.3G channels */
+	D(MKK1_MKKA1),		/* Japan (JE1) */
+	D(MKK1_MKKA2),		/* Japan (JE2) */
+	D(MKK1_MKKC),
+
+	D(APL3_FCCA),
+	D(APL1_WORLD),		/* Latin America */
+	D(APL1_FCCA),
+	D(APL1_APLA),
+	D(APL1_ETSIC),
+	D(APL2_ETSIC),		/* Venezuela */
+	D(APL5_WORLD),		/* Chile */
+	D(APL6_WORLD),		/* Singapore */
+	D(APL7_FCCA),     /* Taiwan 5.47 Band */
+	D(APL8_WORLD),     /* Malaysia 5GHz */
+	D(APL9_WORLD),     /* Korea 5GHz */
+
+	D(WOR0_WORLD),		/* World0 (WO0 SKU) */
+	D(WOR1_WORLD),		/* World1 (WO1 SKU) */
+	D(WOR2_WORLD),		/* World2 (WO2 SKU) */
+	D(WOR3_WORLD),		/* World3 (WO3 SKU) */
+	D(WOR4_WORLD),		/* World4 (WO4 SKU) */	
+	D(WOR5_ETSIC),		/* World5 (WO5 SKU) */    
+
+	D(WOR01_WORLD),		/* World0-1 (WW0-1 SKU) */
+	D(WOR02_WORLD),		/* World0-2 (WW0-2 SKU) */
+	D(EU1_WORLD),
+
+	D(WOR9_WORLD),		/* World9 (WO9 SKU) */	
+	D(WORA_WORLD),		/* WorldA (WOA SKU) */	
+
+	D(MKK3_MKKB),		/* Japan UNI-1 even + MKKB */
+	D(MKK3_MKKA2),		/* Japan UNI-1 even + MKKA2 */
+	D(MKK3_MKKC),		/* Japan UNI-1 even + MKKC */
+
+	D(MKK4_MKKB),		/* Japan UNI-1 even + UNI-2 + MKKB */
+	D(MKK4_MKKA2),		/* Japan UNI-1 even + UNI-2 + MKKA2 */
+	D(MKK4_MKKC),		/* Japan UNI-1 even + UNI-2 + MKKC */
+
+	D(MKK5_MKKB),		/* Japan UNI-1 even + UNI-2 + mid-band + MKKB */
+	D(MKK5_MKKA2),		/* Japan UNI-1 even + UNI-2 + mid-band + MKKA2 */
+	D(MKK5_MKKC),		/* Japan UNI-1 even + UNI-2 + mid-band + MKKC */
+
+	D(MKK6_MKKB),		/* Japan UNI-1 even + UNI-1 odd MKKB */
+	D(MKK6_MKKA2),		/* Japan UNI-1 even + UNI-1 odd + MKKA2 */
+	D(MKK6_MKKC),		/* Japan UNI-1 even + UNI-1 odd + MKKC */
+
+	D(MKK7_MKKB),		/* Japan UNI-1 even + UNI-1 odd + UNI-2 + MKKB */
+	D(MKK7_MKKA2),		/* Japan UNI-1 even + UNI-1 odd + UNI-2 + MKKA2 */
+	D(MKK7_MKKC),		/* Japan UNI-1 even + UNI-1 odd + UNI-2 + MKKC */
+
+	D(MKK8_MKKB),		/* Japan UNI-1 even + UNI-1 odd + UNI-2 + mid-band + MKKB */
+	D(MKK8_MKKA2),		/* Japan UNI-1 even + UNI-1 odd + UNI-2 + mid-band + MKKA2 */
+	D(MKK8_MKKC),		/* Japan UNI-1 even + UNI-1 odd + UNI-2 + mid-band + MKKC */
+
+	D(MKK3_MKKA),         /* Japan UNI-1 even + MKKA */
+	D(MKK3_MKKA1),         /* Japan UNI-1 even + MKKA1 */
+	D(MKK3_FCCA),         /* Japan UNI-1 even + FCCA */
+	D(MKK4_MKKA),         /* Japan UNI-1 even + UNI-2 + MKKA */
+	D(MKK4_MKKA1),         /* Japan UNI-1 even + UNI-2 + MKKA1 */
+	D(MKK4_FCCA),         /* Japan UNI-1 even + UNI-2 + FCCA */
+	D(MKK9_MKKA),         /* Japan UNI-1 even + 4.9GHz */
+	D(MKK10_MKKA),         /* Japan UNI-1 even + UNI-2 + 4.9GHz */
+
+	D(APL1),	/* LAT & Asia */
+	D(APL2),	/* LAT & Asia */
+	D(APL3),	/* Taiwan */
+	D(APL4),	/* Jordan */
+	D(APL5),	/* Chile */
+	D(APL6),	/* Singapore */
+	D(APL8),	/* Malaysia */
+	D(APL9),	/* Korea (South) ROC 3 */
+
+	D(ETSI1),	/* Europe & others */
+	D(ETSI2),	/* Europe & others */
+	D(ETSI3),	/* Europe & others */
+	D(ETSI4),	/* Europe & others */
+	D(ETSI5),	/* Europe & others */
+	D(ETSI6),	/* Europe & others */
+	D(ETSIA),	/* France */
+	D(ETSIB),	/* Israel */
+	D(ETSIC),	/* Latin America */
+
+	D(FCC1),	/* US & others */
+	D(FCC2),
+	D(FCC3),	/* US w/new middle band & DFS */    
+	D(FCC4),     	/* US Public Safety */
+	D(FCCA),	 
+
+	D(APLD),	/* South Korea */
+
+	D(MKK1),	/* Japan (UNI-1 odd)*/
+	D(MKK2),	/* Japan (4.9 GHz + UNI-1 odd) */
+	D(MKK3),	/* Japan (UNI-1 even) */
+	D(MKK4),	/* Japan (UNI-1 even + UNI-2) */
+	D(MKK5),	/* Japan (UNI-1 even + UNI-2 + mid-band) */
+	D(MKK6),	/* Japan (UNI-1 odd + UNI-1 even) */
+	D(MKK7),	/* Japan (UNI-1 odd + UNI-1 even + UNI-2 */
+	D(MKK8),	/* Japan (UNI-1 odd + UNI-1 even + UNI-2 + mid-band) */
+	D(MKK9),       /* Japan (UNI-1 even + 4.9 GHZ) */
+	D(MKK10),       /* Japan (UNI-1 even + UNI-2 + 4.9 GHZ) */
+	D(MKKA),	/* Japan */
+	D(MKKC),
+
+	D(NULL1),
+	D(WORLD),
+	D(GSM),
+	D(DEBUG_REG_DMN),
+#undef D
+};
+
+static HAL_BOOL
+rdlookup(const char *name, HAL_REG_DOMAIN *rd)
+{
+#define	N(a)	(sizeof(a)/sizeof(a[0]))
+	int i;
+
+	for (i = 0; i < N(domains); i++)
+		if (strcasecmp(domains[i].name, name) == 0) {
+			*rd = domains[i].rd;
+			return AH_TRUE;
+		}
+	return AH_FALSE;
+#undef N
+}
+
+static const char *
+getrdname(HAL_REG_DOMAIN rd)
+{
+#define	N(a)	(sizeof(a)/sizeof(a[0]))
+	int i;
+
+	for (i = 0; i < N(domains); i++)
+		if (domains[i].rd == rd)
+			return domains[i].name;
+	return NULL;
+#undef N
+}
+
+static void
+rdlist()
+{
+#define	N(a)	(sizeof(a)/sizeof(a[0]))
+	int i;
+
+	printf("\nRegulatory domains:\n\n");
+	for (i = 0; i < N(domains); i++)
+		printf("%-15s%s", domains[i].name,
+			((i+1)%5) == 0 ? "\n" : "");
+	printf("\n");
+#undef N
+}
+
+typedef struct {
+	HAL_CTRY_CODE	countryCode;	   
+	HAL_REG_DOMAIN	regDmnEnum;
+	const char*	isoName;
+	const char*	name;
+	HAL_BOOL	allow11g;
+	HAL_BOOL	allow11aTurbo;
+	HAL_BOOL	allow11gTurbo;
+	u_int16_t	outdoorChanStart;
+} COUNTRY_CODE_TO_ENUM_RD;
+ 
+#define	YES	AH_TRUE
+#define	NO	AH_FALSE
+/* Index into table to avoid DEBUG and NO COUNTRY SET entries */
+#define CTRY_ONLY_INDEX 2
+/*
+ * Country Code Table to Enumerated RD
+ */
+
+static COUNTRY_CODE_TO_ENUM_RD allCountries[] = {
+    {CTRY_DEBUG,       NO_ENUMRD,     "DB", "DEBUG", YES, YES, YES, 7000 },
+    {CTRY_DEFAULT,     DEF_REGDMN,    "NA", "NO_COUNTRY_SET", YES, YES, YES, 7000 },
+    {CTRY_ALBANIA,     NULL1_WORLD,   "AL", "ALBANIA",        YES, NO,  YES, 7000 },
+    {CTRY_ALGERIA,     NULL1_WORLD,   "DZ", "ALGERIA",        YES, NO,  YES, 7000 },
+    {CTRY_ARGENTINA,   APL3_WORLD,    "AR", "ARGENTINA",      NO,  NO,  NO,  7000 },
+    {CTRY_ARMENIA,     ETSI4_WORLD,   "AM", "ARMENIA",        YES, NO,  YES, 7000 },
+    {CTRY_AUSTRALIA,   FCC2_WORLD,    "AU", "AUSTRALIA",      YES, YES, YES, 7000 },
+    {CTRY_AUSTRIA,     ETSI1_WORLD,   "AT", "AUSTRIA",        YES, NO,  YES, 7000 },
+    {CTRY_AZERBAIJAN,  ETSI4_WORLD,   "AZ", "AZERBAIJAN",     YES, YES, YES, 7000 },
+    {CTRY_BAHRAIN,     APL6_WORLD,   "BH", "BAHRAIN",        YES, NO,  YES, 7000 },
+    {CTRY_BELARUS,     NULL1_WORLD,   "BY", "BELARUS",        YES, NO,  YES, 7000 },
+    {CTRY_BELGIUM,     ETSI1_WORLD,   "BE", "BELGIUM",        YES, NO,  YES, 7000 },
+    {CTRY_BELIZE,      APL1_ETSIC,    "BZ", "BELIZE",         YES, YES, YES, 7000 },
+    {CTRY_BOLIVIA,     APL1_ETSIC,    "BO", "BOLVIA",         YES, YES, YES, 7000 },
+    {CTRY_BRAZIL,      FCC3_WORLD,    "BR", "BRAZIL",         YES,  NO,  NO, 7000 },
+    {CTRY_BRUNEI_DARUSSALAM,APL1_WORLD,"BN", "BRUNEI DARUSSALAM", YES, YES, YES, 7000 },
+    {CTRY_BULGARIA,    ETSI6_WORLD,   "BG", "BULGARIA",       YES, NO,  YES, 7000 },
+    {CTRY_CANADA,      FCC2_FCCA,     "CA", "CANADA",         YES, YES, YES, 7000 },
+    {CTRY_CHILE,       APL6_WORLD,    "CL", "CHILE",          YES, YES, YES, 7000 },
+    {CTRY_CHINA,       APL1_WORLD,    "CN", "CHINA",          YES, YES, YES, 7000 },
+    {CTRY_COLOMBIA,    FCC1_FCCA,     "CO", "COLOMBIA",       YES, NO,  YES, 7000 },

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-head mailing list