Remove unused functions (#2254)

This commit is contained in:
Björn Quentin 2024-09-30 14:07:41 +02:00 committed by GitHub
parent 11c73caf89
commit b8a4d5f9ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 63 deletions

View File

@ -4,12 +4,7 @@ use esp_wifi_sys::include::timeval;
use hal::{macros::ram, rng::Rng}; use hal::{macros::ram, rng::Rng};
use crate::{ use crate::{
binary::include::{ binary::include::{esp_event_base_t, esp_timer_get_time},
esp_event_base_t,
esp_timer_create_args_t,
esp_timer_get_time,
esp_timer_handle_t,
},
compat::{common::*, timer_compat::*}, compat::{common::*, timer_compat::*},
hal, 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] #[no_mangle]
pub unsafe extern "C" fn strrchr(_s: *const (), _c: u32) -> *const u8 { pub unsafe extern "C" fn strrchr(_s: *const (), _c: u32) -> *const u8 {
todo!("strrchr"); todo!("strrchr");

View File

@ -1,6 +1,6 @@
use crate::binary::{ use crate::binary::{
c_types, 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)] #[derive(Clone, Copy, Debug)]
@ -141,36 +141,3 @@ pub fn compat_timer_setfn(
warn!("Failed to set timer function {:x}", ets_timer as usize); 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::<ets_timer>()).cast::<ets_timer>();
_ = 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
})
}