software/drivers/sd8887/src/wlan/mapp/mlanconfig/mlanconfig.c
/**
 *  @brief Provides interface to perform read/write the adapter memory
 *
 *  Command: mlanconfig mlanX memrdwr <address> [value]
 *
 *  @param argc     Number of arguments
 *  @param argv     Pointer to the arguments
 *
 *  @return         MLAN_STATUS_SUCCESS--success, otherwise--fail
 */
@brief Provides interface to perform read/write the adapter memory
Command: mlanconfig mlanX memrdwr  [value]

@param argc     Number of arguments
@param argv     Pointer to the arguments


@brief Provides interface to perform read / write the adapter memory Command : mlanconfig mlanX memrdwr [ value ] @param argc Number of arguments @param argv Pointer to the arguments
static int
process_memrdwr(int argc, char *argv[])
{
	struct iwreq iwr;
	int ioctl_val, subioctl_val;
	t_u32 address, value;
	t_u8 buf[100] = { 0 };
	HostCmd_DS_MEM *pmem;
	HostCmd_DS_GEN *hostcmd = (HostCmd_DS_GEN *)buf;
	int ret = MLAN_STATUS_SUCCESS;
	pmem = (HostCmd_DS_MEM *)(buf + S_DS_GEN);
	if ((argc < 4) || (argc > 5)) {
		printf("Parameters for memrdwr: <address> [value]\n");
		return -EINVAL;
	}
	if (get_priv_ioctl("hostcmd",
			   &ioctl_val, &subioctl_val) == MLAN_STATUS_FAILURE) {
		return -EOPNOTSUPP;
	}
	address = a2hex_or_atoi(argv[3]);
	pmem->addr = cpu_to_le32(address);
	if (argc > 4) {
		pmem->action = cpu_to_le16(HostCmd_ACT_GEN_SET);
		value = a2hex_or_atoi(argv[4]);
		pmem->value = cpu_to_le32(value);
	} else {
		pmem->action = cpu_to_le16(HostCmd_ACT_GEN_GET);
		pmem->value = 0;
	}
	hostcmd->command = cpu_to_le16(HostCmd_CMD_MEM_ACCESS);
	hostcmd->size = cpu_to_le16(S_DS_GEN + sizeof(HostCmd_DS_MEM));
	hostcmd->seq_num = 0;
	hostcmd->result = 0;
	memset(&iwr, 0, sizeof(iwr));
	strncpy(iwr.ifr_name, dev_name, IFNAMSIZ - 1);
	iwr.u.data.pointer = buf;
	iwr.u.data.length = le16_to_cpu(hostcmd->size);
	iwr.u.data.flags = 0;
	if (ioctl(sockfd, ioctl_val, &iwr)) {
		fprintf(stderr,
			"mlanconfig: MLANHOSTCMD is not supported by %s\n",
			dev_name);
		return MLAN_STATUS_FAILURE;
	}
	ret = process_host_cmd_resp(buf);
	return ret;
}
static int process_memrdwr ( int argc , char * argv [ ] ) { struct iwreq iwr ; int ioctl_val , subioctl_val ; t_u32 address , value ; t_u8 buf [ 100 ] = { 0 } ; HostCmd_DS_MEM * pmem ; HostCmd_DS_GEN * hostcmd = ( HostCmd_DS_GEN * ) buf ; int ret = MLAN_STATUS_SUCCESS ; pmem = ( HostCmd_DS_MEM * ) ( buf + S_DS_GEN ) ; if ( ( argc < 4 ) || ( argc > 5 ) ) { printf ( " \n " ) ; return - EINVAL ; } if ( get_priv_ioctl ( " " , & ioctl_val , & subioctl_val ) == MLAN_STATUS_FAILURE ) { return - EOPNOTSUPP ; } address = a2hex_or_atoi ( argv [ 3 ] ) ; pmem -> addr = cpu_to_le32 ( address ) ; if ( argc > 4 ) { pmem -> action = cpu_to_le16 ( HostCmd_ACT_GEN_SET ) ; value = a2hex_or_atoi ( argv [ 4 ] ) ; pmem -> value = cpu_to_le32 ( value ) ; } else { pmem -> action = cpu_to_le16 ( HostCmd_ACT_GEN_GET ) ; pmem -> value = 0 ; } hostcmd -> command = cpu_to_le16 ( HostCmd_CMD_MEM_ACCESS ) ; hostcmd -> size = cpu_to_le16 ( S_DS_GEN + sizeof ( HostCmd_DS_MEM ) ) ; hostcmd -> seq_num = 0 ; hostcmd -> result = 0 ; memset ( & iwr , 0 , sizeof ( iwr ) ) ; strncpy ( iwr . ifr_name , dev_name , IFNAMSIZ - 1 ) ; iwr . u . data . pointer = buf ; iwr . u . data . length = le16_to_cpu ( hostcmd -> size ) ; iwr . u . data . flags = 0 ; if ( ioctl ( sockfd , ioctl_val , & iwr ) ) { fprintf ( stderr , " \n " , dev_name ) ; return MLAN_STATUS_FAILURE ; } ret = process_host_cmd_resp ( buf ) ; return ret ; }
@brief Provides interface to perform read/write the adapter memory
  Command: mlanconfig mlanX memrdwr <address> [value]
@brief Provides interface to perform read / write the adapter memory Command : mlanconfig mlanX memrdwr <address > [ value ]
/* Check arguments */