Pārlūkot izejas kodu

[optimize] remove the compilation warnings

Evlers 6 mēneši atpakaļ
vecāks
revīzija
ecddad39e4

+ 4 - 4
esp-hosted/host/api/src/esp_hosted_api.c

@@ -244,14 +244,14 @@ esp_err_t esp_wifi_remote_get_config(wifi_interface_t interface, wifi_config_t *
 	return rpc_wifi_get_config(interface, conf);
 }
 
-esp_err_t esp_wifi_remote_get_mac(wifi_interface_t mode, uint8_t mac[6])
+esp_err_t esp_wifi_remote_get_mac(wifi_interface_t interface, uint8_t mac[6])
 {
-	return rpc_wifi_get_mac(mode, mac);
+	return rpc_wifi_get_mac(interface, mac);
 }
 
-esp_err_t esp_wifi_remote_set_mac(wifi_interface_t mode, const uint8_t mac[6])
+esp_err_t esp_wifi_remote_set_mac(wifi_interface_t interface, const uint8_t mac[6])
 {
-	return rpc_wifi_set_mac(mode, mac);
+	return rpc_wifi_set_mac(interface, mac);
 }
 
 esp_err_t esp_wifi_remote_scan_start(const wifi_scan_config_t *config, bool block)

+ 1 - 3
esp-hosted/host/drivers/rpc/core/rpc_core.c

@@ -167,7 +167,7 @@ static int process_rpc_tx_msg(ctrl_cmd_t *app_req)
 	/* 1. Protobuf msg init */
 	rpc__init(&req);
 
-	req.msg_id = app_req->msg_id;
+	req.msg_id = (RpcId)app_req->msg_id;
 	req.uid = app_req->uid;
 	ESP_LOGI(TAG, "<-- RPC_Req  [0x%x], uid %ld", app_req->msg_id, app_req->uid);
 	/* payload case is exact match to msg id in esp_hosted_config.pb-c.h */
@@ -608,8 +608,6 @@ static ctrl_cmd_t * get_response(int *read_len, ctrl_cmd_t *app_req)
 		ESP_LOGE(TAG, "rpc Q empty or uninitialised");
 		return NULL;
 	}
-
-	return NULL;
 }
 
 static int clear_async_resp_callback(ctrl_cmd_t *app_resp)

+ 1 - 2
esp-hosted/host/drivers/rpc/core/rpc_evt.c

@@ -141,7 +141,7 @@ int rpc_parse_evt(Rpc *rpc_msg, ctrl_cmd_t *app_ntfy)
 			RPC_FAIL_ON_NULL_PRINT(p_c->bssid.data, "NULL BSSID");
 			g_h.funcs->_h_memcpy(p_a->bssid, p_c->bssid.data, p_c->bssid.len);
 			p_a->channel = p_c->channel;
-			p_a->authmode = p_c->authmode;
+			p_a->authmode = (wifi_auth_mode_t)p_c->authmode;
 			p_a->aid = p_c->aid;
 		}
 		break;
@@ -164,7 +164,6 @@ int rpc_parse_evt(Rpc *rpc_msg, ctrl_cmd_t *app_ntfy)
 	} default: {
 		ESP_LOGE(TAG, "Invalid/unsupported event[%u] received",rpc_msg->msg_id);
 		goto fail_parse_rpc_msg;
-		break;
 	}
 
 	}

+ 0 - 1
esp-hosted/host/drivers/rpc/core/rpc_req.c

@@ -464,7 +464,6 @@ int compose_rpc_req(Rpc *req, ctrl_cmd_t *app_req, int32_t *failure_status)
 		*failure_status = RPC_ERR_UNSUPPORTED_MSG;
 		ESP_LOGE(TAG, "Unsupported RPC Req[%u]",req->msg_id);
 		return FAILURE;
-		break;
 	}
 
 	} /* switch */

+ 23 - 24
esp-hosted/host/drivers/rpc/core/rpc_rsp.c

