Lines Matching +full:convert +full:- +full:channels
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
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>]]
72 * <primary-sideband>:
75 * For 2.4GHz band 40MHz channels, the same primary channel may be the
81 * 40MHz, the U/L specificaion is not allowed since the channels are
82 * non-overlapping and the primary sub-band is derived from its
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 */
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()
236 return (uint8)(center_ch - center_chan_to_edge(bw)); in channel_low_edge()
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()
258 return -1; in channel_to_sb()
272 * return -1 on error
283 return -1; in channel_80mhz_to_id()
314 /* check for non-default band spec */ in wf_chspec_ntoa()
353 /* convert to channel number */ in wf_chspec_ntoa()
358 snprintf(buf, CHANSPEC_STR_LEN, "%d/80+80/%d-%d", pri_chan, chan1, chan2); in wf_chspec_ntoa()
383 /* given a chanspec string, convert to a chanspec.
454 /* convert to chspec value */ in wf_chspec_aton_ex()
510 /* must followed by '-' */ in wf_chspec_aton_ex()
511 if (a[0] != '-') in wf_chspec_aton_ex()
533 * Need to convert pri_ch, sb_ul, and ch1,ch2 into in wf_chspec_aton_ex()
561 int sb = -1; in wf_chspec_aton_ex()
599 /* validate channels */ in wf_chspec_aton_ex()
627 /* given a chanspec string, convert to a chanspec.
689 * 80+80 SB info is relative to the primary 80MHz sub-band. in wf_chspec_malformed()
729 /* the two channels must be separated by more than 80MHz by VHT req */ in wf_chspec_valid()
753 /* We don't have an array of legal 20MHz 5G channels, but they are in wf_chspec_valid()
754 * each side of the legal 40MHz channels. Check the chanspec in wf_chspec_valid()
755 * channel against either side of the 40MHz channels. in wf_chspec_valid()
770 /* check for legacy JP channels on failure */ 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
845 * 20MHz channels this is just the channel number. For 40MHz or wider channels
875 /* convert from channel index to channel number */ in wf_chspec_primary20_chan()
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.
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()
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()
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
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
1145 * The primary channel must be contained in one of the 80MHz channels. This routine
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()
1341 * For 160MHz or 80P80 chanspec, set ch[0]/ch[1] to be the low/high 80 Mhz channels
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()
1437 return 12; /* opclass 12 for basic 2G channels */ in wf_channel_create_opclass_frm_chspec()
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()
1482 if (ABS(ch0 - ch1) < CH_20MHZ_APART) { in wf_chspec_overlap()