software/drivers/sd8887/src/wlan/mapp/uaputl/uaputl.c
/**
 *  @brief Check for mandatory rates
 *
 *
 * 2, 4, 11, 22 must be present
 *
 * 6 12 and 24 must be present for ofdm
 *
 *  @param argc     Number of arguments
 *  @param argv     Pointer to the arguments
 *  @return         UAP_FAILURE or UAP_SUCCESS
 *
 */
@brief Check for mandatory rates
2, 4, 11, 22 must be present

6 12 and 24 must be present for ofdm

@param argc     Number of arguments
@param argv     Pointer to the arguments
@return         UAP_FAILURE or UAP_SUCCESS
@brief Check for mandatory rates 2 4 11 22 must be present 6 12 and 24 must be present for ofdm @param argc Number of arguments @param argv Pointer to the arguments @return UAP_FAILURE or UAP_SUCCESS
static int
check_mandatory_rates(int argc, char **argv)
{
	int i;
	int tmp;
	t_u32 rate_bitmap = 0;
	int cck_enable = 0;
	int ofdm_enable = 0;
#define BITMAP_RATE_1M         0x01
#define BITMAP_RATE_2M         0x02
#define BITMAP_RATE_5_5M       0x04
#define BITMAP_RATE_11M        0x8
#define B_RATE_MANDATORY       0x0f
#define BITMAP_RATE_6M         0x10
#define BITMAP_RATE_12M        0x20
#define BITMAP_RATE_24M        0x40
#define G_RATE_MANDATORY        0x70
	for (i = 0; i < argc; i++) {
		tmp = (A2HEXDECIMAL(argv[i]) & ~BASIC_RATE_SET_BIT);
		switch (tmp) {
		case 2:
			cck_enable = 1;
			rate_bitmap |= BITMAP_RATE_1M;
			break;
		case 4:
			cck_enable = 1;
			rate_bitmap |= BITMAP_RATE_2M;
			break;
		case 11:
			cck_enable = 1;
			rate_bitmap |= BITMAP_RATE_5_5M;
			break;
		case 22:
			cck_enable = 1;
			rate_bitmap |= BITMAP_RATE_11M;
			break;
		case 12:
			ofdm_enable = 1;
			rate_bitmap |= BITMAP_RATE_6M;
			break;
		case 24:
			ofdm_enable = 1;
			rate_bitmap |= BITMAP_RATE_12M;
			break;
		case 48:
			ofdm_enable = 1;
			rate_bitmap |= BITMAP_RATE_24M;
			break;
		case 18:
		case 36:
		case 72:
		case 96:
		case 108:
			ofdm_enable = 1;
			break;
		}
	}
#ifdef WIFI_DIRECT_SUPPORT
	if (strncmp(dev_name, "wfd", 3))
#endif
		if ((rate_bitmap & B_RATE_MANDATORY) != B_RATE_MANDATORY) {
			if (cck_enable) {
				printf("Basic Rates 2, 4, 11 and 22 (500K units) \n" "must be present in basic or non-basic rates\n");
				return UAP_FAILURE;
			}
		}
	if (ofdm_enable &&
	    ((rate_bitmap & G_RATE_MANDATORY) != G_RATE_MANDATORY)) {
		printf("OFDM Rates 12, 24 and 48 ( 500Kb units)\n"
		       "must be present in basic or non-basic rates\n");
		return UAP_FAILURE;
	}
	return UAP_SUCCESS;
}
static int check_mandatory_rates ( int argc , char * * argv ) { int i ; int tmp ; t_u32 rate_bitmap = 0 ; int cck_enable = 0 ; int ofdm_enable = 0 ; #define BITMAP_RATE_1M          0x01 #define BITMAP_RATE_2M          0x02 #define BITMAP_RATE_5_5M        0x04 #define BITMAP_RATE_11M         0x8 #define B_RATE_MANDATORY        0x0f #define BITMAP_RATE_6M          0x10 #define BITMAP_RATE_12M         0x20 #define BITMAP_RATE_24M         0x40 #define G_RATE_MANDATORY         0x70 for ( i = 0 ; i < argc ; i ++ ) { tmp = ( A2HEXDECIMAL ( argv [ i ] ) & ~ BASIC_RATE_SET_BIT ) ; switch ( tmp ) { case 2 : cck_enable = 1 ; rate_bitmap |= BITMAP_RATE_1M ; break ; case 4 : cck_enable = 1 ; rate_bitmap |= BITMAP_RATE_2M ; break ; case 11 : cck_enable = 1 ; rate_bitmap |= BITMAP_RATE_5_5M ; break ; case 22 : cck_enable = 1 ; rate_bitmap |= BITMAP_RATE_11M ; break ; case 12 : ofdm_enable = 1 ; rate_bitmap |= BITMAP_RATE_6M ; break ; case 24 : ofdm_enable = 1 ; rate_bitmap |= BITMAP_RATE_12M ; break ; case 48 : ofdm_enable = 1 ; rate_bitmap |= BITMAP_RATE_24M ; break ; case 18 : case 36 : case 72 : case 96 : case 108 : ofdm_enable = 1 ; break ; } } #ifdef WIFI_DIRECT_SUPPORT if ( strncmp ( dev_name , " " , 3 ) ) #endif if ( ( rate_bitmap & B_RATE_MANDATORY ) != B_RATE_MANDATORY ) { if ( cck_enable ) { printf ( " \n " " \n " ) ; return UAP_FAILURE ; } } if ( ofdm_enable && ( ( rate_bitmap & G_RATE_MANDATORY ) != G_RATE_MANDATORY ) ) { printf ( " \n " " \n " ) ; return UAP_FAILURE ; } return UAP_SUCCESS ; }
@brief Check for mandatory rates
 2, 4, 11, 22 must be present
@brief Check for mandatory rates 2 4 11 22 must be present