~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to drivers/staging/brcm80211/sys/wlc_channel.h

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (c) 2010 Broadcom Corporation
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 ANY
11
 
 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12
 
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13
 
 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14
 
 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15
 
 */
16
 
 
17
 
#ifndef _WLC_CHANNEL_H_
18
 
#define _WLC_CHANNEL_H_
19
 
 
20
 
#include <wlc_phy_hal.h>
21
 
 
22
 
#define WLC_TXPWR_DB_FACTOR 4   /* conversion for phy txpwr cacluations that use .25 dB units */
23
 
 
24
 
struct wlc_info;
25
 
 
26
 
/* maxpwr mapping to 5GHz band channels:
27
 
 * maxpwr[0] - channels [34-48]
28
 
 * maxpwr[1] - channels [52-60]
29
 
 * maxpwr[2] - channels [62-64]
30
 
 * maxpwr[3] - channels [100-140]
31
 
 * maxpwr[4] - channels [149-165]
32
 
 */
33
 
#define BAND_5G_PWR_LVLS        5       /* 5 power levels for 5G */
34
 
 
35
 
/* power level in group of 2.4GHz band channels:
36
 
 * maxpwr[0] - CCK  channels [1]
37
 
 * maxpwr[1] - CCK  channels [2-10]
38
 
 * maxpwr[2] - CCK  channels [11-14]
39
 
 * maxpwr[3] - OFDM channels [1]
40
 
 * maxpwr[4] - OFDM channels [2-10]
41
 
 * maxpwr[5] - OFDM channels [11-14]
42
 
 */
43
 
 
44
 
/* macro to get 2.4 GHz channel group index for tx power */
45
 
#define CHANNEL_POWER_IDX_2G_CCK(c) (((c) < 2) ? 0 : (((c) < 11) ? 1 : 2))      /* cck index */
46
 
#define CHANNEL_POWER_IDX_2G_OFDM(c) (((c) < 2) ? 3 : (((c) < 11) ? 4 : 5))     /* ofdm index */
47
 
 
48
 
/* macro to get 5 GHz channel group index for tx power */
49
 
#define CHANNEL_POWER_IDX_5G(c) \
50
 
        (((c) < 52) ? 0 : (((c) < 62) ? 1 : (((c) < 100) ? 2 : (((c) < 149) ? 3 : 4))))
51
 
 
52
 
#define WLC_MAXPWR_TBL_SIZE             6       /* max of BAND_5G_PWR_LVLS and 6 for 2.4 GHz */
53
 
#define WLC_MAXPWR_MIMO_TBL_SIZE        14      /* max of BAND_5G_PWR_LVLS and 14 for 2.4 GHz */
54
 
 
55
 
/* locale channel and power info. */
56
 
typedef struct {
57
 
        u32 valid_channels;
58
 
        u8 radar_channels;      /* List of radar sensitive channels */
59
 
        u8 restricted_channels; /* List of channels used only if APs are detected */
60
 
        s8 maxpwr[WLC_MAXPWR_TBL_SIZE]; /* Max tx pwr in qdBm for each sub-band */
61
 
        s8 pub_maxpwr[BAND_5G_PWR_LVLS];        /* Country IE advertised max tx pwr in dBm
62
 
                                                 * per sub-band
63
 
                                                 */
64
 
        u8 flags;
65
 
} locale_info_t;
66
 
 
67
 
/* bits for locale_info flags */
68
 
#define WLC_PEAK_CONDUCTED      0x00    /* Peak for locals */
69
 
#define WLC_EIRP                0x01    /* Flag for EIRP */
70
 
#define WLC_DFS_TPC             0x02    /* Flag for DFS TPC */
71
 
#define WLC_NO_OFDM             0x04    /* Flag for No OFDM */
72
 
#define WLC_NO_40MHZ            0x08    /* Flag for No MIMO 40MHz */
73
 
#define WLC_NO_MIMO             0x10    /* Flag for No MIMO, 20 or 40 MHz */
74
 
#define WLC_RADAR_TYPE_EU       0x20    /* Flag for EU */
75
 
#define WLC_DFS_FCC             WLC_DFS_TPC     /* Flag for DFS FCC */
76
 
#define WLC_DFS_EU              (WLC_DFS_TPC | WLC_RADAR_TYPE_EU)       /* Flag for DFS EU */
77
 
 
78
 
#define ISDFS_EU(fl)            (((fl) & WLC_DFS_EU) == WLC_DFS_EU)
79
 
 
80
 
/* locale per-channel tx power limits for MIMO frames
81
 
 * maxpwr arrays are index by channel for 2.4 GHz limits, and
82
 
 * by sub-band for 5 GHz limits using CHANNEL_POWER_IDX_5G(channel)
83
 
 */
84
 
typedef struct {
85
 
        s8 maxpwr20[WLC_MAXPWR_MIMO_TBL_SIZE];  /* tx 20 MHz power limits, qdBm units */
86
 
        s8 maxpwr40[WLC_MAXPWR_MIMO_TBL_SIZE];  /* tx 40 MHz power limits, qdBm units */
87
 
        u8 flags;
88
 
} locale_mimo_info_t;
89
 
 
90
 
