From b8a4d5f9ffdb941acd40acd1dd9a596fca8ddee9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Quentin?= Date: Mon, 30 Sep 2024 14:07:41 +0200 Subject: [PATCH] Remove unused functions (#2254) --- esp-wifi/src/common_adapter/mod.rs | 30 +------------------------ esp-wifi/src/compat/timer_compat.rs | 35 +---------------------------- 2 files changed, 2 insertions(+), 63 deletions(-) diff --git a/esp-wifi/src/common_adapter/mod.rs b/esp-wifi/src/common_adapter/mod.rs index 471896df1..a2a5a3849 100644 --- a/esp-wifi/src/common_adapter/mod.rs +++ b/esp-wifi/src/common_adapter/mod.rs @@ -4,12 +4,7 @@ use esp_wifi_sys::include::timeval; use hal::{macros::ram, rng::Rng}; use crate::{ - binary::include::{ - esp_event_base_t, - esp_timer_create_args_t, - esp_timer_get_time, - esp_timer_handle_t, - }, + binary::include::{esp_event_base_t, esp_timer_get_time}, compat::{common::*, timer_compat::*}, hal, }; @@ -317,29 +312,6 @@ pub unsafe extern "C" fn esp_fill_random(dst: *mut u8, len: u32) { } } -#[no_mangle] -pub unsafe extern "C" fn esp_timer_stop(_handle: *mut ()) { - todo!("esp_timer_stop"); -} - -#[no_mangle] -pub unsafe extern "C" fn esp_timer_delete(_handle: *mut ()) { - todo!("esp_timer_delete"); -} - -#[no_mangle] -pub unsafe extern "C" fn esp_timer_start_once(_handle: *mut (), _timeout_us: u64) -> i32 { - todo!("esp_timer_start_once"); -} - -#[no_mangle] -pub unsafe extern "C" fn esp_timer_create( - args: *const esp_timer_create_args_t, - out_handle: *mut esp_timer_handle_t, -) -> i32 { - compat_esp_timer_create(args, out_handle) -} - #[no_mangle] pub unsafe extern "C" fn strrchr(_s: *const (), _c: u32) -> *const u8 { todo!("strrchr"); diff --git a/esp-wifi/src/compat/timer_compat.rs b/esp-wifi/src/compat/timer_compat.rs index b0fdd6aec..ca734a4d1 100644 --- a/esp-wifi/src/compat/timer_compat.rs +++ b/esp-wifi/src/compat/timer_compat.rs @@ -1,6 +1,6 @@ use crate::binary::{ c_types, - include::{esp_timer_create_args_t, esp_timer_handle_t, ets_timer}, + include::{esp_timer_create_args_t, ets_timer}, }; #[derive(Clone, Copy, Debug)] @@ -141,36 +141,3 @@ pub fn compat_timer_setfn( warn!("Failed to set timer function {:x}", ets_timer as usize); } } - -pub fn compat_esp_timer_create( - args: *const esp_timer_create_args_t, - out_handle: *mut esp_timer_handle_t, -) -> i32 { - unsafe { - debug!("esp_timer_create {:?} {:?}", (*args).callback, (*args).arg); - } - - critical_section::with(|_| unsafe { - if TIMERS.is_full() { - // TODO: should we return -1 instead? - panic!("ran out of timers"); - } - - let ets_timer = - crate::compat::malloc::calloc(1, core::mem::size_of::()).cast::(); - - _ = TIMERS.push(Timer { - ets_timer, - started: 0, - timeout: 0, - active: false, - periodic: false, - callback: TimerCallback::from(unwrap!(args.as_ref())), - }); - - debug!("esp_timer_create {:x}", ets_timer as usize); - *out_handle = ets_timer as _; - - 0 - }) -}