Skip to content

Commit e523710

Browse files
committed
drivers: bt: add stubs to allow CI testing without blobs
Update BT driver and add necessary stubs so that CI can run without binay blobs. Signed-off-by: Sylvio Alves <[email protected]>
1 parent 847e4fb commit e523710

File tree

10 files changed

+235
-45
lines changed

10 files changed

+235
-45
lines changed

zephyr/esp32/CMakeLists.txt

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -364,12 +364,6 @@ if(CONFIG_SOC_SERIES_ESP32)
364364
../../components/esp_phy/src/phy_common.c
365365
)
366366

367-
zephyr_sources_ifdef(
368-
CONFIG_BUILD_ONLY_NO_BLOBS
369-
../port/wifi/wifi_stubs.c
370-
../port/phy/phy_stubs.c
371-
)
372-
373367
zephyr_link_libraries_ifndef(
374368
CONFIG_BUILD_ONLY_NO_BLOBS
375369
net80211
@@ -380,16 +374,23 @@ if(CONFIG_SOC_SERIES_ESP32)
380374
## esp-idf wifi libs refer gcc libs symbols, so linked in libgcc
381375
gcc
382376
-L${CMAKE_CURRENT_SOURCE_DIR}/../blobs/lib/esp32
383-
)
384-
377+
)
385378
endif()
386379

387380
## BT definitions
388381
if (CONFIG_BT)
382+
389383
zephyr_sources(src/bt/esp_bt_adapter.c)
390384
zephyr_compile_definitions(CONFIG_BT_ENABLED)
391385

