Skip to content

Commit

Permalink
Merge branch 'feat/esp_version_check' into 'feature/esp_as_mcu_host'
Browse files Browse the repository at this point in the history
feat/esp_version_check Added Wifi Config Header for ESP Version checking

See merge request app-frameworks/esp_hosted!493
  • Loading branch information
mantriyogesh committed Sep 2, 2024
2 parents f071123 + e9322de commit 71f942b
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 12 deletions.
3 changes: 2 additions & 1 deletion host/api/esp_hosted_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ extern "C" {

/** Includes **/
#include "esp_wifi_remote.h"
#include "esp_hosted_wifi_config.h"
#include "esp_hosted_api.h"
#include "esp_check.h"
#include "transport_drv.h"
Expand Down Expand Up @@ -379,7 +380,7 @@ esp_err_t esp_wifi_remote_sta_get_aid(uint16_t *aid)
return rpc_wifi_sta_get_aid(aid);
}

#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 0)
#if H_WIFI_DUALBAND_SUPPORT
esp_err_t esp_wifi_remote_set_band(wifi_band_t band)
{
return rpc_wifi_set_band(band);
Expand Down
4 changes: 2 additions & 2 deletions host/api/esp_hosted_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ extern "C" {
#include "esp_wifi.h"
#include "transport_drv.h"
#include "esp_wifi_remote.h"

#include "esp_hosted_wifi_config.h"

/** Exported variables **/
#define ESP_HOSTED_CHANNEL_CONFIG_DEFAULT() { \
Expand Down Expand Up @@ -96,7 +96,7 @@ esp_err_t esp_wifi_remote_get_max_tx_power(int8_t *power);
esp_err_t esp_wifi_remote_sta_get_aid(uint16_t *aid);
esp_err_t esp_hosted_ota(const char* image_url);

#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 0)
#if H_WIFI_DUALBAND_SUPPORT
esp_err_t esp_wifi_remote_set_band(wifi_band_t band);
esp_err_t esp_wifi_remote_get_band(wifi_band_t *band);
esp_err_t esp_wifi_remote_set_band_mode(wifi_band_mode_t band_mode);
Expand Down
3 changes: 2 additions & 1 deletion host/api/esp_wifi_weak.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*/

#include "esp_hosted_api.h"
#include "esp_hosted_wifi_config.h"

#define WEAK __attribute__((weak))

Expand Down Expand Up @@ -223,7 +224,7 @@ WEAK esp_err_t esp_wifi_sta_get_rssi(int *rssi)
return esp_wifi_remote_sta_get_rssi(rssi);
}

#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 0)
#if H_WIFI_DUALBAND_SUPPORT
WEAK esp_err_t esp_wifi_set_band(wifi_band_t band)
{
return esp_wifi_remote_set_band(band);
Expand Down
2 changes: 1 addition & 1 deletion host/drivers/bt/vhci_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ void hci_drv_show_configuration(void)
* - HCI_H4_xxx type should be set in esp_payload_header.hci_pkt_type
*/

#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 3, 0)
#if H_BT_ENABLE_LL_INIT
void ble_transport_ll_init(void)
{
}
Expand Down
3 changes: 2 additions & 1 deletion host/drivers/rpc/core/rpc_req.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "rpc_common.h"
#include "adapter.h"
#include "esp_log.h"
#include "esp_hosted_wifi_config.h"

DEFINE_LOG_TAG(rpc_req);

Expand Down Expand Up @@ -415,7 +416,7 @@ int compose_rpc_req(Rpc *req, ctrl_cmd_t *app_req, int32_t *failure_status)
rpc__req__wifi_get_protocol__init);
req_payload->ifx = app_req->u.wifi_protocol.ifx;
break;
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 0)
#if H_WIFI_DUALBAND_SUPPORT
} case RPC_ID__Req_WifiSetProtocols: {
RPC_ALLOC_ASSIGN(RpcReqWifiSetProtocols, req_wifi_set_protocols,
rpc__req__wifi_set_protocols__init);
Expand Down
3 changes: 2 additions & 1 deletion host/drivers/rpc/core/rpc_rsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "rpc_slave_if.h"
#include "adapter.h"
#include "esp_log.h"
#include "esp_hosted_wifi_config.h"

DEFINE_LOG_TAG(rpc_rsp);

Expand Down Expand Up @@ -522,7 +523,7 @@ int rpc_parse_rsp(Rpc *rpc_msg, ctrl_cmd_t *app_resp)
app_resp->u.wifi_sta_get_aid.aid =
rpc_msg->resp_wifi_sta_get_aid->aid;
break;
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 0)
#if H_WIFI_DUALBAND_SUPPORT
} case RPC_ID__Resp_WifiSetProtocols: {
RPC_FAIL_ON_NULL(resp_wifi_set_protocols);
RPC_ERR_IN_RESP(resp_wifi_set_protocols);
Expand Down
4 changes: 2 additions & 2 deletions host/drivers/rpc/slaveif/rpc_slave_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
#include "rpc_slave_if.h"
#include "rpc_core.h"

#include "esp_hosted_wifi_config.h"
#include "esp_log.h"

DEFINE_LOG_TAG(rpc_api);
Expand Down Expand Up @@ -364,7 +364,7 @@ ctrl_cmd_t * wifi_set_protocols(ctrl_cmd_t *req)
RPC_DECODE_RSP_IF_NOT_ASYNC();
}