@@ -172,7 +172,7 @@ int rpc_parse_rsp(Rpc *rpc_msg, ctrl_cmd_t *app_resp)
 			WifiStaConfig * p_c_sta = rpc_msg->resp_wifi_get_config->cfg->sta;
 			RPC_RSP_COPY_BYTES(p_a_sta->ssid, p_c_sta->ssid);
 			RPC_RSP_COPY_BYTES(p_a_sta->password, p_c_sta->password);
-			p_a_sta->scan_method = p_c_sta->scan_method;
+			p_a_sta->scan_method = (wifi_scan_method_t)p_c_sta->scan_method;
 			p_a_sta->bssid_set = p_c_sta->bssid_set;
 
 			if (p_a_sta->bssid_set)
@@ -180,9 +180,9 @@ int rpc_parse_rsp(Rpc *rpc_msg, ctrl_cmd_t *app_resp)
 
 			p_a_sta->channel = p_c_sta->channel;
 			p_a_sta->listen_interval = p_c_sta->listen_interval;
-			p_a_sta->sort_method = p_c_sta->sort_method;
+			p_a_sta->sort_method = (wifi_sort_method_t)p_c_sta->sort_method;
 			p_a_sta->threshold.rssi = p_c_sta->threshold->rssi;
-			p_a_sta->threshold.authmode = p_c_sta->threshold->authmode;
+			p_a_sta->threshold.authmode = (wifi_auth_mode_t)p_c_sta->threshold->authmode;
 			//p_a_sta->ssid_hidden = p_c_sta->ssid_hidden;
 			//p_a_sta->max_connections = p_c_sta->max_connections;
 			p_a_sta->pmf_cfg.capable = p_c_sta->pmf_cfg->capable;
@@ -196,7 +196,7 @@ int rpc_parse_rsp(Rpc *rpc_msg, ctrl_cmd_t *app_resp)
 			p_a_sta->transition_disable = H_GET_BIT(STA_TRASITION_DISABLED_BIT, p_c_sta->bitmask);
 			p_a_sta->reserved = WIFI_CONFIG_STA_GET_RESERVED_VAL(p_c_sta->bitmask);
 
-			p_a_sta->sae_pwe_h2e = p_c_sta->sae_pwe_h2e;
+			p_a_sta->sae_pwe_h2e = (wifi_sae_pwe_method_t)p_c_sta->sae_pwe_h2e;
 			p_a_sta->failure_retry_cnt = p_c_sta->failure_retry_cnt;
 			break;
 		}
@@ -208,11 +208,11 @@ int rpc_parse_rsp(Rpc *rpc_msg, ctrl_cmd_t *app_resp)
 			RPC_RSP_COPY_BYTES(p_a_ap->password, p_c_ap->password);
 			p_a_ap->ssid_len = p_c_ap->ssid_len;
 			p_a_ap->channel = p_c_ap->channel;
-			p_a_ap->authmode = p_c_ap->authmode;
+			p_a_ap->authmode = (wifi_auth_mode_t)p_c_ap->authmode;
 			p_a_ap->ssid_hidden = p_c_ap->ssid_hidden;
 			p_a_ap->max_connection = p_c_ap->max_connection;
 			p_a_ap->beacon_interval = p_c_ap->beacon_interval;
-			p_a_ap->pairwise_cipher = p_c_ap->pairwise_cipher;
+			p_a_ap->pairwise_cipher = (wifi_cipher_type_t)p_c_ap->pairwise_cipher;
 			p_a_ap->ftm_responder = p_c_ap->ftm_responder;
 			p_a_ap->pmf_cfg.capable = p_c_ap->pmf_cfg->capable;
 			p_a_ap->pmf_cfg.required = p_c_ap->pmf_cfg->required;
@@ -279,12 +279,12 @@ int rpc_parse_rsp(Rpc *rpc_msg, ctrl_cmd_t *app_resp)
 			RPC_RSP_COPY_BYTES(list[i].ssid, p_c_list[i]->ssid);
 			RPC_RSP_COPY_BYTES(list[i].bssid, p_c_list[i]->bssid);
 			list[i].primary = p_c_list[i]->primary;