392-
zephyr_link_libraries(
386+
zephyr_sources_ifdef(
387+
CONFIG_BUILD_ONLY_NO_BLOBS
388+
../port/bluetooth/bt_stubs.c
389+
../port/phy/phy_stubs.c
390+
)
391+
392+
zephyr_link_libraries_ifndef(
393+
CONFIG_BUILD_ONLY_NO_BLOBS
393394
## ble
394395
btdm_app
395396
-L${CMAKE_CURRENT_SOURCE_DIR}/../blobs/lib/esp32
@@ -400,6 +401,12 @@ if(CONFIG_SOC_SERIES_ESP32)
400401
## WIFI definitions
401402
if (CONFIG_WIFI_ESP32)
402403

404+
zephyr_sources_ifdef(
405+
CONFIG_BUILD_ONLY_NO_BLOBS
406+
../port/wifi/wifi_stubs.c
407+
../port/phy/phy_stubs.c
408+
)
409+
403410
set(WPA_SUPPLICANT_COMPONENT_DIR "../../components/wpa_supplicant")
404411
#TODO: Additional WPA supplicant feature like Enterprise mode etc. are yet to be supported.
405412
set(WPA_SUPPLICANT_SRCS "../port/wifi/wpa_supplicant/os_xtensa.c"

zephyr/esp32/include/bt/esp_bt.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,8 @@ typedef struct esp_vhci_host_callback {
483483
int (*notify_host_recv)(uint8_t *data, uint16_t len); /*!< Callback to notify the Host that the Controller has a packet to send */
484484
} esp_vhci_host_callback_t;
485485

486+
typedef void (*workitem_handler_t)(void *arg);
487+
486488
/**
487489
* @brief Check whether the Controller is ready to receive the packet
488490
*

zephyr/esp32/src/bt/esp_bt_adapter.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,6 @@ struct osi_funcs_t {
170170
uint32_t _magic;
171171
};
172172

173-
typedef void (*workitem_handler_t)(void *arg);
174-
175173
/* OSI */
176174
extern int btdm_osi_funcs_register(void *osi_funcs);
177175
/* Initialise and De-initialise */

zephyr/esp32c3/CMakeLists.txt

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -367,12 +367,6 @@ if(CONFIG_SOC_SERIES_ESP32C3)
367367
../../components/efuse/src/efuse_controller/keys/with_key_purposes/esp_efuse_api_key.c
368368
)
369369

370-
zephyr_sources_ifdef(
371-
CONFIG_BUILD_ONLY_NO_BLOBS
372-
../port/wifi/wifi_stubs.c
373-
../port/phy/phy_stubs.c
374-
)
375-
376370
zephyr_link_libraries_ifndef(
377371
CONFIG_BUILD_ONLY_NO_BLOBS
378372
net80211
@@ -388,10 +382,18 @@ if(CONFIG_SOC_SERIES_ESP32C3)
388382

389383
## BT definitions
390384
if (CONFIG_BT)
385+
391386
zephyr_sources(src/bt/esp_bt_adapter.c)
392387
zephyr_compile_definitions(CONFIG_BT_ENABLED)
393388

394-
zephyr_link_libraries(
389+
zephyr_sources_ifdef(
390+
CONFIG_BUILD_ONLY_NO_BLOBS
391+
../port/bluetooth/bt_stubs.c
392+
../port/phy/phy_stubs.c
393+
)
394+
395+
zephyr_link_libraries_ifndef(
396+
CONFIG_BUILD_ONLY_NO_BLOBS
395397
## ble
396398
btbb
397399
btdm_app
@@ -402,6 +404,12 @@ if(CONFIG_SOC_SERIES_ESP32C3)
402404
## WIFI definitions
403405
if (CONFIG_WIFI_ESP32)
404406

407+
zephyr_sources_ifdef(
408+
CONFIG_BUILD_ONLY_NO_BLOBS
409+
../port/wifi/wifi_stubs.c
410+
../port/phy/phy_stubs.c
411+
)
412+
405413
zephyr_sources(
406414
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_rtc_calib.c
407415
../../components/hal/adc_hal_common.c

zephyr/esp32c3/include/bt/esp_bt.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,22 @@ enum {
8585
ESP_BT_COEX_PHY_CODED_TX_RX_TIME_LIMIT_FORCE_ENABLE, /*!< Always Enable the limit */
8686
};
8787

88+
/* vendor dependent signals to be posted to controller task */
89+
typedef enum {
90+
BTDM_VND_OL_SIG_WAKEUP_TMR = 0,
91+
BTDM_VND_OL_SIG_NUM,
92+
} btdm_vnd_ol_sig_t;
93+
8894
#define ESP_BT_HCI_TL_STATUS_OK (0) /*!< HCI_TL Tx/Rx operation status OK */
8995

9096
/**
9197
* @brief callback function for HCI Transport Layer send/receive operations
9298
*/
9399
typedef void (* esp_bt_hci_tl_callback_t) (void *arg, uint8_t status);
94100

101+
/* prototype of function to handle vendor dependent signals */
102+
typedef void (* btdm_vnd_ol_task_func_t)(void *param);
103+
95104
#ifdef CONFIG_BT_ENABLED
96105

97106
#define BT_CTRL_BLE_MAX_ACT_LIMIT 10 //Maximum BLE activity limitation

zephyr/esp32c3/src/bt/esp_bt_adapter.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,6 @@ typedef union {
9292

9393
#define BLE_PWR_HDL_INVL 0xFFFF
9494

95-
typedef enum {
96-
BTDM_VND_OL_SIG_WAKEUP_TMR = 0,
97-
BTDM_VND_OL_SIG_NUM,
98-
} btdm_vnd_ol_sig_t;
99-
100-
/* prototype of function to handle vendor dependent signals */
101-
typedef void (* btdm_vnd_ol_task_func_t)(void *param);
102-
10395
typedef void (* irq_handler_t)(const void *param);
10496

10597
/* VHCI function interface */
@@ -235,7 +227,7 @@ extern int btdm_hci_tl_io_event_post(int event);
235227
/* VHCI */
236228
extern bool API_vhci_host_check_send_available(void);
237229
extern void API_vhci_host_send_packet(uint8_t *data, uint16_t len);
238-
extern int API_vhci_host_register_callback(const vhci_host_callback_t *callback);
230+
extern int API_vhci_host_register_callback(const esp_vhci_host_callback_t *callback);
239231
/* TX power */
240232
extern int ble_txpwr_set(int power_type, int power_level);
241233
extern int ble_txpwr_get(int power_type);
@@ -1013,7 +1005,7 @@ esp_err_t esp_vhci_host_register_callback(const esp_vhci_host_callback_t *callba
10131005
return ESP_FAIL;
10141006
}
10151007

1016-
return API_vhci_host_register_callback((const vhci_host_callback_t *)callback) == 0 ? ESP_OK : ESP_FAIL;
1008+
return API_vhci_host_register_callback((const esp_vhci_host_callback_t *)callback) == 0 ? ESP_OK : ESP_FAIL;
10171009
}
10181010

10191011

zephyr/esp32s3/CMakeLists.txt

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -400,12 +400,6 @@ if(CONFIG_SOC_SERIES_ESP32S3)
400400
../../components/efuse/src/efuse_controller/keys/with_key_purposes/esp_efuse_api_key.c
401401
)
402402

403-
zephyr_sources_ifdef(
404-
CONFIG_BUILD_ONLY_NO_BLOBS
405-
../port/wifi/wifi_stubs.c
406-
../port/phy/phy_stubs.c
407-
)
408-
409403
zephyr_link_libraries_ifndef(
410404
CONFIG_BUILD_ONLY_NO_BLOBS
411405
net80211
@@ -420,10 +414,18 @@ if(CONFIG_SOC_SERIES_ESP32S3)
420414

421415
## BT definitions
422416
if (CONFIG_BT)
417+
423418
zephyr_sources(src/bt/esp_bt_adapter.c)
424419
zephyr_compile_definitions(CONFIG_BT_ENABLED)
425420

426-
zephyr_link_libraries(
421+
zephyr_sources_ifdef(
422+
CONFIG_BUILD_ONLY_NO_BLOBS
423+
../port/bluetooth/bt_stubs.c
424+
../port/phy/phy_stubs.c
425+
)
426+
427+
zephyr_link_libraries_ifndef(
428+
CONFIG_BUILD_ONLY_NO_BLOBS
427429
## ble
428430
btbb
429431
btdm_app
@@ -434,6 +436,12 @@ if(CONFIG_SOC_SERIES_ESP32S3)
434436
## WIFI definitions
435437
if (CONFIG_WIFI_ESP32)
436438

439+
zephyr_sources_ifdef(
440+
CONFIG_BUILD_ONLY_NO_BLOBS
441+
../port/wifi/wifi_stubs.c
442+
../port/phy/phy_stubs.c
443+
)
444+
437445
set(WPA_SUPPLICANT_COMPONENT_DIR "../../components/wpa_supplicant")
438446
#TODO: Additional WPA supplicant feature like Enterprise mode etc. are yet to be supported.
439447
set(WPA_SUPPLICANT_SRCS "../port/wifi/wpa_supplicant/os_xtensa.c"

zephyr/esp32s3/include/bt/esp_bt.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,22 @@ enum {
8585
ESP_BT_COEX_PHY_CODED_TX_RX_TIME_LIMIT_FORCE_ENABLE, /*!< Always Enable the limit */
8686
};
8787

88+
/* vendor dependent signals to be posted to controller task */
89+
typedef enum {
90+
BTDM_VND_OL_SIG_WAKEUP_TMR = 0,
91+
BTDM_VND_OL_SIG_NUM,
92+
} btdm_vnd_ol_sig_t;
93+
8894
#define ESP_BT_HCI_TL_STATUS_OK (0) /*!< HCI_TL Tx/Rx operation status OK */
8995

9096
/**
9197
* @brief callback function for HCI Transport Layer send/receive operations
9298
*/
9399
typedef void (* esp_bt_hci_tl_callback_t) (void *arg, uint8_t status);
94100

101+
/* prototype of function to handle vendor dependent signals */
102+
typedef void (* btdm_vnd_ol_task_func_t)(void *param);
103+
95104
#ifdef CONFIG_BT_ENABLED
96105

97106
#define BT_CTRL_BLE_MAX_ACT_LIMIT 10 //Maximum BLE activity limitation

zephyr/esp32s3/src/bt/esp_bt_adapter.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,6 @@ typedef union {
9292

9393
#define BLE_PWR_HDL_INVL 0xFFFF
9494

95-
typedef enum {
96-
BTDM_VND_OL_SIG_WAKEUP_TMR = 0,
97-
BTDM_VND_OL_SIG_NUM,
98-
} btdm_vnd_ol_sig_t;
99-
100-
/* prototype of function to handle vendor dependent signals */
101-
typedef void (* btdm_vnd_ol_task_func_t)(void *param);
102-
10395
/* VHCI function interface */
10496
typedef struct vhci_host_callback {
10597
/* callback used to notify that the host can send packet to controller */
@@ -235,7 +227,7 @@ extern int btdm_hci_tl_io_event_post(int event);
235227
/* VHCI */
236228
extern bool API_vhci_host_check_send_available(void);
237229
extern void API_vhci_host_send_packet(uint8_t *data, uint16_t len);
238-
extern int API_vhci_host_register_callback(const vhci_host_callback_t *callback);
230+
extern int API_vhci_host_register_callback(const esp_vhci_host_callback_t *callback);
239231
/* TX power */
240232
extern int ble_txpwr_set(int power_type, int power_level);
241233
extern int ble_txpwr_get(int power_type);
@@ -1007,7 +999,7 @@ esp_err_t esp_vhci_host_register_callback(const esp_vhci_host_callback_t *callba
1007999
return ESP_FAIL;
10081000
}
10091001

1010-
return API_vhci_host_register_callback((const vhci_host_callback_t *)callback) == 0 ? ESP_OK : ESP_FAIL;
1002+
return API_vhci_host_register_callback((const esp_vhci_host_callback_t *)callback) == 0 ? ESP_OK : ESP_FAIL;
10111003
}
10121004

10131005

0 commit comments

Comments
 (0)