#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 0)
#if H_WIFI_DUALBAND_SUPPORT
ctrl_cmd_t * wifi_get_protocols(ctrl_cmd_t *req)
{
RPC_SEND_REQ(RPC_ID__Req_WifiGetProtocols);
Expand Down
3 changes: 2 additions & 1 deletion host/drivers/rpc/slaveif/rpc_slave_if.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "esp_hosted_rpc.pb-c.h"
#include "esp_wifi.h"
#include "esp_wifi_types.h"
#include "esp_hosted_wifi_config.h"

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -223,7 +224,7 @@ typedef struct Ctrl_cmd_t {

rpc_wifi_sta_get_aid_t wifi_sta_get_aid;

#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 0)
#if H_WIFI_DUALBAND_SUPPORT
rpc_wifi_protocols_t wifi_protocols;

rpc_wifi_bandwidths_t wifi_bandwidths;
Expand Down
3 changes: 2 additions & 1 deletion host/drivers/rpc/wrap/rpc_wrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "rpc_common.h"
#include "esp_log.h"
#include "esp_http_client.h"
#include "esp_hosted_wifi_config.h"

DEFINE_LOG_TAG(rpc_wrap);
static char* OTA_TAG = "h_ota";
Expand Down Expand Up @@ -1094,7 +1095,7 @@ esp_err_t rpc_wifi_sta_get_aid(uint16_t *aid)
return rpc_rsp_callback(resp);
}

#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 0)
#if H_WIFI_DUALBAND_SUPPORT
esp_err_t rpc_wifi_set_band(wifi_band_t band)
{
/* implemented synchronous */
Expand Down
3 changes: 2 additions & 1 deletion host/drivers/rpc/wrap/rpc_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ extern "C" {
/** Includes **/
#include "common.h"
#include "esp_wifi.h"
#include "esp_hosted_wifi_config.h"

/** Exported variables **/

Expand Down Expand Up @@ -78,7 +79,7 @@ esp_err_t rpc_wifi_get_max_tx_power(int8_t *power);
esp_err_t rpc_wifi_sta_get_aid(uint16_t *aid);
esp_err_t rpc_ota(const char* image_url);

#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 0)
#if H_WIFI_DUALBAND_SUPPORT
esp_err_t rpc_wifi_set_band(wifi_band_t band);
esp_err_t rpc_wifi_get_band(wifi_band_t *band);
esp_err_t rpc_wifi_set_band_mode(wifi_band_mode_t band_mode);
Expand Down
7 changes: 7 additions & 0 deletions host/port/esp_hosted_bt_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,11 @@
#define H_BT_USE_VHCI 0
#endif

#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 3, 0)
// ll_init required
#define H_BT_ENABLE_LL_INIT 1
#else
#define H_BT_ENABLE_LL_INIT 0
#endif

#endif
16 changes: 16 additions & 0 deletions host/port/esp_hosted_wifi_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
* SPDX-License-Identifier: Apache-2.0
*/

#ifndef __ESP_HOSTED_WIFI_CONFIG_H__
#define __ESP_HOSTED_WIFI_CONFIG_H__

#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 0)
// dual band API support available
#define H_WIFI_DUALBAND_SUPPORT 1
#else
#define H_WIFI_DUALBAND_SUPPORT 0
#endif

#endif

0 comments on commit 71f942b

Please sign in to comment.