svn commit: r219394 - head/sys/dev/ath/ath_hal
Adrian Chadd
adrian at FreeBSD.org
Tue Mar 8 07:42:09 UTC 2011
Author: adrian
Date: Tue Mar 8 07:42:09 2011
New Revision: 219394
URL: http://svn.freebsd.org/changeset/base/219394
Log:
Break out the ath regulatory domain structures into a separate header file.
Added:
head/sys/dev/ath/ath_hal/ah_regdomain.h (contents, props changed)
Modified:
head/sys/dev/ath/ath_hal/ah_regdomain.c
Modified: head/sys/dev/ath/ath_hal/ah_regdomain.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ah_regdomain.c Tue Mar 8 06:59:59 2011 (r219393)
+++ head/sys/dev/ath/ath_hal/ah_regdomain.c Tue Mar 8 07:42:09 2011 (r219394)
@@ -28,6 +28,8 @@
#include "ah_eeprom.h"
#include "ah_devid.h"
+#include "ah_regdomain.h"
+
/*
* XXX this code needs a audit+review
*/
@@ -44,9 +46,7 @@
* definition that's used to setup initializers. See also further
* comments below.
*/
-#define BMLEN 2 /* 2 x 64 bits in each channel bitmask */
-typedef uint64_t chanbmask_t[BMLEN];
-
+/* BMLEN is now defined in ah_regdomain.h */
#define W0(_a) \
(((_a) >= 0 && (_a) < 64 ? (((uint64_t) 1)<<(_a)) : (uint64_t) 0))
#define W1(_a) \
@@ -314,25 +314,6 @@ enum {
* THE following table is the mapping of regdomain pairs specified by
* an 8 bit regdomain value to the individual unitary reg domains
*/
-typedef struct regDomainPair {
- HAL_REG_DOMAIN regDmnEnum; /* 16 bit reg domain pair */
- HAL_REG_DOMAIN regDmn5GHz; /* 5GHz reg domain */
- HAL_REG_DOMAIN regDmn2GHz; /* 2GHz reg domain */
- uint32_t flags5GHz; /* Requirements flags (AdHoc
- disallow, noise floor cal needed,
- etc) */
- uint32_t flags2GHz; /* Requirements flags (AdHoc
- disallow, noise floor cal needed,
- etc) */
- uint64_t pscanMask; /* Passive Scan flags which
- can override unitary domain
- passive scan flags. This
- value is used as a mask on
- the unitary flags*/
- uint16_t singleCC; /* Country code of single country if
- a one-on-one mapping exists */
-} REG_DMN_PAIR_MAPPING;
-
static REG_DMN_PAIR_MAPPING regDomainPairs[] = {
{NO_ENUMRD, DEBUG_REG_DMN, DEBUG_REG_DMN, NO_REQ, NO_REQ, PSCAN_DEFER, CTRY_DEFAULT },
{NULL1_WORLD, NULL1, WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, CTRY_DEFAULT },
@@ -446,11 +427,6 @@ static REG_DMN_PAIR_MAPPING regDomainPai
#define COUNTRY_ERD_FLAG 0x8000
#define WORLDWIDE_ROAMING_FLAG 0x4000
-typedef struct {
- HAL_CTRY_CODE countryCode;
- HAL_REG_DOMAIN regDmnEnum;
-} COUNTRY_CODE_TO_ENUM_RD;
-
static COUNTRY_CODE_TO_ENUM_RD allCountries[] = {
{ CTRY_DEBUG, NO_ENUMRD },
{ CTRY_DEFAULT, DEF_REGDMN },
@@ -614,21 +590,6 @@ enum {
* function so the compiler checks for duplicates.
*/
-typedef struct {
- uint16_t lowChannel; /* Low channel center in MHz */
- uint16_t highChannel; /* High Channel center in MHz */
- uint8_t powerDfs; /* Max power (dBm) for channel
- range when using DFS */
- uint8_t antennaMax; /* Max allowed antenna gain */
- uint8_t channelBW; /* Bandwidth of the channel */
- uint8_t channelSep; /* Channel separation within
- the band */
- uint64_t useDfs; /* Use DFS in the RegDomain
- if corresponding bit is set */
- uint64_t usePassScan; /* Use Passive Scan in the RegDomain
- if corresponding bit is set */
-} REG_DMN_FREQ_BAND;
-
/*
* 5GHz 11A channel tags
*/
@@ -1009,25 +970,6 @@ static REG_DMN_FREQ_BAND regDmn2Ghz11gTu
#define T1_2512_2732 AFTER(T3_2437_2437)
};
-typedef struct regDomain {
- uint16_t regDmnEnum; /* value from EnumRd table */
- uint8_t conformanceTestLimit;
- uint32_t flags; /* Requirement flags (AdHoc disallow,
- noise floor cal needed, etc) */
- uint64_t dfsMask; /* DFS bitmask for 5Ghz tables */
- uint64_t pscan; /* Bitmask for passive scan */
- chanbmask_t chan11a; /* 11a channels */
- chanbmask_t chan11a_turbo; /* 11a static turbo channels */
- chanbmask_t chan11a_dyn_turbo; /* 11a dynamic turbo channels */
- chanbmask_t chan11a_half; /* 11a 1/2 width channels */
- chanbmask_t chan11a_quarter; /* 11a 1/4 width channels */
- chanbmask_t chan11b; /* 11b channels */
- chanbmask_t chan11g; /* 11g channels */
- chanbmask_t chan11g_turbo; /* 11g dynamic turbo channels */
- chanbmask_t chan11g_half; /* 11g 1/2 width channels */
- chanbmask_t chan11g_quarter; /* 11g 1/4 width channels */
-} REG_DOMAIN;
-
static REG_DOMAIN regDomains[] = {
{.regDmnEnum = DEBUG_REG_DMN,
@@ -1713,11 +1655,6 @@ static REG_DOMAIN regDomains[] = {
}
};
-struct cmode {
- u_int mode;
- u_int flags;
-};
-
static const struct cmode modes[] = {
{ HAL_MODE_TURBO, IEEE80211_CHAN_ST },
{ HAL_MODE_11A, IEEE80211_CHAN_A },
Added: head/sys/dev/ath/ath_hal/ah_regdomain.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/sys/dev/ath/ath_hal/ah_regdomain.h Tue Mar 8 07:42:09 2011 (r219394)
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
+ * Copyright (c) 2005-2006 Atheros Communications, Inc.
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * $FreeBSD$
+ */
+#ifndef __AH_REGDOMAIN_H__
+#define __AH_REGDOMAIN_H__
+
+/*
+ * BMLEN defines the size of the bitmask used to hold frequency
+ * band specifications. Note this must agree with the BM macro
+ * definition that's used to setup initializers. See also further
+ * comments below.
+ */
+#define BMLEN 2 /* 2 x 64 bits in each channel bitmask */
+typedef uint64_t chanbmask_t[BMLEN];
+
+/*
+ * THE following table is the mapping of regdomain pairs specified by
+ * an 8 bit regdomain value to the individual unitary reg domains
+ */
+typedef struct regDomainPair {
+ HAL_REG_DOMAIN regDmnEnum; /* 16 bit reg domain pair */
+ HAL_REG_DOMAIN regDmn5GHz; /* 5GHz reg domain */
+ HAL_REG_DOMAIN regDmn2GHz; /* 2GHz reg domain */
+ uint32_t flags5GHz; /* Requirements flags (AdHoc
+ disallow, noise floor cal needed,
+ etc) */
+ uint32_t flags2GHz; /* Requirements flags (AdHoc
+ disallow, noise floor cal needed,
+ etc) */
+ uint64_t pscanMask; /* Passive Scan flags which
+ can override unitary domain
+ passive scan flags. This
+ value is used as a mask on
+ the unitary flags*/
+ uint16_t singleCC; /* Country code of single country if
+ a one-on-one mapping exists */
+} REG_DMN_PAIR_MAPPING;
+
+typedef struct {
+ HAL_CTRY_CODE countryCode;
+ HAL_REG_DOMAIN regDmnEnum;
+} COUNTRY_CODE_TO_ENUM_RD;
+
+/*
+ * Frequency band collections are defined using bitmasks. Each bit
+ * in a mask is the index of an entry in one of the following tables.
+ * Bitmasks are BMLEN*64 bits so if a table grows beyond that the bit
+ * vectors must be enlarged or the tables split somehow (e.g. split
+ * 1/2 and 1/4 rate channels into a separate table).
+ *
+ * Beware of ordering; the indices are defined relative to the preceding
+ * entry so if things get off there will be confusion. A good way to
+ * check the indices is to collect them in a switch statement in a stub
+ * function so the compiler checks for duplicates.
+ */
+typedef struct {
+ uint16_t lowChannel; /* Low channel center in MHz */
+ uint16_t highChannel; /* High Channel center in MHz */
+ uint8_t powerDfs; /* Max power (dBm) for channel
+ range when using DFS */
+ uint8_t antennaMax; /* Max allowed antenna gain */
+ uint8_t channelBW; /* Bandwidth of the channel */
+ uint8_t channelSep; /* Channel separation within
+ the band */
+ uint64_t useDfs; /* Use DFS in the RegDomain
+ if corresponding bit is set */
+ uint64_t usePassScan; /* Use Passive Scan in the RegDomain
+ if corresponding bit is set */
+} REG_DMN_FREQ_BAND;
+
+typedef struct regDomain {
+ uint16_t regDmnEnum; /* value from EnumRd table */
+ uint8_t conformanceTestLimit;
+ uint32_t flags; /* Requirement flags (AdHoc disallow,
+ noise floor cal needed, etc) */
+ uint64_t dfsMask; /* DFS bitmask for 5Ghz tables */
+ uint64_t pscan; /* Bitmask for passive scan */
+ chanbmask_t chan11a; /* 11a channels */
+ chanbmask_t chan11a_turbo; /* 11a static turbo channels */
+ chanbmask_t chan11a_dyn_turbo; /* 11a dynamic turbo channels */
+ chanbmask_t chan11a_half; /* 11a 1/2 width channels */
+ chanbmask_t chan11a_quarter; /* 11a 1/4 width channels */
+ chanbmask_t chan11b; /* 11b channels */
+ chanbmask_t chan11g; /* 11g channels */
+ chanbmask_t chan11g_turbo; /* 11g dynamic turbo channels */
+ chanbmask_t chan11g_half; /* 11g 1/2 width channels */
+ chanbmask_t chan11g_quarter; /* 11g 1/4 width channels */
+} REG_DOMAIN;
+
+struct cmode {
+ u_int mode;
+ u_int flags;
+};
+#endif
More information about the svn-src-head
mailing list