software/drivers/sd8887/src/wlan/mlinux/moal_cfg80211.c
/**
 * @brief create cfg80211_chan_def structure based on chan_band info
 *
 * @param priv          A pointer moal_private structure
 * @param chandef       A pointer to cfg80211_chan_def structure
 * @param pchan_info    A pointer to chan_band_info structure
 *
 * @return              MLAN_STATUS_SUCCESS/MLAN_STATUS_FAILURE
 */
@brief create cfg80211_chan_def structure based on chan_band info
@param priv          A pointer moal_private structure
@param chandef       A pointer to cfg80211_chan_def structure
@param pchan_info    A pointer to chan_band_info structure


@brief create cfg80211_chan_def structure based on chan_band info @param priv A pointer moal_private structure @param chandef A pointer to cfg80211_chan_def structure @param pchan_info A pointer to chan_band_info structure
mlan_status
woal_chandef_create(moal_private *priv, struct cfg80211_chan_def *chandef,
		    chan_band_info * pchan_info)
{
	enum ieee80211_band band = IEEE80211_BAND_2GHZ;
	mlan_status status = MLAN_STATUS_SUCCESS;
	ENTER();
	chandef->center_freq2 = 0;
	if (pchan_info->bandcfg.chanBand == BAND_2GHZ)
		band = IEEE80211_BAND_2GHZ;
	else if (pchan_info->bandcfg.chanBand == BAND_5GHZ)
		band = IEEE80211_BAND_5GHZ;
	chandef->chan = ieee80211_get_channel(priv->wdev->wiphy,
					      ieee80211_channel_to_frequency
					      (pchan_info->channel, band));
	if (chandef->chan == NULL) {
		PRINTM(MERROR,
		       "Fail on ieee80211_get_channel, channel=%d, band=%d\n",
		       pchan_info->channel, band);
		status = MLAN_STATUS_FAILURE;
		goto done;
	}
	switch (pchan_info->bandcfg.chanWidth) {
	case CHAN_BW_20MHZ:
		if (pchan_info->is_11n_enabled)
			chandef->width = NL80211_CHAN_WIDTH_20;
		else
			chandef->width = NL80211_CHAN_WIDTH_20_NOHT;
		chandef->center_freq1 = chandef->chan->center_freq;
		break;
	case CHAN_BW_40MHZ:
		chandef->width = NL80211_CHAN_WIDTH_40;
		if (pchan_info->bandcfg.chan2Offset == SEC_CHAN_ABOVE)
			chandef->center_freq1 = chandef->chan->center_freq + 10;
		else if (pchan_info->bandcfg.chan2Offset == SEC_CHAN_BELOW)
			chandef->center_freq1 = chandef->chan->center_freq - 10;
		break;
	case CHAN_BW_80MHZ:
		chandef->width = NL80211_CHAN_WIDTH_80;
		chandef->center_freq1 =
			ieee80211_channel_to_frequency(pchan_info->center_chan,
						       band);
		break;
	default:
		break;
	}
done:
	LEAVE();
	return status;
}
mlan_status woal_chandef_create ( moal_private * priv , struct cfg80211_chan_def * chandef , chan_band_info * pchan_info ) { enum ieee80211_band band = IEEE80211_BAND_2GHZ ; mlan_status status = MLAN_STATUS_SUCCESS ; ENTER ( ) ; chandef -> center_freq2 = 0 ; if ( pchan_info -> bandcfg . chanBand == BAND_2GHZ ) band = IEEE80211_BAND_2GHZ ; else if ( pchan_info -> bandcfg . chanBand == BAND_5GHZ ) band = IEEE80211_BAND_5GHZ ; chandef -> chan = ieee80211_get_channel ( priv -> wdev -> wiphy , ieee80211_channel_to_frequency ( pchan_info -> channel , band ) ) ; if ( chandef -> chan == NULL ) { PRINTM ( MERROR , " \n " , pchan_info -> channel , band ) ; status = MLAN_STATUS_FAILURE ; goto done ; } switch ( pchan_info -> bandcfg . chanWidth ) { case CHAN_BW_20MHZ : if ( pchan_info -> is_11n_enabled ) chandef -> width = NL80211_CHAN_WIDTH_20 ; else chandef -> width = NL80211_CHAN_WIDTH_20_NOHT ; chandef -> center_freq1 = chandef -> chan -> center_freq ; break ; case CHAN_BW_40MHZ : chandef -> width = NL80211_CHAN_WIDTH_40 ; if ( pchan_info -> bandcfg . chan2Offset == SEC_CHAN_ABOVE ) chandef -> center_freq1 = chandef -> chan -> center_freq + 10 ; else if ( pchan_info -> bandcfg . chan2Offset == SEC_CHAN_BELOW ) chandef -> center_freq1 = chandef -> chan -> center_freq - 10 ; break ; case CHAN_BW_80MHZ : chandef -> width = NL80211_CHAN_WIDTH_80 ; chandef -> center_freq1 = ieee80211_channel_to_frequency ( pchan_info -> center_chan , band ) ; break ; default : break ; } done : LEAVE ( ) ; return status ; }
@brief create cfg80211_chan_def structure based on chan_band info
 @param priv          A pointer moal_private structure
 @param chandef       A pointer to cfg80211_chan_def structure
 @param pchan_info    A pointer to chan_band_info structure
@brief create cfg80211_chan_def structure based on chan_band info @param priv A pointer moal_private structure @param chandef A pointer to cfg80211_chan_def structure @param pchan_info A pointer to chan_band_info structure