software/drivers/sd8887/src/wlan/mlan/mlan_sta_cmdresp.c
/**
 *  @brief Get power level and rate index
 *
 *  @param pmpriv       A pointer to mlan_private structure
 *  @param pdata_buf    Pointer to the data buffer
 *
 *  @return             MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
 */
@brief Get power level and rate index
@param pmpriv       A pointer to mlan_private structure
@param pdata_buf    Pointer to the data buffer


@brief Get power level and rate index @param pmpriv A pointer to mlan_private structure @param pdata_buf Pointer to the data buffer
static mlan_status
wlan_get_power_level(pmlan_private pmpriv, void *pdata_buf)
{
	t_u16 length = 0;
	t_s8 max_power = -1, min_power = -1;
	MrvlTypes_Power_Group_t *ppg_tlv = MNULL;
	Power_Group_t *pg = MNULL;
	ENTER();
	if (pdata_buf) {
		ppg_tlv =
			(MrvlTypes_Power_Group_t *)((t_u8 *)pdata_buf +
						    sizeof
						    (HostCmd_DS_TXPWR_CFG));
		pg = (Power_Group_t *)((t_u8 *)ppg_tlv +
				       sizeof(MrvlTypes_Power_Group_t));
		length = ppg_tlv->length;
		if (length > 0) {
			max_power = pg->power_max;
			min_power = pg->power_min;
			length -= sizeof(Power_Group_t);
		}
		while (length) {
			pg++;
			if (max_power < pg->power_max)
				max_power = pg->power_max;
			if (min_power > pg->power_min)
				min_power = pg->power_min;
			length -= sizeof(Power_Group_t);
		}
		if (ppg_tlv->length > 0) {
			pmpriv->min_tx_power_level = min_power;
			pmpriv->max_tx_power_level = max_power;
		}
	} else {
		LEAVE();
		return MLAN_STATUS_FAILURE;
	}
	LEAVE();
	return MLAN_STATUS_SUCCESS;
}
static mlan_status wlan_get_power_level ( pmlan_private pmpriv , void * pdata_buf ) { t_u16 length = 0 ; t_s8 max_power = -1 , min_power = -1 ; MrvlTypes_Power_Group_t * ppg_tlv = MNULL ; Power_Group_t * pg = MNULL ; ENTER ( ) ; if ( pdata_buf ) { ppg_tlv = ( MrvlTypes_Power_Group_t * ) ( ( t_u8 * ) pdata_buf + sizeof ( HostCmd_DS_TXPWR_CFG ) ) ; pg = ( Power_Group_t * ) ( ( t_u8 * ) ppg_tlv + sizeof ( MrvlTypes_Power_Group_t ) ) ; length = ppg_tlv -> length ; if ( length > 0 ) { max_power = pg -> power_max ; min_power = pg -> power_min ; length -= sizeof ( Power_Group_t ) ; } while ( length ) { pg ++ ; if ( max_power < pg -> power_max ) max_power = pg -> power_max ; if ( min_power > pg -> power_min ) min_power = pg -> power_min ; length -= sizeof ( Power_Group_t ) ; } if ( ppg_tlv -> length > 0 ) { pmpriv -> min_tx_power_level = min_power ; pmpriv -> max_tx_power_level = max_power ; } } else { LEAVE ( ) ; return MLAN_STATUS_FAILURE ; } LEAVE ( ) ; return MLAN_STATUS_SUCCESS ; }
@brief Get power level and rate index
  @param pmpriv       A pointer to mlan_private structure
  @param pdata_buf    Pointer to the data buffer
@brief Get power level and rate index @param pmpriv A pointer to mlan_private structure @param pdata_buf Pointer to the data buffer