software/drivers/sd8887/src/wlan/mlan/mlan_cfp.c
/**
 *  @brief Use index to get the data rate
 *
 *  @param pmadapter        A pointer to mlan_adapter structure
 *  @param index            The index of data rate
 *  @param tx_rate_info     Tx rate info
 *
 *  @return                 Data rate or 0
 */
@brief Use index to get the data rate
@param pmadapter        A pointer to mlan_adapter structure
@param index            The index of data rate
@param tx_rate_info     Tx rate info

@return                 Data rate or 0
@brief Use index to get the data rate @param pmadapter A pointer to mlan_adapter structure @param index The index of data rate @param tx_rate_info Tx rate info @return Data rate or 0
t_u32
wlan_index_to_data_rate(pmlan_adapter pmadapter, t_u8 index, t_u8 tx_rate_info)
{
#define MCS_NUM_SUPP    8
	t_u16 mcs_rate[4][MCS_NUM_SUPP] = { {0x1b, 0x36, 0x51, 0x6c, 0xa2, 0xd8, 0xf3, 0x10e},	
	{0x1e, 0x3c, 0x5a, 0x78, 0xb4, 0xf0, 0x10e, 0x12c},	
	{0x0d, 0x1a, 0x27, 0x34, 0x4e, 0x68, 0x75, 0x82},	
	{0x0e, 0x1c, 0x2b, 0x39, 0x56, 0x73, 0x82, 0x90}
	};			
#define MCS_NUM_AC    10
	t_u16 ac_mcs_rate_nss1[8][MCS_NUM_AC] = {
		{0x75, 0xEA, 0x15F, 0x1D4, 0x2BE, 0x3A8, 0x41D, 0x492, 0x57C, 0x618},	
		{0x82, 0x104, 0x186, 0x208, 0x30C, 0x410, 0x492, 0x514, 0x618, 0x6C6},	
		{0x3B, 0x75, 0xB0, 0xEA, 0x15F, 0x1D4, 0x20F, 0x249, 0x2BE, 0x30C},	
		{0x41, 0x82, 0xC3, 0x104, 0x186, 0x208, 0x249, 0x28A, 0x30C, 0x363},	
		{0x1B, 0x36, 0x51, 0x6C, 0xA2, 0xD8, 0xF3, 0x10E, 0x144, 0x168},	
		{0x1E, 0x3C, 0x5A, 0x78, 0xB4, 0xF0, 0x10E, 0x12C, 0x168, 0x190},	
		{0xD, 0x1A, 0x27, 0x34, 0x4E, 0x68, 0x75, 0x82, 0x9C, 0x00},	
		{0xF, 0x1D, 0x2C, 0x3A, 0x57, 0x74, 0x82, 0x91, 0xAE, 0x00},	
	};
	t_u32 rate = 0;
	t_u8 mcs_index = 0;
	t_u8 bw = 0;
	t_u8 gi = 0;
	ENTER();
	if ((tx_rate_info & 0x3) == MLAN_RATE_FORMAT_VHT) {
		mcs_index = index & 0xF;
		if (mcs_index > 9)
			mcs_index = 9;
		bw = (tx_rate_info & 0xC) >> 2;
		gi = (tx_rate_info & 0x10) >> 4;
		rate = ac_mcs_rate_nss1[2 * (3 - bw) + gi][mcs_index];
	} else if ((tx_rate_info & 0x3) == MLAN_RATE_FORMAT_HT) {
		bw = (tx_rate_info & 0xC) >> 2;
		gi = (tx_rate_info & 0x10) >> 4;
		if (index == MLAN_RATE_BITMAP_MCS0) {
			if (gi == 1)
				rate = 0x0D;	
			else
				rate = 0x0C;	
		} else if (index < MCS_NUM_SUPP) {
			if (bw <= 1)
				rate = mcs_rate[2 * (1 - bw) + gi][index];
			else
				rate = WlanDataRates[0];
		} else
			rate = WlanDataRates[0];
	} else {
		if (index >= WLAN_SUPPORTED_RATES_EXT)
			index = 0;
		rate = WlanDataRates[index];
	}
	LEAVE();
	return rate;
}
t_u32 wlan_index_to_data_rate ( pmlan_adapter pmadapter , t_u8 index , t_u8 tx_rate_info ) { #define MCS_NUM_SUPP     8 t_u16 mcs_rate [ 4 ] [ MCS_NUM_SUPP ] = { { 0x1b , 0x36 , 0x51 , 0x6c , 0xa2 , 0xd8 , 0xf3 , 0x10e } , { 0x1e , 0x3c , 0x5a , 0x78 , 0xb4 , 0xf0 , 0x10e , 0x12c } , { 0x0d , 0x1a , 0x27 , 0x34 , 0x4e , 0x68 , 0x75 , 0x82 } , { 0x0e , 0x1c , 0x2b , 0x39 , 0x56 , 0x73 , 0x82 , 0x90 } } ; #define MCS_NUM_AC     10 t_u16 ac_mcs_rate_nss1 [ 8 ] [ MCS_NUM_AC ] = { { 0x75 , 0xEA , 0x15F , 0x1D4 , 0x2BE , 0x3A8 , 0x41D , 0x492 , 0x57C , 0x618 } , { 0x82 , 0x104 , 0x186 , 0x208 , 0x30C , 0x410 , 0x492 , 0x514 , 0x618 , 0x6C6 } , { 0x3B , 0x75 , 0xB0 , 0xEA , 0x15F , 0x1D4 , 0x20F , 0x249 , 0x2BE , 0x30C } , { 0x41 , 0x82 , 0xC3 , 0x104 , 0x186 , 0x208 , 0x249 , 0x28A , 0x30C , 0x363 } , { 0x1B , 0x36 , 0x51 , 0x6C , 0xA2 , 0xD8 , 0xF3 , 0x10E , 0x144 , 0x168 } , { 0x1E , 0x3C , 0x5A , 0x78 , 0xB4 , 0xF0 , 0x10E , 0x12C , 0x168 , 0x190 } , { 0xD , 0x1A , 0x27 , 0x34 , 0x4E , 0x68 , 0x75 , 0x82 , 0x9C , 0x00 } , { 0xF , 0x1D , 0x2C , 0x3A , 0x57 , 0x74 , 0x82 , 0x91 , 0xAE , 0x00 } , } ; t_u32 rate = 0 ; t_u8 mcs_index = 0 ; t_u8 bw = 0 ; t_u8 gi = 0 ; ENTER ( ) ; if ( ( tx_rate_info & 0x3 ) == MLAN_RATE_FORMAT_VHT ) { mcs_index = index & 0xF ; if ( mcs_index > 9 ) mcs_index = 9 ; bw = ( tx_rate_info & 0xC ) >> 2 ; gi = ( tx_rate_info & 0x10 ) >> 4 ; rate = ac_mcs_rate_nss1 [ 2 * ( 3 - bw ) + gi ] [ mcs_index ] ; } else if ( ( tx_rate_info & 0x3 ) == MLAN_RATE_FORMAT_HT ) { bw = ( tx_rate_info & 0xC ) >> 2 ; gi = ( tx_rate_info & 0x10 ) >> 4 ; if ( index == MLAN_RATE_BITMAP_MCS0 ) { if ( gi == 1 ) rate = 0x0D ; else rate = 0x0C ; } else if ( index < MCS_NUM_SUPP ) { if ( bw <= 1 ) rate = mcs_rate [ 2 * ( 1 - bw ) + gi ] [ index ] ; else rate = WlanDataRates [ 0 ] ; } else rate = WlanDataRates [ 0 ] ; } else { if ( index >= WLAN_SUPPORTED_RATES_EXT ) index = 0 ; rate = WlanDataRates [ index ] ; } LEAVE ( ) ; return rate ; }
@brief Use index to get the data rate
  @param pmadapter        A pointer to mlan_adapter structure
  @param index            The index of data rate
  @param tx_rate_info     Tx rate info
@brief Use index to get the data rate @param pmadapter A pointer to mlan_adapter structure @param index The index of data rate @param tx_rate_info Tx rate info
/*LG 40M */ /*SG 40M */ /*LG 20M */ /*SG 20M */ /* NSS 1. note: the value in the table is 2 multiplier of the actual rate
	 *              in other words, it is in the unit of 500 Kbs
	 */ /* LG 160M */ /* SG 160M */ /* LG 80M */ /* SG 80M */ /* LG 40M */ /* SG 40M */ /* LG 20M */ /* SG 20M */ /* VHT rate */ /* 20M: bw=0, 40M: bw=1, 80M: bw=2, 160M: bw=3 */ /* LGI: gi =0, SGI: gi = 1 */ /* NSS = 1 */ /* HT rate */ /* 20M: bw=0, 40M: bw=1 */ /* LGI: gi =0, SGI: gi = 1 */ /* MCS 32 SGI rate */ /* MCS 32 LGI rate */ /* 11n non HT rates */