-			list[i].second = p_c_list[i]->second;
+			list[i].second = (wifi_second_chan_t)p_c_list[i]->second;
 			list[i].rssi = p_c_list[i]->rssi;
-			list[i].authmode = p_c_list[i]->authmode;
-			list[i].pairwise_cipher = p_c_list[i]->pairwise_cipher;
-			list[i].group_cipher = p_c_list[i]->group_cipher;
-			list[i].ant = p_c_list[i]->ant;
+			list[i].authmode = (wifi_auth_mode_t)p_c_list[i]->authmode;
+			list[i].pairwise_cipher = (wifi_cipher_type_t)p_c_list[i]->pairwise_cipher;
+			list[i].group_cipher = (wifi_cipher_type_t)p_c_list[i]->group_cipher;
+			list[i].ant = (wifi_ant_t)p_c_list[i]->ant;
 			list[i].phy_11b       = H_GET_BIT(WIFI_SCAN_AP_REC_phy_11b_BIT, p_c_list[i]->bitmask);
 			list[i].phy_11g       = H_GET_BIT(WIFI_SCAN_AP_REC_phy_11g_BIT, p_c_list[i]->bitmask);
 			list[i].phy_11n       = H_GET_BIT(WIFI_SCAN_AP_REC_phy_11n_BIT, p_c_list[i]->bitmask);
@@ -299,7 +299,7 @@ int rpc_parse_rsp(Rpc *rpc_msg, ctrl_cmd_t *app_resp)
 			p_a_cntry->schan = p_c_cntry->schan;
 			p_a_cntry->nchan = p_c_cntry->nchan;
 			p_a_cntry->max_tx_power = p_c_cntry->max_tx_power;
