software/drivers/sd8887/src/wlan/mlan/mlan_cfp.c
/**
 *  @brief This function finds the CFP in
 *          cfp_table_BG/A based on region/code and band parameter.
 *
 *  @param pmadapter  A pointer to mlan_adapter structure
 *  @param region     The region code
 *  @param band       The band
 *  @param cfp_no     A pointer to CFP number
 *
 *  @return           A pointer to CFP
 */
@brief This function finds the CFP in
cfp_table_BG/A based on region/code and band parameter.

@param pmadapter  A pointer to mlan_adapter structure
@param region     The region code
@param band       The band
@param cfp_no     A pointer to CFP number

@return           A pointer to CFP
@brief This function finds the CFP in cfp_table_BG / A based on region / code and band parameter . @param pmadapter A pointer to mlan_adapter structure @param region The region code @param band The band @param cfp_no A pointer to CFP number @return A pointer to CFP
static chan_freq_power_t *
wlan_get_region_cfp_table(pmlan_adapter pmadapter, t_u8 region, t_u8 band,
			  int *cfp_no)
{
	t_u32 i;
	t_u8 cfp_bg, cfp_a;
	ENTER();
	cfp_bg = cfp_a = region;
	if (!region) {
		cfp_bg = pmadapter->cfp_code_bg;
		cfp_a = pmadapter->cfp_code_a;
	}
	if (band & (BAND_B | BAND_G | BAND_GN | BAND_GAC)) {
		if (pmadapter->otp_region && pmadapter->cfp_otp_bg) {
			if (pmadapter->otp_region->force_reg ||
			    (cfp_bg ==
			     (t_u8)pmadapter->otp_region->region_code)) {
				*cfp_no = pmadapter->tx_power_table_bg_rows;
				LEAVE();
				return pmadapter->cfp_otp_bg;
			}
		}
		for (i = 0; i < MLAN_CFP_TABLE_SIZE_BG; i++) {
			PRINTM(MINFO, "cfp_table_BG[%d].code=%d\n", i,
			       cfp_table_BG[i].code);
			if (cfp_table_BG[i].code == cfp_bg) {
				*cfp_no = cfp_table_BG[i].cfp_no;
				LEAVE();
				return cfp_table_BG[i].cfp;
			}
		}
	}
	if (band & (BAND_A | BAND_AN | BAND_AAC)) {
		if (pmadapter->otp_region && pmadapter->cfp_otp_a) {
			if (pmadapter->otp_region->force_reg ||
			    (cfp_a ==
			     (t_u8)pmadapter->otp_region->region_code)) {
				*cfp_no = pmadapter->tx_power_table_a_rows;
				LEAVE();
				return pmadapter->cfp_otp_a;
			}
		}
		for (i = 0; i < MLAN_CFP_TABLE_SIZE_A; i++) {
			PRINTM(MINFO, "cfp_table_A[%d].code=%d\n", i,
			       cfp_table_A[i].code);
			if (cfp_table_A[i].code == cfp_a) {
				*cfp_no = cfp_table_A[i].cfp_no;
				LEAVE();
				return cfp_table_A[i].cfp;
			}
		}
	}
	if (!region)
		PRINTM(MERROR, "Error Band[0x%x] or code[BG:%#x, A:%#x]\n",
		       band, cfp_bg, cfp_a);
	else
		PRINTM(MERROR, "Error Band[0x%x] or region[%#x]\n", band,
		       region);
	LEAVE();
	return MNULL;
}
static chan_freq_power_t * wlan_get_region_cfp_table ( pmlan_adapter pmadapter , t_u8 region , t_u8 band , int * cfp_no ) { t_u32 i ; t_u8 cfp_bg , cfp_a ; ENTER ( ) ; cfp_bg = cfp_a = region ; if ( ! region ) { cfp_bg = pmadapter -> cfp_code_bg ; cfp_a = pmadapter -> cfp_code_a ; } if ( band & ( BAND_B | BAND_G | BAND_GN | BAND_GAC ) ) { if ( pmadapter -> otp_region && pmadapter -> cfp_otp_bg ) { if ( pmadapter -> otp_region -> force_reg || ( cfp_bg == ( t_u8 ) pmadapter -> otp_region -> region_code ) ) { * cfp_no = pmadapter -> tx_power_table_bg_rows ; LEAVE ( ) ; return pmadapter -> cfp_otp_bg ; } } for ( i = 0 ; i < MLAN_CFP_TABLE_SIZE_BG ; i ++ ) { PRINTM ( MINFO , " \n " , i , cfp_table_BG [ i ] . code ) ; if ( cfp_table_BG [ i ] . code == cfp_bg ) { * cfp_no = cfp_table_BG [ i ] . cfp_no ; LEAVE ( ) ; return cfp_table_BG [ i ] . cfp ; } } } if ( band & ( BAND_A | BAND_AN | BAND_AAC ) ) { if ( pmadapter -> otp_region && pmadapter -> cfp_otp_a ) { if ( pmadapter -> otp_region -> force_reg || ( cfp_a == ( t_u8 ) pmadapter -> otp_region -> region_code ) ) { * cfp_no = pmadapter -> tx_power_table_a_rows ; LEAVE ( ) ; return pmadapter -> cfp_otp_a ; } } for ( i = 0 ; i < MLAN_CFP_TABLE_SIZE_A ; i ++ ) { PRINTM ( MINFO , " \n " , i , cfp_table_A [ i ] . code ) ; if ( cfp_table_A [ i ] . code == cfp_a ) { * cfp_no = cfp_table_A [ i ] . cfp_no ; LEAVE ( ) ; return cfp_table_A [ i ] . cfp ; } } } if ( ! region ) PRINTM ( MERROR , " \n " , band , cfp_bg , cfp_a ) ; else PRINTM ( MERROR , " \n " , band , region ) ; LEAVE ( ) ; return MNULL ; }
@brief This function finds the CFP in
          cfp_table_BG/A based on region/code and band parameter.
@brief This function finds the CFP in cfp_table_BG / A based on region / code and band parameter .
/* Invalid region code, use CFP code */ /* Return the FW cfp table for requested region code, if available.
		 * If region is not forced and the requested region code is different,
		 * simply return the corresponding pre-defined table.
		 */ /* Check if region/code matches for BG bands */ /* Select by band */ /* Return the FW cfp table for requested region code */ /* Check if region/code matches for A bands */ /* Select by band */