software/drivers/sd8887/src/wlan/mlan/mlan_cfp.c
/**
 *  @brief Check validation of given channel and oper class
 *
 *  @param pmpriv             A pointer to mlan_private structure
 *  @param channel            Channel number
 *  @param oper_class         operating class
 *
 *  @return                   MLAN_STATUS_PENDING --success, otherwise fail
 */
@brief Check validation of given channel and oper class
@param pmpriv             A pointer to mlan_private structure
@param channel            Channel number
@param oper_class         operating class

@return                   MLAN_STATUS_PENDING --success, otherwise fail
@brief Check validation of given channel and oper class @param pmpriv A pointer to mlan_private structure @param channel Channel number @param oper_class operating class @return MLAN_STATUS_PENDING -- success otherwise fail
mlan_status
wlan_check_operclass_validation(mlan_private *pmpriv, t_u8 channel,
				t_u8 oper_class)
{
	int arraysize = 0, i = 0, channum = 0;
	oper_bw_chan *poper_bw_chan = MNULL;
	t_u8 center_freq_idx = 0;
	t_u8 center_freqs[] = { 42, 50, 58, 106, 114, 122, 138, 155 };
	ENTER();
	for (i = 0; i < sizeof(center_freqs); i++) {
		if (channel == center_freqs[i]) {
			PRINTM(MERROR, "Invalid channel number %d!\n", channel);
			LEAVE();
			return MLAN_STATUS_FAILURE;
		}
	}
	if (oper_class <= 0 || oper_class > 130) {
		PRINTM(MERROR, "Invalid operating class!\n");
		LEAVE();
		return MLAN_STATUS_FAILURE;
	}
	if (oper_class >= 128) {
		center_freq_idx =
			wlan_get_center_freq_idx(pmpriv, BAND_AAC, channel,
						 CHANNEL_BW_80MHZ);
		channel = center_freq_idx;
	}
	poper_bw_chan = wlan_get_nonglobal_operclass_table(pmpriv, &arraysize);
	if (!poper_bw_chan) {
		PRINTM(MCMND, "Operating class table do not find!\n");
		LEAVE();
		return MLAN_STATUS_FAILURE;
	}
	for (i = 0; i < arraysize / sizeof(oper_bw_chan); i++) {
		if (poper_bw_chan[i].oper_class == oper_class ||
		    poper_bw_chan[i].global_oper_class == oper_class) {
			for (channum = 0;
			     channum < sizeof(poper_bw_chan[i].channel_list);
			     channum++) {
				if (poper_bw_chan[i].channel_list[channum] &&
				    poper_bw_chan[i].channel_list[channum] ==
				    channel) {
					LEAVE();
					return MLAN_STATUS_SUCCESS;
				}
			}
		}
	}
	PRINTM(MCMND, "Operating class %d do not match channel %d!\n",
	       oper_class, channel);
	LEAVE();
	return MLAN_STATUS_FAILURE;
}
mlan_status wlan_check_operclass_validation ( mlan_private * pmpriv , t_u8 channel , t_u8 oper_class ) { int arraysize = 0 , i = 0 , channum = 0 ; oper_bw_chan * poper_bw_chan = MNULL ; t_u8 center_freq_idx = 0 ; t_u8 center_freqs [ ] = { 42 , 50 , 58 , 106 , 114 , 122 , 138 , 155 } ; ENTER ( ) ; for ( i = 0 ; i < sizeof ( center_freqs ) ; i ++ ) { if ( channel == center_freqs [ i ] ) { PRINTM ( MERROR , " \n " , channel ) ; LEAVE ( ) ; return MLAN_STATUS_FAILURE ; } } if ( oper_class <= 0 || oper_class > 130 ) { PRINTM ( MERROR , " \n " ) ; LEAVE ( ) ; return MLAN_STATUS_FAILURE ; } if ( oper_class >= 128 ) { center_freq_idx = wlan_get_center_freq_idx ( pmpriv , BAND_AAC , channel , CHANNEL_BW_80MHZ ) ; channel = center_freq_idx ; } poper_bw_chan = wlan_get_nonglobal_operclass_table ( pmpriv , & arraysize ) ; if ( ! poper_bw_chan ) { PRINTM ( MCMND , " \n " ) ; LEAVE ( ) ; return MLAN_STATUS_FAILURE ; } for ( i = 0 ; i < arraysize / sizeof ( oper_bw_chan ) ; i ++ ) { if ( poper_bw_chan [ i ] . oper_class == oper_class || poper_bw_chan [ i ] . global_oper_class == oper_class ) { for ( channum = 0 ; channum < sizeof ( poper_bw_chan [ i ] . channel_list ) ; channum ++ ) { if ( poper_bw_chan [ i ] . channel_list [ channum ] && poper_bw_chan [ i ] . channel_list [ channum ] == channel ) { LEAVE ( ) ; return MLAN_STATUS_SUCCESS ; } } } } PRINTM ( MCMND , " \n " , oper_class , channel ) ; LEAVE ( ) ; return MLAN_STATUS_FAILURE ; }
@brief Check validation of given channel and oper class
  @param pmpriv             A pointer to mlan_private structure
  @param channel            Channel number
  @param oper_class         operating class
@brief Check validation of given channel and oper class @param pmpriv A pointer to mlan_private structure @param channel Channel number @param oper_class operating class