CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
orangepi-xunlong

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: orangepi-xunlong/orangepi-build
Path: blob/next/external/cache/sources/wl/include/bcmwifi.h
Views: 3959
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 Open Broadcom Corporation$
7
*
8
* $Id: bcmwifi.h 374015 2012-12-11 08:55:11Z maheshd $
9
*/
10
11
#ifndef _bcmwifi_h_
12
#define _bcmwifi_h_
13
14
15
16
typedef uint16 chanspec_t;
17
18
19
#define CH_UPPER_SB 0x01
20
#define CH_LOWER_SB 0x02
21
#define CH_EWA_VALID 0x04
22
#define CH_20MHZ_APART 4
23
#define CH_10MHZ_APART 2
24
#define CH_5MHZ_APART 1
25
#define CH_MAX_2G_CHANNEL 14
26
#define WLC_MAX_2G_CHANNEL CH_MAX_2G_CHANNEL
27
#define MAXCHANNEL 224
28
#define CHSPEC_CTLOVLP(sp1, sp2, sep) \
29
(ABS(wf_chspec_ctlchan(sp1) - wf_chspec_ctlchan(sp2)) < (sep))
30
31
#define WL_CHANSPEC_CHAN_MASK 0x00ff
32
#define WL_CHANSPEC_CHAN_SHIFT 0
33
34
#define WL_CHANSPEC_CTL_SB_MASK 0x0300
35
#define WL_CHANSPEC_CTL_SB_SHIFT 8
36
#define WL_CHANSPEC_CTL_SB_LOWER 0x0100
37
#define WL_CHANSPEC_CTL_SB_UPPER 0x0200
38
#define WL_CHANSPEC_CTL_SB_NONE 0x0300
39
40
#define WL_CHANSPEC_BW_MASK 0x0C00
41
#define WL_CHANSPEC_BW_SHIFT 10
42
#define WL_CHANSPEC_BW_10 0x0400
43
#define WL_CHANSPEC_BW_20 0x0800
44
#define WL_CHANSPEC_BW_40 0x0C00
45
46
#define WL_CHANSPEC_BAND_MASK 0xf000
47
#define WL_CHANSPEC_BAND_SHIFT 12
48
#define WL_CHANSPEC_BAND_5G 0x1000
49
#define WL_CHANSPEC_BAND_2G 0x2000
50
#define INVCHANSPEC 255
51
52
53
#define WF_CHAN_FACTOR_2_4_G 4814
54
#define WF_CHAN_FACTOR_5_G 10000
55
#define WF_CHAN_FACTOR_4_G 8000
56
57
58
#define LOWER_20_SB(channel) (((channel) > CH_10MHZ_APART) ? ((channel) - CH_10MHZ_APART) : 0)
59
#define UPPER_20_SB(channel) (((channel) < (MAXCHANNEL - CH_10MHZ_APART)) ? \
60
((channel) + CH_10MHZ_APART) : 0)
61
#define CHSPEC_WLCBANDUNIT(chspec) (CHSPEC_IS5G(chspec) ? BAND_5G_INDEX : BAND_2G_INDEX)
62
#define CH20MHZ_CHSPEC(channel) (chanspec_t)((chanspec_t)(channel) | WL_CHANSPEC_BW_20 | \
63
WL_CHANSPEC_CTL_SB_NONE | (((channel) <= CH_MAX_2G_CHANNEL) ? \
64
WL_CHANSPEC_BAND_2G : WL_CHANSPEC_BAND_5G))
65
#define NEXT_20MHZ_CHAN(channel) (((channel) < (MAXCHANNEL - CH_20MHZ_APART)) ? \
66
((channel) + CH_20MHZ_APART) : 0)
67
#define CH40MHZ_CHSPEC(channel, ctlsb) (chanspec_t) \
68
((channel) | (ctlsb) | WL_CHANSPEC_BW_40 | \
69
((channel) <= CH_MAX_2G_CHANNEL ? WL_CHANSPEC_BAND_2G : \
70
WL_CHANSPEC_BAND_5G))
71
#define CHSPEC_CHANNEL(chspec) ((uint8)((chspec) & WL_CHANSPEC_CHAN_MASK))
72
#define CHSPEC_BAND(chspec) ((chspec) & WL_CHANSPEC_BAND_MASK)
73
74
75
#define CHSPEC_CTL_SB(chspec) ((chspec) & WL_CHANSPEC_CTL_SB_MASK)
76
#define CHSPEC_BW(chspec) ((chspec) & WL_CHANSPEC_BW_MASK)
77
78
#ifdef WL11N_20MHZONLY
79
80
#define CHSPEC_IS10(chspec) 0
81
#define CHSPEC_IS20(chspec) 1
82
#ifndef CHSPEC_IS40
83
#define CHSPEC_IS40(chspec) 0
84
#endif
85
86
#else
87
88
#define CHSPEC_IS10(chspec) (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_10)
89
#define CHSPEC_IS20(chspec) (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_20)
90
#ifndef CHSPEC_IS40
91
#define CHSPEC_IS40(chspec) (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_40)
92
#endif
93
94
#endif
95
96
#define CHSPEC_IS5G(chspec) (((chspec) & WL_CHANSPEC_BAND_MASK) == WL_CHANSPEC_BAND_5G)
97
#define CHSPEC_IS2G(chspec) (((chspec) & WL_CHANSPEC_BAND_MASK) == WL_CHANSPEC_BAND_2G)
98
#define CHSPEC_SB_NONE(chspec) (((chspec) & WL_CHANSPEC_CTL_SB_MASK) == WL_CHANSPEC_CTL_SB_NONE)
99
#define CHSPEC_SB_UPPER(chspec) (((chspec) & WL_CHANSPEC_CTL_SB_MASK) == WL_CHANSPEC_CTL_SB_UPPER)
100
#define CHSPEC_SB_LOWER(chspec) (((chspec) & WL_CHANSPEC_CTL_SB_MASK) == WL_CHANSPEC_CTL_SB_LOWER)
101
#define CHSPEC_CTL_CHAN(chspec) ((CHSPEC_SB_LOWER(chspec)) ? \
102
(LOWER_20_SB(((chspec) & WL_CHANSPEC_CHAN_MASK))) : \
103
(UPPER_20_SB(((chspec) & WL_CHANSPEC_CHAN_MASK))))
104
#define CHSPEC2WLC_BAND(chspec) (CHSPEC_IS5G(chspec) ? WLC_BAND_5G : WLC_BAND_2G)
105
106
#define CHANSPEC_STR_LEN 8
107
108
109
#define WLC_MAXRATE 108
110
#define WLC_RATE_1M 2
111
#define WLC_RATE_2M 4
112
#define WLC_RATE_5M5 11
113
#define WLC_RATE_11M 22
114
#define WLC_RATE_6M 12
115
#define WLC_RATE_9M 18
116
#define WLC_RATE_12M 24
117
#define WLC_RATE_18M 36
118
#define WLC_RATE_24M 48
119
#define WLC_RATE_36M 72
120
#define WLC_RATE_48M 96
121
#define WLC_RATE_54M 108
122
123
#define WLC_2G_25MHZ_OFFSET 5
124
125
126
extern char * wf_chspec_ntoa(chanspec_t chspec, char *buf);
127
128
129
extern chanspec_t wf_chspec_aton(char *a);
130
131
132
extern bool wf_chspec_malformed(chanspec_t chanspec);
133
134
135
extern uint8 wf_chspec_ctlchan(chanspec_t chspec);
136
137
138
extern chanspec_t wf_chspec_ctlchspec(chanspec_t chspec);
139
140
141
extern int wf_mhz2channel(uint freq, uint start_factor);
142
143
144
extern int wf_channel2mhz(uint channel, uint start_factor);
145
146
#endif
147
148