Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 220176
b: refs/heads/master
c: 51c5651
h: refs/heads/master
v: v3
  • Loading branch information
Henry Ptasinski authored and Greg Kroah-Hartman committed Oct 8, 2010
1 parent 62b01d2 commit 73b8f63
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 142 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4ca70f7fcbf9a4cd44c52f582ef4cfb678f3f560
refs/heads/master: 51c5651da4bf37f0cbb488d9c6f9044da659c367
15 changes: 0 additions & 15 deletions trunk/drivers/staging/brcm80211/include/bcmwifi.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,21 +128,6 @@ typedef u16 chanspec_t;

#define WLC_2G_25MHZ_OFFSET 5 /* 2.4GHz band channel offset */

/*
* Convert chanspec to ascii string
* @param chspec chanspec format
* @param buf ascii string of chanspec
* @return pointer to buf with room for at least CHANSPEC_STR_LEN bytes
*/
extern char *wf_chspec_ntoa(chanspec_t chspec, char *buf);

/*
* Convert ascii string to chanspec
* @param a pointer to input string
* @return >= 0 if successful or 0 otherwise
*/
extern chanspec_t wf_chspec_aton(char *a);

/*
* Verify the chanspec is using a legal set of parameters, i.e. that the
* chanspec specified a band, bw, ctl_sb and channel and that the
Expand Down
126 changes: 0 additions & 126 deletions trunk/drivers/staging/brcm80211/util/bcmwifi.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,132 +22,6 @@
#include <bcmutils.h>
#include <bcmwifi.h>

/* Chanspec ASCII representation:
* <channel><band><bandwidth><ctl-sideband>
* digit [AB] [N] [UL]
*
* <channel>: channel number of the 10MHz or 20MHz channel,
* or control sideband channel of 40MHz channel.
* <band>: A for 5GHz, B for 2.4GHz
* <bandwidth>: N for 10MHz, nothing for 20MHz or 40MHz
* (ctl-sideband spec implies 40MHz)
* <ctl-sideband>: U for upper, L for lower
*
* <band> may be omitted on input, and will be assumed to be
* 2.4GHz if channel number <= 14.
*
* Examples:
* 8 -> 2.4GHz channel 8, 20MHz
* 8b -> 2.4GHz channel 8, 20MHz
* 8l -> 2.4GHz channel 8, 40MHz, lower ctl sideband
* 8a -> 5GHz channel 8 (low 5 GHz band), 20MHz
* 36 -> 5GHz channel 36, 20MHz
* 36l -> 5GHz channel 36, 40MHz, lower ctl sideband
* 40u -> 5GHz channel 40, 40MHz, upper ctl sideband
* 180n -> channel 180, 10MHz
*/

/* 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;
}

/* given a chanspec string, convert to a chanspec.
* On error return 0
*/
chanspec_t wf_chspec_aton(char *a)
{
char *endp = NULL;
uint channel, band, bw, ctl_sb;
char c;

channel = simple_strtoul(a, &endp, 10);

/* check for no digits parsed */
if (endp == a)
return 0;

if (channel > MAXCHANNEL)
return 0;

band =
((channel <=
CH_MAX_2G_CHANNEL) ? WL_CHANSPEC_BAND_2G : WL_CHANSPEC_BAND_5G);
bw = WL_CHANSPEC_BW_20;
ctl_sb = WL_CHANSPEC_CTL_SB_NONE;

a = endp;

c = tolower(a[0]);
if (c == '\0')
goto done;

/* parse the optional ['A' | 'B'] band spec */
if (c == 'a' || c == 'b') {
band = (c == 'a') ? WL_CHANSPEC_BAND_5G : WL_CHANSPEC_BAND_2G;
a++;
c = tolower(a[0]);
if (c == '\0')
goto done;
}

/* parse bandwidth 'N' (10MHz) or 40MHz ctl sideband ['L' | 'U'] */
if (c == 'n') {
bw = WL_CHANSPEC_BW_10;
} else if (c == 'l') {
bw = WL_CHANSPEC_BW_40;
ctl_sb = WL_CHANSPEC_CTL_SB_LOWER;
/* adjust channel to center of 40MHz band */
if (channel <= (MAXCHANNEL - CH_20MHZ_APART))
channel += CH_10MHZ_APART;
else
return 0;
} else if (c == 'u') {
bw = WL_CHANSPEC_BW_40;
ctl_sb = WL_CHANSPEC_CTL_SB_UPPER;
/* adjust channel to center of 40MHz band */
if (channel > CH_20MHZ_APART)
channel -= CH_10MHZ_APART;
else
return 0;
} else {
return 0;
}

done:
return channel | band | bw | ctl_sb;
}

/*
* Verify the chanspec is using a legal set of parameters, i.e. that the
* chanspec specified a band, bw, ctl_sb and channel and that the
Expand Down

0 comments on commit 73b8f63

Please sign in to comment.