software/drivers/sd8887/src/wlan/mapp/mlan2040coex/mlan2040coex.c
/**
 *  @brief Check the STA is 40 MHz intolerant or not
 *  @param intol	Flag: TRUE when the STA is 40 MHz intolerant, otherwise FALSE
 *  @return      	MLAN_STATUS_SUCCESS--success, otherwise--fail
 */
@brief Check the STA is 40 MHz intolerant or not
@param intol        Flag: TRUE when the STA is 40 MHz intolerant, otherwise FALSE
@return             MLAN_STATUS_SUCCESS--success, otherwise--fail
@brief Check the STA is 40 MHz intolerant or not @param intol Flag : TRUE when the STA is 40 MHz intolerant otherwise FALSE @return MLAN_STATUS_SUCCESS -- success otherwise -- fail
int
is_intolerant_sta(int *intol)
{
	t_u8 *buffer = NULL;
	struct eth_priv_cmd *cmd = NULL;
	struct ifreq ifr;
	int htcap_info, ret = MLAN_STATUS_SUCCESS;
	*intol = FALSE;
	buffer = (t_u8 *)malloc(MRVDRV_SIZE_OF_CMD_BUFFER);
	if (!buffer) {
		printf("ERR:Cannot allocate buffer for command!\n");
		ret = MLAN_STATUS_FAILURE;
		goto done;
	}
	prepare_buffer(buffer, "htcapinfo", 0, NULL);
	cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd));
	if (!cmd) {
		printf("ERR:Cannot allocate buffer for command!\n");
		ret = MLAN_STATUS_FAILURE;
		goto done;
	}
#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT
	memset(cmd, 0, sizeof(struct eth_priv_cmd));
	memcpy(&cmd->buf, &buffer, sizeof(buffer));
#else
	cmd->buf = buffer;
#endif
	cmd->used_len = 0;
	cmd->total_len = MRVDRV_SIZE_OF_CMD_BUFFER;
	memset(&ifr, 0, sizeof(struct ifreq));
	strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name));
	ifr.ifr_ifru.ifru_data = (void *)cmd;
	if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) {
		perror("mlan2040coex");
		fprintf(stderr, "mlan2040coex: htcapinfo fail\n");
		ret = MLAN_STATUS_FAILURE;
		goto done;
	}
	htcap_info = *((int *)(buffer));
	if (htcap_info & MBIT(8))
		*intol = TRUE;
done:
	if (cmd)
		free(cmd);
	if (buffer)
		free(buffer);
	return ret;
}
int is_intolerant_sta ( int * intol ) { t_u8 * buffer = NULL ; struct eth_priv_cmd * cmd = NULL ; struct ifreq ifr ; int htcap_info , ret = MLAN_STATUS_SUCCESS ; * intol = FALSE ; buffer = ( t_u8 * ) malloc ( MRVDRV_SIZE_OF_CMD_BUFFER ) ; if ( ! buffer ) { printf ( " \n " ) ; ret = MLAN_STATUS_FAILURE ; goto done ; } prepare_buffer ( buffer , " " , 0 , NULL ) ; cmd = ( struct eth_priv_cmd * ) malloc ( sizeof ( struct eth_priv_cmd ) ) ; if ( ! cmd ) { printf ( " \n " ) ; ret = MLAN_STATUS_FAILURE ; goto done ; } #ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT memset ( cmd , 0 , sizeof ( struct eth_priv_cmd ) ) ; memcpy ( & cmd -> buf , & buffer , sizeof ( buffer ) ) ; #else cmd -> buf = buffer ; #endif cmd -> used_len = 0 ; cmd -> total_len = MRVDRV_SIZE_OF_CMD_BUFFER ; memset ( & ifr , 0 , sizeof ( struct ifreq ) ) ; strncpy ( ifr . ifr_ifrn . ifrn_name , dev_name , strlen ( dev_name ) ) ; ifr . ifr_ifru . ifru_data = ( void * ) cmd ; if ( ioctl ( sockfd , MLAN_ETH_PRIV , & ifr ) ) { perror ( " " ) ; fprintf ( stderr , " \n " ) ; ret = MLAN_STATUS_FAILURE ; goto done ; } htcap_info = * ( ( int * ) ( buffer ) ) ; if ( htcap_info & MBIT ( 8 ) ) * intol = TRUE ; done : if ( cmd ) free ( cmd ) ; if ( buffer ) free ( buffer ) ; return ret ; }
@brief Check the STA is 40 MHz intolerant or not
  @param intol        Flag: TRUE when the STA is 40 MHz intolerant, otherwise FALSE
  @return             MLAN_STATUS_SUCCESS--success, otherwise--fail
@brief Check the STA is 40 MHz intolerant or not @param intol Flag : TRUE when the STA is 40 MHz intolerant otherwise FALSE @return MLAN_STATUS_SUCCESS -- success otherwise -- fail
/* Initialize buffer */ /* buffer = CMD_NXP + <cmd_string> */ /* Fill up buffer */ /* Perform IOCTL */