Skip to content

Commit

Permalink
Generate bindings for IEEE802.15.4 radio on ESP32-C6/H2
Browse files Browse the repository at this point in the history
  • Loading branch information
jessebraham committed May 8, 2024
1 parent ad8f404 commit 7c7e5fc
Show file tree
Hide file tree
Showing 8 changed files with 406 additions and 1 deletion.
10 changes: 9 additions & 1 deletion esp-wifi-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,14 @@ fn configure_linker_for_chip(out: &PathBuf, chip: &str) -> Result<()> {
out,
&format!("ld/{chip}/rom_functions.x"),
"rom_functions.x",
)
)?;

if chip == "esp32c6" {
copy_file(out, "ld/esp32c6/rom_coexist.x", "rom_coexist.x")?;
copy_file(out, "ld/esp32c6/rom_phy.x", "rom_phy.x")?;
}

Ok(())
}

fn copy_file(out: &PathBuf, from: &str, to: &str) -> Result<()> {
Expand Down Expand Up @@ -216,6 +223,7 @@ fn copy_libraries(out: &PathBuf) -> Result<()> {

println!("cargo:rustc-link-lib={}", "ble_app");
println!("cargo:rustc-link-lib={}", "btbb");
println!("cargo:rustc-link-lib={}", "coexist");
println!("cargo:rustc-link-lib={}", "phy");
println!("cargo:rustc-link-lib={}", "wpa_supplicant");

Expand Down
22 changes: 22 additions & 0 deletions esp-wifi-sys/headers/esp_coex_i154.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef __COEXIST_I154_H__
#define __COEXIST_I154_H__

#ifdef CONFIG_SOC_IEEE802154_SUPPORTED
typedef enum {
IEEE802154_HIGH = 1,
IEEE802154_MIDDLE,
IEEE802154_LOW,
IEEE802154_IDLE,
IEEE802154_EVENT_MAX,
} ieee802154_coex_event_t;

void esp_coex_ieee802154_txrx_pti_set(ieee802154_coex_event_t event);
void esp_coex_ieee802154_ack_pti_set(ieee802154_coex_event_t event);
#endif

#endif
54 changes: 54 additions & 0 deletions esp-wifi-sys/headers/esp_modem_wrapper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* SPDX-FileCopyrightText: 2018-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/

#ifndef __ESP_MODEM_WRAPPER_INTERNAL_H__
#define __ESP_MODEM_WRAPPER_INTERNAL_H__

#ifdef __cplusplus
extern "C" {
#endif

#include <string.h>
#include <stdint.h>
#include <stdbool.h>

bool esp_coex_common_env_is_chip_wrapper(void);

void * esp_coex_common_spin_lock_create_wrapper(void);

uint32_t esp_coex_common_int_disable_wrapper(void *wifi_int_mux);

void esp_coex_common_int_restore_wrapper(void *wifi_int_mux, uint32_t tmp);

void esp_coex_common_task_yield_from_isr_wrapper(void);

void * esp_coex_common_semphr_create_wrapper(uint32_t max, uint32_t init);

void esp_coex_common_semphr_delete_wrapper(void *semphr);

int32_t esp_coex_common_semphr_take_wrapper(void *semphr, uint32_t block_time_tick);

int32_t esp_coex_common_semphr_give_wrapper(void *semphr);

void esp_coex_common_timer_disarm_wrapper(void *timer);

void esp_coex_common_timer_done_wrapper(void *ptimer);

void esp_coex_common_timer_setfn_wrapper(void *ptimer, void *pfunction, void *parg);

void esp_coex_common_timer_arm_us_wrapper(void *ptimer, uint32_t us, bool repeat);

void * esp_coex_common_malloc_internal_wrapper(size_t size);

#ifndef CONFIG_IDF_TARGET_ESP32
uint32_t esp_coex_common_clk_slowclk_cal_get_wrapper(void);
#endif

#ifdef __cplusplus
}
#endif

#endif
5 changes: 5 additions & 0 deletions esp-wifi-sys/include/include.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@ typedef int _lock_t;
#include "esp_coexist_adapter.h"
#endif

#if ( defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32H2) )
#include "esp_coexist.h"
#include "esp_coex_i154.h"
#endif

#include "esp_now.h"
47 changes: 47 additions & 0 deletions esp-wifi-sys/ld/esp32c6/rom_coexist.x
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* ROM function interface esp32c6.rom.coexist.ld for esp32c6
*
*
* Generated from ./target/esp32c6/interface-esp32c6.yml md5sum 06c13e133e0743d09b87aba30d3e213b
*
* Compatible with ROM where ECO version equal or greater to 0.
*
* THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT.
*/

/***************************************
Group rom_coexist
***************************************/

/* Functions */
esp_coex_rom_version_get = 0x40000afc;
coex_bt_release = 0x40000b00;
coex_bt_request = 0x40000b04;
coex_core_ble_conn_dyn_prio_get = 0x40000b08;
coex_core_event_duration_get = 0x40000b0c;
coex_core_pti_get = 0x40000b10;
coex_core_release = 0x40000b14;
coex_core_request = 0x40000b18;
coex_core_status_get = 0x40000b1c;
coex_core_timer_idx_get = 0x40000b20;
coex_event_duration_get = 0x40000b24;
coex_hw_timer_disable = 0x40000b28;
coex_hw_timer_enable = 0x40000b2c;
coex_hw_timer_set = 0x40000b30;
coex_schm_interval_set = 0x40000b34;
coex_schm_lock = 0x40000b38;
coex_schm_unlock = 0x40000b3c;
coex_status_get = 0x40000b40;
coex_wifi_release = 0x40000b44;
esp_coex_ble_conn_dynamic_prio_get = 0x40000b48;
/* Data (.data, .bss, .rodata) */
coex_env_ptr = 0x4087ffc4;
coex_pti_tab_ptr = 0x4087ffc0;
coex_schm_env_ptr = 0x4087ffbc;
coexist_funcs = 0x4087ffb8;
g_coa_funcs_p = 0x4087ffb4;
g_coex_param_ptr = 0x4087ffb0;
Loading

0 comments on commit 7c7e5fc

Please sign in to comment.