-			p_a_cntry->policy = p_c_cntry->policy;
+			p_a_cntry->policy = (wifi_country_policy_t)p_c_cntry->policy;
 
 			ESP_LOGD(TAG, "SSID: %s BSSid: " MACSTR, list[i].ssid, MAC2STR(list[i].bssid));
 			ESP_LOGD(TAG, "Primary: %u Second: %u RSSI: %d Authmode: %u",
@@ -330,7 +330,7 @@ int rpc_parse_rsp(Rpc *rpc_msg, ctrl_cmd_t *app_resp)
 			ESP_LOGD(TAG, "HE_AP: bss_color %d, partial_bss_color %d, bss_color_disabled %d",
 					p_a_he_ap->bss_color, p_a_he_ap->bss_color_disabled, p_a_he_ap->bss_color_disabled);
 
-			list[i].bandwidth = p_c_list[i]->bandwidth;
+			list[i].bandwidth = (wifi_bandwidth_t)p_c_list[i]->bandwidth;
 			list[i].vht_ch_freq1 = p_c_list[i]->vht_ch_freq1;
 			list[i].vht_ch_freq2 = p_c_list[i]->vht_ch_freq2;
 
@@ -369,12 +369,12 @@ int rpc_parse_rsp(Rpc *rpc_msg, ctrl_cmd_t *app_resp)
 		RPC_RSP_COPY_BYTES(ap_info->ssid, p_c->ssid);
 		RPC_RSP_COPY_BYTES(ap_info->bssid, p_c->bssid);
 		ap_info->primary = p_c->primary;
-		ap_info->second = p_c->second;
+		ap_info->second = (wifi_second_chan_t)p_c->second;
 		ap_info->rssi = p_c->rssi;
-		ap_info->authmode = p_c->authmode;
-		ap_info->pairwise_cipher = p_c->pairwise_cipher;
-		ap_info->group_cipher = p_c->group_cipher;
-		ap_info->ant = p_c->ant;
+		ap_info->authmode = (wifi_auth_mode_t)p_c->authmode;
+		ap_info->pairwise_cipher = (wifi_cipher_type_t)p_c->pairwise_cipher;
+		ap_info->group_cipher = (wifi_cipher_type_t)p_c->group_cipher;
+		ap_info->ant = (wifi_ant_t)p_c->ant;
 		ap_info->phy_11b       = H_GET_BIT(WIFI_SCAN_AP_REC_phy_11b_BIT, p_c->bitmask);
 		ap_info->phy_11g       = H_GET_BIT(WIFI_SCAN_AP_REC_phy_11g_BIT, p_c->bitmask);
 		ap_info->phy_11n       = H_GET_BIT(WIFI_SCAN_AP_REC_phy_11n_BIT, p_c->bitmask);
@@ -389,7 +389,7 @@ int rpc_parse_rsp(Rpc *rpc_msg, ctrl_cmd_t *app_resp)
 		p_a_cntry->schan = p_c_cntry->schan;
 		p_a_cntry->nchan = p_c_cntry->nchan;
 		p_a_cntry->max_tx_power = p_c_cntry->max_tx_power;
-		p_a_cntry->policy = p_c_cntry->policy;
+		p_a_cntry->policy = (wifi_country_policy_t)p_c_cntry->policy;
 
 		WifiHeApInfo *p_c_he_ap = p_c->he_ap;
 		wifi_he_ap_info_t *p_a_he_ap = &ap_info->he_ap;
@@ -400,7 +400,7 @@ int rpc_parse_rsp(Rpc *rpc_msg, ctrl_cmd_t *app_resp)
 		p_a_he_ap->bss_color_disabled = H_GET_BIT(WIFI_HE_AP_INFO_bss_color_disabled_BIT,
 				p_c_he_ap->bitmask);
 
-		ap_info->bandwidth = p_c->bandwidth;
+		ap_info->bandwidth = (wifi_bandwidth_t)p_c->bandwidth;
 		ap_info->vht_ch_freq1 = p_c->vht_ch_freq1;
 		ap_info->vht_ch_freq2 = p_c->vht_ch_freq2;
 
@@ -433,7 +433,7 @@ int rpc_parse_rsp(Rpc *rpc_msg, ctrl_cmd_t *app_resp)
 		RPC_FAIL_ON_NULL(resp_wifi_get_bandwidth);
 		RPC_ERR_IN_RESP(resp_wifi_get_bandwidth);
 		app_resp->u.wifi_bandwidth.bw =
-			rpc_msg->resp_wifi_get_bandwidth->bw;
+			(wifi_bandwidth_t)rpc_msg->resp_wifi_get_bandwidth->bw;
 		break;
 	} case RPC_ID__Resp_WifiSetChannel: {
 		RPC_FAIL_ON_NULL(resp_wifi_set_channel);
@@ -445,7 +445,7 @@ int rpc_parse_rsp(Rpc *rpc_msg, ctrl_cmd_t *app_resp)
 		app_resp->u.wifi_channel.primary =
 			rpc_msg->resp_wifi_get_channel->primary;
 		app_resp->u.wifi_channel.second =
-			rpc_msg->resp_wifi_get_channel->second;
+			(wifi_second_chan_t)rpc_msg->resp_wifi_get_channel->second;
 		break;
 	} case RPC_ID__Resp_WifiSetCountryCode: {
 		RPC_FAIL_ON_NULL(resp_wifi_set_country_code);
@@ -471,7 +471,7 @@ int rpc_parse_rsp(Rpc *rpc_msg, ctrl_cmd_t *app_resp)
 		app_resp->u.wifi_country.schan        = rpc_msg->resp_wifi_get_country->country->schan;
 		app_resp->u.wifi_country.nchan        = rpc_msg->resp_wifi_get_country->country->nchan;
 		app_resp->u.wifi_country.max_tx_power = rpc_msg->resp_wifi_get_country->country->max_tx_power;
-		app_resp->u.wifi_country.policy       = rpc_msg->resp_wifi_get_country->country->policy;
+		app_resp->u.wifi_country.policy       = (wifi_country_policy_t)rpc_msg->resp_wifi_get_country->country->policy;
 		break;
 	} case RPC_ID__Resp_WifiApGetStaList: {
 		RPC_FAIL_ON_NULL(resp_wifi_ap_get_sta_list);
@@ -598,7 +598,6 @@ int rpc_parse_rsp(Rpc *rpc_msg, ctrl_cmd_t *app_resp)
 	} default: {
 		ESP_LOGE(TAG, "Unsupported rpc Resp[%u]", rpc_msg->msg_id);
 		goto fail_parse_rpc_msg;
-		break;
 	}
 
 	}