extern const chanvec_t chanvec_all_2G;
91
 
extern const chanvec_t chanvec_all_5G;
92
 
 
93
 
/*
94
 
 * Country names and abbreviations with locale defined from ISO 3166
95
 
 */
96
 
struct country_info {
97
 
        const u8 locale_2G;     /* 2.4G band locale */
98
 
        const u8 locale_5G;     /* 5G band locale */
99
 
        const u8 locale_mimo_2G;        /* 2.4G mimo info */
100
 
        const u8 locale_mimo_5G;        /* 5G mimo info */
101
 
};
102
 
 
103
 
typedef struct country_info country_info_t;
104
 
 
105
 
typedef struct wlc_cm_info wlc_cm_info_t;
106
 
 
107
 
extern wlc_cm_info_t *wlc_channel_mgr_attach(struct wlc_info *wlc);
108
 
extern void wlc_channel_mgr_detach(wlc_cm_info_t *wlc_cm);
109
 
 
110
 
extern int wlc_set_countrycode(wlc_cm_info_t *wlc_cm, const char *ccode);
111
 
extern int wlc_set_countrycode_rev(wlc_cm_info_t *wlc_cm,
112
 
                                   const char *country_abbrev,
113
 
                                   const char *ccode, int regrev);
114
 
 
115
 
extern const char *wlc_channel_country_abbrev(wlc_cm_info_t *wlc_cm);
116
 
extern u8 wlc_channel_locale_flags(wlc_cm_info_t *wlc_cm);
117
 
extern u8 wlc_channel_locale_flags_in_band(wlc_cm_info_t *wlc_cm,
118
 
                                              uint bandunit);
119
 
 
120
 
extern void wlc_quiet_channels_reset(wlc_cm_info_t *wlc_cm);
121
 
extern bool wlc_quiet_chanspec(wlc_cm_info_t *wlc_cm, chanspec_t chspec);
122
 
 
123
 
#define VALID_CHANNEL20_DB(wlc, val) wlc_valid_channel20_db((wlc)->cmi, val)
124
 
#define VALID_CHANNEL20_IN_BAND(wlc, bandunit, val) \
125
 
        wlc_valid_channel20_in_band((wlc)->cmi, bandunit, val)
126
 
#define VALID_CHANNEL20(wlc, val) wlc_valid_channel20((wlc)->cmi, val)
127
 
#define VALID_40CHANSPEC_IN_BAND(wlc, bandunit) wlc_valid_40chanspec_in_band((wlc)->cmi, bandunit)
128
 
 
129
 
extern bool wlc_valid_chanspec(wlc_cm_info_t *wlc_cm, chanspec_t chspec);
130
 
extern bool wlc_valid_chanspec_db(wlc_cm_info_t *wlc_cm, chanspec_t chspec);
131
 
extern bool wlc_valid_channel20_db(wlc_cm_info_t *wlc_cm, uint val);
132
 
extern bool wlc_valid_channel20_in_band(wlc_cm_info_t *wlc_cm, uint bandunit,
133
 
                                        uint val);
134
 
extern bool wlc_valid_channel20(wlc_cm_info_t *wlc_cm, uint val);
135
 
extern bool wlc_valid_40chanspec_in_band(wlc_cm_info_t *wlc_cm, uint bandunit);
136
 
 
137
 
extern void wlc_channel_reg_limits(wlc_cm_info_t *wlc_cm,
138
 
                                   chanspec_t chanspec,
139
 
                                   struct txpwr_limits *txpwr);
140
 
extern void wlc_channel_set_chanspec(wlc_cm_info_t *wlc_cm,
141
 
                                     chanspec_t chanspec,
142
 
                                     u8 local_constraint_qdbm);
143
 
extern int wlc_channel_set_txpower_limit(wlc_cm_info_t *wlc_cm,
144
 
                                         u8 local_constraint_qdbm);
145
 
 
146
 
extern const country_info_t *wlc_country_lookup(struct wlc_info *wlc,
147
 
                                                const char *ccode);
148
 
extern void wlc_locale_get_channels(const locale_info_t *locale,
149
 
                                    chanvec_t *valid_channels);
150
 
extern const locale_info_t *wlc_get_locale_2g(u8 locale_idx);
151
 
extern const locale_info_t *wlc_get_locale_5g(u8 locale_idx);
152
 
extern bool wlc_japan(struct wlc_info *wlc);
153
 
 
154
 
extern u8 wlc_get_regclass(wlc_cm_info_t *wlc_cm, chanspec_t chanspec);
155
 
extern bool wlc_channel_get_chanvec(struct wlc_info *wlc,
156
 
                                    const char *country_abbrev, int bandtype,
157
 
                                    chanvec_t *channels);
158
 
 
159
 
#endif                          /* _WLC_CHANNEL_H */