aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/bcmdhd/include/bcmwifi.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/bcmdhd/include/bcmwifi.h')
-rw-r--r--drivers/net/wireless/bcmdhd/include/bcmwifi.h165
1 files changed, 165 insertions, 0 deletions
diff --git a/drivers/net/wireless/bcmdhd/include/bcmwifi.h b/drivers/net/wireless/bcmdhd/include/bcmwifi.h
new file mode 100644
index 00000000000..45f3c0312dc
--- /dev/null
+++ b/drivers/net/wireless/bcmdhd/include/bcmwifi.h
@@ -0,0 +1,165 @@
1/*
2 * Misc utility routines for WL and Apps
3 * This header file housing the define and function prototype use by
4 * both the wl driver, tools & Apps.
5 *
6 * Copyright (C) 1999-2011, Broadcom Corporation
7 *
8 * Unless you and Broadcom execute a separate written software license
9 * agreement governing use of this software, this software is licensed to you
10 * under the terms of the GNU General Public License version 2 (the "GPL"),
11 * available at http://www.broadcom.com/licenses/GPLv2.php, with the
12 * following added to such license:
13 *
14 * As a special exception, the copyright holders of this software give you
15 * permission to link this software with independent modules, and to copy and
16 * distribute the resulting executable under terms of your choice, provided that
17 * you also meet, for each linked independent module, the terms and conditions of
18 * the license of that module. An independent module is a module which is not
19 * derived from this software. The special exception does not apply to any
20 * modifications of the software.
21 *
22 * Notwithstanding the above, under no circumstances may you combine this
23 * software in any way with any other Broadcom software provided under a license
24 * other than the GPL, without Broadcom's express prior written consent.
25 *
26 * $Id: bcmwifi.h,v 1.29.6.3 2010-08-03 17:47:04 Exp $
27 */
28
29
30#ifndef _bcmwifi_h_
31#define _bcmwifi_h_
32
33
34
35typedef uint16 chanspec_t;
36
37
38#define CH_UPPER_SB 0x01
39#define CH_LOWER_SB 0x02
40#define CH_EWA_VALID 0x04
41#define CH_20MHZ_APART 4
42#define CH_10MHZ_APART 2
43#define CH_5MHZ_APART 1
44#define CH_MAX_2G_CHANNEL 14
45#define WLC_MAX_2G_CHANNEL CH_MAX_2G_CHANNEL
46#define MAXCHANNEL 224
47
48#define WL_CHANSPEC_CHAN_MASK 0x00ff
49#define WL_CHANSPEC_CHAN_SHIFT 0
50
51#define WL_CHANSPEC_CTL_SB_MASK 0x0300
52#define WL_CHANSPEC_CTL_SB_SHIFT 8
53#define WL_CHANSPEC_CTL_SB_LOWER 0x0100
54#define WL_CHANSPEC_CTL_SB_UPPER 0x0200
55#define WL_CHANSPEC_CTL_SB_NONE 0x0300
56
57#define WL_CHANSPEC_BW_MASK 0x0C00
58#define WL_CHANSPEC_BW_SHIFT 10
59#define WL_CHANSPEC_BW_10 0x0400
60#define WL_CHANSPEC_BW_20 0x0800
61#define WL_CHANSPEC_BW_40 0x0C00
62
63#define WL_CHANSPEC_BAND_MASK 0xf000
64#define WL_CHANSPEC_BAND_SHIFT 12
65#define WL_CHANSPEC_BAND_5G 0x1000
66#define WL_CHANSPEC_BAND_2G 0x2000
67#define INVCHANSPEC 255
68
69
70#define WF_CHAN_FACTOR_2_4_G 4814
71#define WF_CHAN_FACTOR_5_G 10000
72#define WF_CHAN_FACTOR_4_G 8000
73
74
75#define LOWER_20_SB(channel) (((channel) > CH_10MHZ_APART) ? ((channel) - CH_10MHZ_APART) : 0)
76#define UPPER_20_SB(channel) (((channel) < (MAXCHANNEL - CH_10MHZ_APART)) ? \
77 ((channel) + CH_10MHZ_APART) : 0)
78#define CHSPEC_WLCBANDUNIT(chspec) (CHSPEC_IS5G(chspec) ? BAND_5G_INDEX : BAND_2G_INDEX)
79#define CH20MHZ_CHSPEC(channel) (chanspec_t)((chanspec_t)(channel) | WL_CHANSPEC_BW_20 | \
80 WL_CHANSPEC_CTL_SB_NONE | (((channel) <= CH_MAX_2G_CHANNEL) ? \
81 WL_CHANSPEC_BAND_2G : WL_CHANSPEC_BAND_5G))
82#define NEXT_20MHZ_CHAN(channel) (((channel) < (MAXCHANNEL - CH_20MHZ_APART)) ? \
83 ((channel) + CH_20MHZ_APART) : 0)
84#define CH40MHZ_CHSPEC(channel, ctlsb) (chanspec_t) \
85 ((channel) | (ctlsb) | WL_CHANSPEC_BW_40 | \
86 ((channel) <= CH_MAX_2G_CHANNEL ? WL_CHANSPEC_BAND_2G : \
87 WL_CHANSPEC_BAND_5G))
88#define CHSPEC_CHANNEL(chspec) ((uint8)((chspec) & WL_CHANSPEC_CHAN_MASK))
89#define CHSPEC_BAND(chspec) ((chspec) & WL_CHANSPEC_BAND_MASK)
90
91
92#define CHSPEC_CTL_SB(chspec) (chspec & WL_CHANSPEC_CTL_SB_MASK)
93#define CHSPEC_BW(chspec) (chspec & WL_CHANSPEC_BW_MASK)
94
95#ifdef WL11N_20MHZONLY
96
97#define CHSPEC_IS10(chspec) 0
98#define CHSPEC_IS20(chspec) 1
99#ifndef CHSPEC_IS40
100#define CHSPEC_IS40(chspec) 0
101#endif
102
103#else
104
105#define CHSPEC_IS10(chspec) (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_10)
106#define CHSPEC_IS20(chspec) (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_20)
107#ifndef CHSPEC_IS40
108#define CHSPEC_IS40(chspec) (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_40)
109#endif
110
111#endif
112
113#define CHSPEC_IS20_UNCOND(chspec) (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_20)
114
115#define CHSPEC_IS5G(chspec) (((chspec) & WL_CHANSPEC_BAND_MASK) == WL_CHANSPEC_BAND_5G)
116#define CHSPEC_IS2G(chspec) (((chspec) & WL_CHANSPEC_BAND_MASK) == WL_CHANSPEC_BAND_2G)
117#define CHSPEC_SB_NONE(chspec) (((chspec) & WL_CHANSPEC_CTL_SB_MASK) == WL_CHANSPEC_CTL_SB_NONE)
118#define CHSPEC_SB_UPPER(chspec) (((chspec) & WL_CHANSPEC_CTL_SB_MASK) == WL_CHANSPEC_CTL_SB_UPPER)
119#define CHSPEC_SB_LOWER(chspec) (((chspec) & WL_CHANSPEC_CTL_SB_MASK) == WL_CHANSPEC_CTL_SB_LOWER)
120#define CHSPEC_CTL_CHAN(chspec) ((CHSPEC_SB_LOWER(chspec)) ? \
121 (LOWER_20_SB(((chspec) & WL_CHANSPEC_CHAN_MASK))) : \
122 (UPPER_20_SB(((chspec) & WL_CHANSPEC_CHAN_MASK))))
123#define CHSPEC2WLC_BAND(chspec) (CHSPEC_IS5G(chspec) ? WLC_BAND_5G : WLC_BAND_2G)
124
125#define CHANSPEC_STR_LEN 8
126
127
128#define WLC_MAXRATE 108
129#define WLC_RATE_1M 2
130#define WLC_RATE_2M 4
131#define WLC_RATE_5M5 11
132#define WLC_RATE_11M 22
133#define WLC_RATE_6M 12
134#define WLC_RATE_9M 18
135#define WLC_RATE_12M 24
136#define WLC_RATE_18M 36
137#define WLC_RATE_24M 48
138#define WLC_RATE_36M 72
139#define WLC_RATE_48M 96
140#define WLC_RATE_54M 108
141
142#define WLC_2G_25MHZ_OFFSET 5
143
144
145extern char * wf_chspec_ntoa(chanspec_t chspec, char *buf);
146
147
148extern chanspec_t wf_chspec_aton(char *a);
149
150
151extern bool wf_chspec_malformed(chanspec_t chanspec);
152
153
154extern uint8 wf_chspec_ctlchan(chanspec_t chspec);
155
156
157extern chanspec_t wf_chspec_ctlchspec(chanspec_t chspec);
158
159
160extern int wf_mhz2channel(uint freq, uint start_factor);
161
162
163extern int wf_channel2mhz(uint channel, uint start_factor);
164
165#endif