/* 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 lower 20MHZ sideband depending on the chanspec selected  */
uint8 wf_chspec_ctlchan(chanspec_t chspec)
/* 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 lower 20MHZ sideband depending on the chanspec selected  */
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;
}