Lines Matching +full:in +full:- +full:band

2  * Misc utility routines used by kernel or app-level.
3 * Contents are wifi-specific, used by any kernel or app-level
8 * Copyright (C) 1999-2017, Broadcom Corporation
25 * software in any way with any other Broadcom software provided under a license
29 * <<Broadcom-WL-IPTag/Open:>>
31 * $Id: bcmwifi_channels.c 695288 2017-04-19 17:20:39Z $
41 #define tolower(c) (bcm_isupper((c)) ? ((c) + 'a' - 'A') : (c))
62 * [<band> 'g'] <channel> ['/'<bandwidth> [<primary-sideband>]['/'<1st80channel>'-'<2nd80channel>]]
64 * <band>:
72 * <primary-sideband>:
73 * (only for 2.4GHz band 40MHz) U for upper sideband primary, L for lower.
75 * For 2.4GHz band 40MHz channels, the same primary channel may be the
80 * For 40MHz in the 5GHz band and all channel bandwidths greater than
82 * non-overlapping and the primary sub-band is derived from its
83 * position in the wide bandwidth channel.
88 * Specifies the center channel of the primary and secondary 80MHz band.
90 * In its simplest form, it is a 20MHz channel number, with the implied band
94 * 40MHz channels is also allowed: <channel><primary-sideband>
98 * <primary-sideband>:
103 * 5g8 20MHz 8 - -
104 * 52 20MHz 52 - -
105 * 52/40 40MHz 54 52-56 52
106 * 56/40 40MHz 54 52-56 56
107 * 52/80 80MHz 58 52-64 52
108 * 56/80 80MHz 58 52-64 56
109 * 60/80 80MHz 58 52-64 60
110 * 64/80 80MHz 58 52-64 64
111 * 52/160 160MHz 50 36-64 52
112 * 36/160 160MGz 50 36-64 36
113 * 36/80+80/42-106 80+80MHz 42,106 36-48,100-112 36
117 * 2g8 20MHz 8 - -
118 * 8 20MHz 8 - -
119 * 6 20MHz 6 - -
120 * 6/40l 40MHz 8 6-10 6
121 * 6l 40MHz 8 6-10 6
122 * 6/40u 40MHz 4 2-6 6
123 * 6u 40MHz 4 2-6 6
145 /* 40MHz channels in 5GHz band */
151 /* 80MHz channels in 5GHz band */
157 /* 160MHz channels in 5GHz band */
163 /* opclass and channel information for US. Table E-1 */
201 * Return the chanspec bandwidth in MHz
206 * @return bandwidth of chspec in MHz units
217 /* bw in MHz, return the channel count from the center channel to the
218 * the channel at the edge of the band
223 /* edge channels separated by BW - 10MHz on each side in center_chan_to_edge()
227 return (uint8)(((bw - 20) / 2) / 5); in center_chan_to_edge()
230 /* return channel number of the low edge of the band
236 return (uint8)(center_ch - center_chan_to_edge(bw)); in channel_low_edge()
239 /* return side band number given center channel and primary20 channel
240 * return -1 on error
248 if ((primary_ch - lowest) % 4) { in channel_to_sb()
250 return -1; in channel_to_sb()
253 sb = ((primary_ch - lowest) / 4); in channel_to_sb()
255 /* sb must be a index to a 20MHz channel in range */ in channel_to_sb()
258 return -1; in channel_to_sb()
264 /* return primary20 channel given center channel and side band */
272 * return -1 on error
283 return -1; in channel_80mhz_to_id()
286 /* wrapper function for wf_chspec_ntoa. In case of an error it puts
287 * the original chanspec in the output buffer, prepended with "invalid".
288 * Can be directly used in print routines as it takes care of null
306 const char *band; in wf_chspec_ntoa() local
312 band = ""; in wf_chspec_ntoa()
314 /* check for non-default band spec */ in wf_chspec_ntoa()
317 band = (CHSPEC_IS2G(chspec)) ? "2g" : "5g"; in wf_chspec_ntoa()
324 snprintf(buf, CHANSPEC_STR_LEN, "%s%d", band, pri_chan); in wf_chspec_ntoa()
337 snprintf(buf, CHANSPEC_STR_LEN, "%s%d/%s%s", band, pri_chan, bw, sb); in wf_chspec_ntoa()
342 snprintf(buf, CHANSPEC_STR_LEN, "%s%d%s", band, pri_chan, sb); in wf_chspec_ntoa()
344 snprintf(buf, CHANSPEC_STR_LEN, "%s%d/%s", band, pri_chan, bw); in wf_chspec_ntoa()
358 snprintf(buf, CHANSPEC_STR_LEN, "%d/80+80/%d-%d", pri_chan, chan1, chan2); in wf_chspec_ntoa()
384 * if bandwidth not specified in chanspec input string, then use default_bw as bandwidth.
401 /* parse channel num or band */ in wf_chspec_aton_ex()
404 /* if we are looking at a 'g', then the first number was a band */ in wf_chspec_aton_ex()
409 /* band must be "2" or "5" */ in wf_chspec_aton_ex()
424 /* first number is channel, use default for band */ in wf_chspec_aton_ex()
431 /* bandwidth not specified in chanspec input string, so use default_bw bandwidth */ in wf_chspec_aton_ex()
471 /* So far we have <band>g<chan>/<bw> in wf_chspec_aton_ex()
510 /* must followed by '-' */ in wf_chspec_aton_ex()
511 if (a[0] != '-') in wf_chspec_aton_ex()
561 int sb = -1; in wf_chspec_aton_ex()
603 /* combine 2 channel IDs in channel field of chspec */ in wf_chspec_aton_ex()
609 /* is the primary channel contained in the 1st 80MHz channel? */ in wf_chspec_aton_ex()
612 /* no match for primary channel 'pri_ch' in segment0 80MHz channel */ in wf_chspec_aton_ex()
638 * chanspec specified a band, bw, pri_sb and channel and that the
648 /* must be 2G or 5G band */ in wf_chspec_malformed()
658 /* channel IDs in 80+80 must be in range */ in wf_chspec_malformed()
675 /* must be 2G or 5G band */ in wf_chspec_malformed()
679 /* side band needs to be consistent with bandwidth */ in wf_chspec_malformed()
689 * 80+80 SB info is relative to the primary 80MHz sub-band. in wf_chspec_malformed()
764 /* check for channel 165 which is not the side band in wf_chspec_valid()
794 * This function returns TRUE if both the chanspec can co-exist in PHY.
795 * Addition to primary20 channel, the function checks for side band for 2g 40 channels
813 * Create a 20MHz chanspec for the given band.
815 * This function returns a 20MHz chanspec in the given band.
818 * @param band a chanspec band (e.g. WL_CHANSPEC_BAND_2G)
820 * @return Returns a 20MHz chanspec, or IVNCHANSPEC in case of error.
823 wf_create_20MHz_chspec(uint channel, chanspec_band_t band) in wf_create_20MHz_chspec() argument
828 (band == WL_CHANSPEC_BAND_2G || in wf_create_20MHz_chspec()
829 band == WL_CHANSPEC_BAND_5G)) { in wf_create_20MHz_chspec()
830 chspec = band | WL_CHANSPEC_BW_20 | WL_CHANSPEC_CTL_SB_NONE | channel; in wf_create_20MHz_chspec()
923 int sb = -1; in wf_channel2chspec()
984 /* determine primary 40 MHz sub-channel of an 80 MHz chanspec */ in wf_chspec_primary40_chspec()
991 center_chan -= CH_20MHZ_APART; in wf_chspec_primary40_chspec()
997 sb -= WL_CHANSPEC_CTL_SB_UL; in wf_chspec_primary40_chspec()
1012 * frequencies from 5 - 6 GHz, and 2.407 GHz is assumed for 2.4 - 2.5 GHz.
1014 * Frequency is specified in MHz.
1019 * The returned channel will be in the range [1, 14] in the 2.4 GHz band
1021 * -1 is returned if the start_factor is WF_CHAN_FACTOR_2_4_G and the
1025 * Reference 802.11-2016, section 17.3.8.3 and section 16.3.6.3
1030 int ch = -1; in wf_mhz2channel()
1047 /* check that the frequency is in 1GHz range of the base */ in wf_mhz2channel()
1049 return -1; in wf_mhz2channel()
1051 offset = (int)(freq - base); in wf_mhz2channel()
1056 return -1; in wf_mhz2channel()
1060 return -1; in wf_mhz2channel()
1066 * Return the center frequency in MHz of the given channel and base frequency.
1069 * The valid channel range is [1, 14] in the 2.4 GHz band and [0, 200] otherwise.
1075 * Odd start_factors produce channels on .5 MHz boundaries, in which case
1077 * -1 is returned for an out of range channel.
1079 * Reference 802.11-2016, section 17.3.8.3 and section 16.3.6.3
1088 freq = -1; in wf_channel2mhz()
1108 * primary_channel - primary 20Mhz channel
1109 * center_channel - center frequecny of the 80Mhz channel
1113 * returns INVCHANSPEC in case of error
1140 * primary_20mhz - Primary 20 MHz channel
1141 * chan0 - center channel number of one frequency segment
1142 * chan1 - center channel number of the other frequency segment
1144 * Parameters chan0 and chan1 are channel numbers in {42, 58, 106, 122, 138, 155}.
1145 * The primary channel must be contained in one of the 80MHz channels. This routine
1148 * Returns INVCHANSPEC in case of error.
1150 * Refer to 802.11-2016 section 22.3.14 "Channelization".
1164 if (chan0_id == -1 || chan1_id == -1) in wf_chspec_get8080_chspec()
1207 * Returns the center channel of the primary 80 MHz sub-band of the provided chanspec
1227 * Returns the center channel of the secondary 80 MHz sub-band of the provided chanspec
1247 * Returns the chanspec for the primary 80MHz sub-band of an 160MHz or 80+80 channel
1264 /* primary sub-band is stored in seg0 */ in wf_chspec_primary80_chspec()
1276 center_chan -= CH_40MHZ_APART; in wf_chspec_primary80_chspec()
1281 sb -= WL_CHANSPEC_CTL_SB_ULL; in wf_chspec_primary80_chspec()
1295 * Returns the chanspec for the secondary 80MHz sub-band of an 160MHz or 80+80 channel
1306 /* secondary sub-band is stored in seg1 */ in wf_chspec_secondary80_chspec()
1320 center_chan -= CH_40MHZ_APART; in wf_chspec_secondary80_chspec()
1343 * For 20/40/80MHz chanspec, set ch[0] to be the center freq, and chan[1]=-1
1355 ch[0] = center_chan - CH_40MHZ_APART; in wf_chspec_get_80p80_channels()
1422 opclass_info = opclass_data[lookupindex-1]; in wf_channel_create_chspec_frm_opclass()
1440 /* Populates array with all 20MHz side bands of a given chanspec_t in the following order:
1459 (pext)[1] = pri_ch + (uint8)(IS_CTL_IN_L20(t) ? CH_20MHZ_APART : -CH_20MHZ_APART); in wf_get_all_ext()
1463 CH_40MHZ_APART : -CH_40MHZ_APART)), WL_CHANSPEC_BW_40); in wf_get_all_ext()
1464 GET_ALL_SB(t, &((pext)[2])); /* get the 20MHz side bands in 40MHz EXT */ in wf_get_all_ext()
1467 /* get the 20MHz side bands in 80MHz EXT (secondary) */ in wf_get_all_ext()
1482 if (ABS(ch0 - ch1) < CH_20MHZ_APART) { in wf_chspec_overlap()