本文整理汇总了C++中CHSPEC_CHANNEL函数的典型用法代码示例。如果您正苦于以下问题:C++ CHSPEC_CHANNEL函数的具体用法?C++ CHSPEC_CHANNEL怎么用?C++ CHSPEC_CHANNEL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CHSPEC_CHANNEL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wf_chspec_ctlchan
/*
* This function returns the channel number that control traffic is being sent on, for legacy
* channels this is just the channel number, for 40MHZ channels it is the upper or lowre 20MHZ
* sideband depending on the chanspec selected
*/
uint8
wf_chspec_ctlchan(chanspec_t chspec)
{
uint8 ctl_chan;
/* Is there a sideband ? */
if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_NONE) {
return CHSPEC_CHANNEL(chspec);
} else {
/* we only support 40MHZ with sidebands */
ASSERT(CHSPEC_BW(chspec) == WL_CHANSPEC_BW_40);
/* chanspec channel holds the centre frequency, use that and the
* side band information to reconstruct the control channel number
*/
if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_UPPER) {
/* control chan is the upper 20 MHZ SB of the 40MHZ channel */
ctl_chan = UPPER_20_SB(CHSPEC_CHANNEL(chspec));
} else {
ASSERT(CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_LOWER);
/* control chan is the lower 20 MHZ SB of the 40MHZ channel */
ctl_chan = LOWER_20_SB(CHSPEC_CHANNEL(chspec));
}
}
return ctl_chan;
}
示例2: wf_chspec_ctlchan
uint8
wf_chspec_ctlchan(chanspec_t chspec)
{
uint8 ctl_chan;
DHD_MYTRACE(("%s-%s\n", __FILE__, __FUNCTION__));
if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_NONE) {
return CHSPEC_CHANNEL(chspec);
} else {
ASSERT(CHSPEC_BW(chspec) == WL_CHANSPEC_BW_40);
if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_UPPER) {
ctl_chan = UPPER_20_SB(CHSPEC_CHANNEL(chspec));
} else {
ASSERT(CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_LOWER);
ctl_chan = LOWER_20_SB(CHSPEC_CHANNEL(chspec));
}
}
return ctl_chan;
}
示例3: add_roam_cache
void add_roam_cache(wl_bss_info_t *bi)
{
int i;
uint8 channel;
#if defined(CUSTOMER_HW4) && defined(WES_SUPPORT)
if (roamscan_mode == ROAMSCAN_MODE_WES)
return;
#endif
if (n_roam_cache >= MAX_ROAM_CACHE)
return;
for (i = 0; i < n_roam_cache; i++) {
if ((roam_cache[i].ssid_len == bi->SSID_len) &&
(roam_cache[i].chanspec == bi->chanspec) &&
(memcmp(roam_cache[i].ssid, bi->SSID, bi->SSID_len) == 0)) {
/* identical one found, just return */
return;
}
}
roam_cache[n_roam_cache].ssid_len = bi->SSID_len;
channel = (bi->ctl_ch == 0) ? CHSPEC_CHANNEL(bi->chanspec) : bi->ctl_ch;
WL_DBG(("CHSPEC 0x%X %d, CTL %d\n",
bi->chanspec, CHSPEC_CHANNEL(bi->chanspec), bi->ctl_ch));
roam_cache[n_roam_cache].chanspec =
(channel <= CH_MAX_2G_CHANNEL ? band2G : band5G) | band_bw | channel;
memcpy(roam_cache[n_roam_cache].ssid, bi->SSID, bi->SSID_len);
n_roam_cache++;
}
示例4: brcms_c_quiet_chanspec
static bool
brcms_c_quiet_chanspec(struct brcms_cm_info *wlc_cm, u16 chspec)
{
return (wlc_cm->wlc->pub->_n_enab & SUPPORT_11N) &&
CHSPEC_IS40(chspec) ?
(isset(wlc_cm->quiet_channels.vec,
lower_20_sb(CHSPEC_CHANNEL(chspec))) ||
isset(wlc_cm->quiet_channels.vec,
upper_20_sb(CHSPEC_CHANNEL(chspec)))) :
isset(wlc_cm->quiet_channels.vec, CHSPEC_CHANNEL(chspec));
}
示例5: wlc_quiet_chanspec
bool wlc_quiet_chanspec(wlc_cm_info_t *wlc_cm, chanspec_t chspec)
{
return N_ENAB(wlc_cm->wlc->pub) && CHSPEC_IS40(chspec) ?
(isset
(wlc_cm->quiet_channels.vec,
LOWER_20_SB(CHSPEC_CHANNEL(chspec)))
|| isset(wlc_cm->quiet_channels.vec,
UPPER_20_SB(CHSPEC_CHANNEL(chspec)))) : isset(wlc_cm->
quiet_channels.
vec,
CHSPEC_CHANNEL
(chspec));
}
示例6: spec_to_chan
static uint8
spec_to_chan(chanspec_t chspec)
{
switch (CHSPEC_CTL_SB(chspec)) {
case WL_CHANSPEC_CTL_SB_NONE:
return CHSPEC_CHANNEL(chspec);
case WL_CHANSPEC_CTL_SB_UPPER:
return UPPER_20_SB(CHSPEC_CHANNEL(chspec));
case WL_CHANSPEC_CTL_SB_LOWER:
return LOWER_20_SB(CHSPEC_CHANNEL(chspec));
default:
return 0;
}
}
示例7: add_roam_cache
void add_roam_cache(wl_bss_info_t *bi)
{
int i;
uint8 channel;
#if defined(CUSTOMER_HW4) && defined(WES_SUPPORT)
if (roamscan_mode)
return;
#endif
if (n_roam_cache == MAX_ROAM_CACHE)
return;
for (i = 0; i < n_roam_cache; i++) {
if ((roam_cache[i].ssid_len == bi->SSID_len) &&
(roam_cache[i].chanspec == bi->chanspec) &&
(memcmp(roam_cache[i].ssid, bi->SSID, bi->SSID_len) == 0)) {
/* identical one found, just return */
return;
}
}
roam_cache[n_roam_cache].ssid_len = bi->SSID_len;
channel = (bi->ctl_ch == 0) ? CHSPEC_CHANNEL(bi->chanspec) : bi->ctl_ch;
roam_cache[n_roam_cache].chanspec =
WL_CHANSPEC_BW_20 |
(channel <= 14 ? WL_CHANSPEC_BAND_2G : WL_CHANSPEC_BAND_5G) |
channel;
memcpy(roam_cache[n_roam_cache].ssid, bi->SSID, bi->SSID_len);
n_roam_cache++;
}
示例8: wf_chspec_ntoa
/* given a chanspec and a string buffer, format the chanspec as a
* string, and return the original pointer a.
* Min buffer length must be CHANSPEC_STR_LEN.
* On error return NULL
*/
char *
wf_chspec_ntoa(chanspec_t chspec, char *buf)
{
const char *band, *bw, *sb;
uint channel;
band = "";
bw = "";
sb = "";
channel = CHSPEC_CHANNEL(chspec);
/* check for non-default band spec */
if ((CHSPEC_IS2G(chspec) && channel > CH_MAX_2G_CHANNEL) ||
(CHSPEC_IS5G(chspec) && channel <= CH_MAX_2G_CHANNEL))
band = (CHSPEC_IS2G(chspec)) ? "b" : "a";
if (CHSPEC_IS40(chspec)) {
if (CHSPEC_SB_UPPER(chspec)) {
sb = "u";
channel += CH_10MHZ_APART;
} else {
sb = "l";
channel -= CH_10MHZ_APART;
}
} else if (CHSPEC_IS10(chspec)) {
bw = "n";
}
/* Outputs a max of 6 chars including '\0' */
snprintf(buf, 6, "%d%s%s%s", channel, band, bw, sb);
return (buf);
}
示例9: wf_chspec_ntoa
char *
wf_chspec_ntoa(chanspec_t chspec, char *buf)
{
const char *band, *bw, *sb;
uint channel;
DHD_MYTRACE(("%s-%s\n", __FILE__, __FUNCTION__));
band = "";
bw = "";
sb = "";
channel = CHSPEC_CHANNEL(chspec);
if ((CHSPEC_IS2G(chspec) && channel > CH_MAX_2G_CHANNEL) ||
(CHSPEC_IS5G(chspec) && channel <= CH_MAX_2G_CHANNEL))
band = (CHSPEC_IS2G(chspec)) ? "b" : "a";
if (CHSPEC_IS40(chspec)) {
if (CHSPEC_SB_UPPER(chspec)) {
sb = "u";
channel += CH_10MHZ_APART;
} else {
sb = "l";
channel -= CH_10MHZ_APART;
}
} else if (CHSPEC_IS10(chspec)) {
bw = "n";
}
snprintf(buf, 6, "%d%s%s%s", channel, band, bw, sb);
return (buf);
}
示例10: spec_to_chan
static uint8
spec_to_chan(chanspec_t chspec)
{
uint8 center_ch, edge, primary, sb;
center_ch = CHSPEC_CHANNEL(chspec);
if (CHSPEC_IS20(chspec)) {
return center_ch;
} else {
/* the lower edge of the wide channel is half the bw from
* the center channel.
*/
if (CHSPEC_IS40(chspec)) {
edge = center_ch - CH_20MHZ_APART;
} else {
/* must be 80MHz (until we support more) */
ASSERT(CHSPEC_IS80(chspec));
edge = center_ch - CH_40MHZ_APART;
}
/* find the channel number of the lowest 20MHz primary channel */
primary = edge + CH_10MHZ_APART;
/* select the actual subband */
sb = (chspec & WL_CHANSPEC_CTL_SB_MASK) >> WL_CHANSPEC_CTL_SB_SHIFT;
primary = primary + sb * CH_20MHZ_APART;
return primary;
}
}
示例11: wf_chspec_ntoa
/* given a chanspec and a string buffer, format the chanspec as a
* string, and return the original pointer a.
* Min buffer length must be CHANSPEC_STR_LEN.
* On error return NULL
*/
char *
wf_chspec_ntoa(chanspec_t chspec, char *buf)
{
const char *band;
uint ctl_chan;
if (wf_chspec_malformed(chspec))
return NULL;
band = "";
/* check for non-default band spec */
if ((CHSPEC_IS2G(chspec) && CHSPEC_CHANNEL(chspec) > CH_MAX_2G_CHANNEL) ||
(CHSPEC_IS5G(chspec) && CHSPEC_CHANNEL(chspec) <= CH_MAX_2G_CHANNEL))
band = (CHSPEC_IS2G(chspec)) ? "2g" : "5g";
/* ctl channel */
ctl_chan = wf_chspec_ctlchan(chspec);
/* bandwidth and ctl sideband */
if (CHSPEC_IS20(chspec)) {
snprintf(buf, CHANSPEC_STR_LEN, "%s%d", band, ctl_chan);
} else if (!CHSPEC_IS8080(chspec)) {
const char *bw;
const char *sb = "";
bw = wf_chspec_bw_str[(chspec & WL_CHANSPEC_BW_MASK) >> WL_CHANSPEC_BW_SHIFT];
#ifdef CHANSPEC_NEW_40MHZ_FORMAT
/* ctl sideband string if needed for 2g 40MHz */
if (CHSPEC_IS40(chspec) && CHSPEC_IS2G(chspec)) {
sb = CHSPEC_SB_UPPER(chspec) ? "u" : "l";
}
snprintf(buf, CHANSPEC_STR_LEN, "%s%d/%s%s", band, ctl_chan, bw, sb);
#else
/* ctl sideband string instead of BW for 40MHz */
if (CHSPEC_IS40(chspec)) {
sb = CHSPEC_SB_UPPER(chspec) ? "u" : "l";
snprintf(buf, CHANSPEC_STR_LEN, "%s%d%s", band, ctl_chan, sb);
} else {
snprintf(buf, CHANSPEC_STR_LEN, "%s%d/%s", band, ctl_chan, bw);
}
#endif /* CHANSPEC_NEW_40MHZ_FORMAT */
} else {
示例12: wf_chspec_ntoa
char *
wf_chspec_ntoa(chanspec_t chspec, char *buf)
{
const char *band;
uint ctl_chan;
if (wf_chspec_malformed(chspec))
return NULL;
band = "";
if ((CHSPEC_IS2G(chspec) && CHSPEC_CHANNEL(chspec) > CH_MAX_2G_CHANNEL) ||
(CHSPEC_IS5G(chspec) && CHSPEC_CHANNEL(chspec) <= CH_MAX_2G_CHANNEL))
band = (CHSPEC_IS2G(chspec)) ? "2g" : "5g";
ctl_chan = wf_chspec_ctlchan(chspec);
if (CHSPEC_IS20(chspec)) {
snprintf(buf, CHANSPEC_STR_LEN, "%s%d", band, ctl_chan);
} else if (!CHSPEC_IS8080(chspec)) {
const char *bw;
const char *sb = "";
bw = wf_chspec_bw_str[(chspec & WL_CHANSPEC_BW_MASK) >> WL_CHANSPEC_BW_SHIFT];
#ifdef CHANSPEC_NEW_40MHZ_FORMAT
if (CHSPEC_IS40(chspec) && CHSPEC_IS2G(chspec)) {
sb = CHSPEC_SB_UPPER(chspec) ? "u" : "l";
}
snprintf(buf, CHANSPEC_STR_LEN, "%s%d/%s%s", band, ctl_chan, bw, sb);
#else
if (CHSPEC_IS40(chspec)) {
sb = CHSPEC_SB_UPPER(chspec) ? "u" : "l";
snprintf(buf, CHANSPEC_STR_LEN, "%s%d%s", band, ctl_chan, sb);
} else {
snprintf(buf, CHANSPEC_STR_LEN, "%s%d/%s", band, ctl_chan, bw);
}
#endif
} else {
示例13: wf_chspec_ctlchspec
chanspec_t
wf_chspec_ctlchspec(chanspec_t chspec)
{
chanspec_t ctl_chspec = 0;
uint8 channel;
ASSERT(!wf_chspec_malformed(chspec));
/* Is there a sideband ? */
if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_NONE) {
return chspec;
} else {
if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_UPPER) {
channel = UPPER_20_SB(CHSPEC_CHANNEL(chspec));
} else {
channel = LOWER_20_SB(CHSPEC_CHANNEL(chspec));
}
ctl_chspec = channel | WL_CHANSPEC_BW_20 | WL_CHANSPEC_CTL_SB_NONE;
ctl_chspec |= CHSPEC_BAND(chspec);
}
return ctl_chspec;
}
示例14: wf_chspec_ctlchspec
chanspec_t
wf_chspec_ctlchspec(chanspec_t chspec)
{
DHD_MYTRACE(("%s-%s\n", __FILE__, __FUNCTION__));
chanspec_t ctl_chspec = 0;
uint8 channel;
ASSERT(!wf_chspec_malformed(chspec));
if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_NONE) {
return chspec;
} else {
if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_UPPER) {
channel = UPPER_20_SB(CHSPEC_CHANNEL(chspec));
} else {
channel = LOWER_20_SB(CHSPEC_CHANNEL(chspec));
}
ctl_chspec = channel | WL_CHANSPEC_BW_20 | WL_CHANSPEC_CTL_SB_NONE;
ctl_chspec |= CHSPEC_BAND(chspec);
}
return ctl_chspec;
}
示例15: wf_chspec_ctlchan
uint8
wf_chspec_ctlchan(chanspec_t chspec)
{
uint8 ctl_chan;
if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_NONE) {
return CHSPEC_CHANNEL(chspec);
} else {
ASSERT(CHSPEC_BW(chspec) == WL_CHANSPEC_BW_40);
if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_UPPER) {
ctl_chan = UPPER_20_SB(CHSPEC_CHANNEL(chspec));
} else {
ASSERT(CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_LOWER);
ctl_chan = LOWER_20_SB(CHSPEC_CHANNEL(chspec));
}
}
return ctl_chan;
}