+ 8 - 9
esp-hosted/host/drivers/rpc/wrap/rpc_wrap.c

@@ -514,14 +514,14 @@ int rpc_set_wifi_mode_none(void)
 	return rpc_set_wifi_mode(WIFI_MODE_NULL);
 }
 
-int rpc_wifi_get_mac(wifi_interface_t mode, uint8_t out_mac[6])
+int rpc_wifi_get_mac(wifi_interface_t interface, uint8_t out_mac[6])
 {
 	ctrl_cmd_t *resp = NULL;
 
 	/* implemented synchronous */
 	ctrl_cmd_t *req = RPC_DEFAULT_REQ();
 
-	req->u.wifi_mac.mode = mode;
+	req->u.wifi_mac.mode = interface;
 	resp = wifi_get_mac(req);
 
 	if (resp && resp->resp_event_status == SUCCESS) {
@@ -534,16 +534,16 @@ int rpc_wifi_get_mac(wifi_interface_t mode, uint8_t out_mac[6])
 
 int rpc_station_mode_get_mac(uint8_t mac[6])
 {
-	return rpc_wifi_get_mac(WIFI_MODE_STA, mac);
+	return rpc_wifi_get_mac(WIFI_IF_STA, mac);
 }
 
-int rpc_wifi_set_mac(wifi_interface_t mode, const uint8_t mac[6])
+int rpc_wifi_set_mac(wifi_interface_t interface, const uint8_t mac[6])
 {
 	/* implemented synchronous */
 	ctrl_cmd_t *req = RPC_DEFAULT_REQ();
 	ctrl_cmd_t *resp = NULL;
 
-	req->u.wifi_mac.mode = mode;
+	req->u.wifi_mac.mode = interface;
 	g_h.funcs->_h_memcpy(req->u.wifi_mac.mac, mac, BSSID_BYTES_SIZE);
 
 	resp = wifi_set_mac(req);
@@ -553,7 +553,7 @@ int rpc_wifi_set_mac(wifi_interface_t mode, const uint8_t mac[6])
 
 int rpc_softap_mode_get_mac_addr(uint8_t mac[6])
 {
-	return rpc_wifi_get_mac(WIFI_MODE_AP, mac);
+	return rpc_wifi_get_mac(WIFI_IF_AP, mac);
 }
 
 int rpc_ota_begin(void)
@@ -829,7 +829,7 @@ int rpc_wifi_get_mode(wifi_mode_t* mode)
 	resp = wifi_get_mode(req);
 
 	if (resp && resp->resp_event_status == SUCCESS) {
-		*mode = resp->u.wifi_mode.mode;
+		*mode = (wifi_mode_t)resp->u.wifi_mode.mode;
 	}
 
 	return rpc_rsp_callback(resp);
@@ -864,7 +864,6 @@ int rpc_wifi_connect(void)
 
 	resp = wifi_connect(req);
 	return rpc_rsp_callback(resp);
-	return 0;
 #else
 	/* implemented asynchronous */
 	ctrl_cmd_t *req = RPC_DEFAULT_REQ();
@@ -1084,7 +1083,7 @@ int rpc_wifi_get_ps(wifi_ps_type_t *type)
 
 	resp = wifi_get_ps(req);
 
-	*type = resp->u.wifi_ps.ps_mode;
+	*type = (wifi_ps_type_t)resp->u.wifi_ps.ps_mode;
 
 	return rpc_rsp_callback(resp);
 }

+ 1 - 0
esp-hosted/host/drivers/transport/spi/spi_drv.c

@@ -158,6 +158,7 @@ void transport_init_internal(void)
 
 	spi_handle = g_h.funcs->_h_bus_init();
 	if (!spi_handle) {
+		spi_mempool_destroy();
 		ESP_LOGE(TAG, "could not create spi handle, exiting");
 		assert(spi_handle);
 	}

+ 2 - 2
esp-hosted/host/drivers/transport/transport_drv.c

@@ -206,7 +206,7 @@ static void transport_serial_free_cb(void *buf)
 
 static esp_err_t transport_drv_sta_tx(void *h, void *buffer, size_t len)
 {
-	void * copy_buff = NULL;
+	uint8_t * copy_buff = NULL;
 
 	if (!buffer || !len)
 		return ESP_OK;
@@ -236,7 +236,7 @@ static esp_err_t transport_drv_sta_tx(void *h, void *buffer, size_t len)
 
 static esp_err_t transport_drv_ap_tx(void *h, void *buffer, size_t len)
 {
-	void * copy_buff = NULL;
+	uint8_t * copy_buff = NULL;
 
 	if (!buffer || !len)
 		return ESP_OK;

+ 1 - 1
esp-hosted/host/drivers/virtual_serial_if/serial_if.c

@@ -80,7 +80,7 @@ uint16_t compose_tlv(uint8_t* buf, uint8_t* data, uint16_t data_length)
 	return count;
 }
 
-uint8_t parse_tlv(uint8_t* data, uint32_t* pro_len)
+int8_t parse_tlv(uint8_t* data, uint32_t* pro_len)
 {
 	char* ep_name = RPC_EP_NAME_RSP;
 	char* ep_name2 = RPC_EP_NAME_EVT;

+ 1 - 1
esp-hosted/host/drivers/virtual_serial_if/serial_if.h

@@ -28,7 +28,7 @@ uint16_t compose_tlv(uint8_t* buf, uint8_t* data, uint16_t data_length);
 /* Parse the protobuf encoded data in format of tag, length and value
  * Thi will help application to decode protobuf payload and payload length
  **/
-uint8_t parse_tlv(uint8_t* data, uint32_t* pro_len);
+int8_t parse_tlv(uint8_t* data, uint32_t* pro_len);
 
 /* Open the serial driver for serial operations
  **/

+ 1 - 1
esp-hosted/host/hosted_os_adapter.h

@@ -74,7 +74,7 @@ typedef struct {
 #ifdef CONFIG_ESP_SPI_HOST_INTERFACE
 /* 42 */ int (*_h_do_bus_transfer)(void *transfer_context);
 #endif
-/* 43 */ int (*_h_event_wifi_post)(int32_t event_id, void* event_data, size_t event_data_size, uint32_t ticks_to_wait);
+/* 43 */ int (*_h_event_wifi_post)(int32_t event_id, void* event_data, size_t event_data_size, int32_t ticks_to_wait);
 /* 44 */ void (*_h_printf)(int level, const char *tag, const char *format, ...);
 /* 45 */ void (*_h_hosted_init_hook)(void);
 

+ 1 - 6
porting/components/log/esp_log.c

@@ -23,11 +23,6 @@ uint32_t esp_log_early_timestamp(void)
 	return 0;
 }
 
-__attribute__((always_inline))
-static inline esp_log_level_t esp_log_get_default_level(void)
-{
-    return (esp_log_level_t) CONFIG_LOG_DEFAULT_LEVEL;
-}
 
 void esp_log_buffer_hexdump_internal(const char *tag, const void *buffer, uint16_t buff_len, esp_log_level_t log_level)
 {
@@ -75,7 +70,7 @@ void esp_log_buffer_hexdump_internal(const char *tag, const void *buffer, uint16
         ptr_hd += sprintf(ptr_hd, "|");
 
         ESP_LOG_LEVEL(log_level, tag, "%s", hd_buffer);
-        buffer += bytes_cur_line;
+        buffer = (uint8_t *)buffer + bytes_cur_line;
         buff_len -= bytes_cur_line;
     } while (buff_len);
 }

+ 6 - 6
porting/components/log/tag_log_level.c

@@ -11,7 +11,12 @@
 
 #include "log_linked_list.h"
 
-static esp_log_level_t s_master_log_level = CONFIG_LOG_DEFAULT_LEVEL;
+esp_log_level_t s_master_log_level = CONFIG_LOG_DEFAULT_LEVEL;
+
+void esp_log_set_default_level(esp_log_level_t level)
+{
+    s_master_log_level = level;
+}
 
 static inline void log_level_set(const char *tag, esp_log_level_t level)
 {
@@ -39,11 +44,6 @@ static esp_log_level_t log_level_get(const char *tag, bool timeout)
     return level_for_tag;
 }
 
-void esp_log_set_default_level(esp_log_level_t level)
-{
-    s_master_log_level = level;
-}
-
 void esp_log_level_set(const char *tag, esp_log_level_t level)
 {
 	log_level_set(tag, level);

+ 1 - 1
porting/port/source/os_wrapper.c

@@ -386,7 +386,7 @@ int hosted_write_gpio(void* gpio_port, uint32_t gpio_num, uint32_t value)
 	return 0;
 }
 
-rt_weak int hosted_wifi_event_post(int32_t event_id, void* event_data, size_t event_data_size, uint32_t ticks_to_wait)
+rt_weak int hosted_wifi_event_post(int32_t event_id, void* event_data, size_t event_data_size, int32_t ticks_to_wait)
 {
 	ESP_LOGI(TAG, "wifi event: %d", event_id);
 	return 0;

+ 6 - 6
porting/wlan/esp_wlan.c

@@ -74,7 +74,7 @@ static rt_wlan_security_t security_esp_to_wlan (int encryption_mode)
     }
 }
 
-static int security_wlan_to_esp (rt_wlan_security_t security)
+static wifi_auth_mode_t security_wlan_to_esp (rt_wlan_security_t security)
 {
     switch (security)
     {
@@ -763,14 +763,14 @@ static rt_country_code_t drv_wlan_get_country(struct rt_wlan_device *wlan)
 
 static rt_err_t drv_wlan_set_mac(struct rt_wlan_device *wlan, rt_uint8_t mac[])
 {
-    wifi_interface_t ifx = (wlan == wifi_sta.wlan) ? ESP_IF_WIFI_STA : ESP_IF_WIFI_AP;
+    wifi_interface_t ifx = (wlan == wifi_sta.wlan) ? WIFI_IF_STA : WIFI_IF_AP;
 
-    return esp_wifi_set_mac(ifx, mac);;
+    return esp_wifi_set_mac(ifx, mac);
 }
 
 static rt_err_t drv_wlan_get_mac(struct rt_wlan_device *wlan, rt_uint8_t mac[])
 {
-    wifi_interface_t ifx = (wlan == wifi_sta.wlan) ? ESP_IF_WIFI_STA : ESP_IF_WIFI_AP;
+    wifi_interface_t ifx = (wlan == wifi_sta.wlan) ? WIFI_IF_STA : WIFI_IF_AP;
 
     return esp_wifi_get_mac(ifx, mac);
 }
@@ -781,7 +781,7 @@ static int drv_wlan_send(struct rt_wlan_device *wlan, void *buff, int len)
 
     if (drv_wifi == &wifi_ap)
     {
-        if (esp_wifi_internal_tx(ESP_IF_WIFI_AP, buff, len) != ESP_OK)
+        if (esp_wifi_internal_tx(WIFI_IF_AP, buff, len) != ESP_OK)
         {
             LOG_E("failed to send ap data to wifi drivers");
         }
@@ -789,7 +789,7 @@ static int drv_wlan_send(struct rt_wlan_device *wlan, void *buff, int len)
 
     if (drv_wifi == &wifi_sta)
     {
-        if (esp_wifi_internal_tx(ESP_IF_WIFI_STA, buff, len) != ESP_OK)
+        if (esp_wifi_internal_tx(WIFI_IF_STA, buff, len) != ESP_OK)
         {
             LOG_E("failed to send sta data to wifi drivers");
         }