-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
77 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,57 @@ | ||
use ariel_os_threads::{create_raw, current_tid, yield_same, THREAD_COUNT}; | ||
use esp_wifi_sys::include::malloc; | ||
|
||
use crate::binary::c_types; | ||
|
||
static THREAD_SEMAPHORES: [usize; THREAD_COUNT] = [0; THREAD_COUNT]; | ||
|
||
pub(crate) fn setup(_timer: crate::TimeBase) { | ||
todo!() | ||
info!("{}:{} setup()", file!(), line!()); | ||
} | ||
|
||
pub(crate) fn disable() { | ||
todo!() | ||
info!("{}:{} disable()", file!(), line!()); | ||
} | ||
|
||
pub(crate) fn yield_task() { | ||
todo!() | ||
yield_same(); | ||
} | ||
|
||
pub(crate) fn current_task() -> *mut c_types::c_void { | ||
todo!() | ||
usize::from(current_tid().unwrap()) as *mut c_types::c_void | ||
} | ||
|
||
pub(crate) fn task_create( | ||
_task: extern "C" fn(*mut c_types::c_void), | ||
_param: *mut c_types::c_void, | ||
_task_stack_size: usize, | ||
task: extern "C" fn(*mut c_types::c_void), | ||
param: *mut c_types::c_void, | ||
task_stack_size: usize, | ||
) -> *mut c_types::c_void { | ||
todo!() | ||
} | ||
info!("{}:{} task_create()", file!(), line!()); | ||
let stack = unsafe { malloc(task_stack_size as u32) }; | ||
let stack_slice: &'static mut [u8] = | ||
unsafe { core::slice::from_raw_parts_mut(stack as *mut u8, task_stack_size as usize) }; | ||
|
||
pub(crate) fn delete_all_tasks() { | ||
todo!() | ||
let prio = 8; // same as ariel executor thread | ||
let core_affinity = None; | ||
let tid = unsafe { | ||
create_raw( | ||
task as usize, | ||
param as usize, | ||
stack_slice, | ||
prio, | ||
core_affinity, | ||
) | ||
}; | ||
usize::from(tid) as *const usize as *mut c_types::c_void | ||
} | ||
|
||
pub(crate) fn schedule_task_deletion(_task_handle: *mut c_types::c_void) { | ||
info!("{}:{} schedule_task_deletion()", file!(), line!()); | ||
todo!() | ||
} | ||
|
||
pub(crate) fn current_task_thread_semaphore() -> *mut c_types::c_void { | ||
info!("{}:{} current_task_thread_semaphore()", file!(), line!()); | ||
let tid = usize::from(current_tid().unwrap()); | ||
&THREAD_SEMAPHORES[tid] as *const usize as *mut c_types::c_void | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
use crate::binary::c_types; | ||
|
||
pub(crate) struct ThreadHandle { | ||
pub thread_semaphore: usize, | ||
} | ||
|
||
pub(crate) fn setup(_timer: crate::TimeBase) { | ||
info!("{}:{}", file!(), line!()); | ||
todo!() | ||
} | ||
|
||
pub(crate) fn disable() { | ||
info!("{}:{}", file!(), line!()); | ||
todo!() | ||
} | ||
|
||
pub(crate) fn yield_task() { | ||
info!("{}:{}", file!(), line!()); | ||
todo!() | ||
} | ||
|
||
pub(crate) fn current_task() -> *mut ThreadHandle { | ||
info!("{}:{}", file!(), line!()); | ||
todo!() | ||
} | ||
pub(crate) fn task_create( | ||
_task: extern "C" fn(*mut c_types::c_void), | ||
_param: *mut c_types::c_void, | ||
_task_stack_size: usize, | ||
) -> *mut c_types::c_void { | ||
info!("{}:{}", file!(), line!()); | ||
todo!() | ||
} | ||
|
||
pub(crate) fn schedule_task_deletion(_task_handle: *mut ThreadHandle) { | ||
info!("{}:{}", file!(), line!()); | ||
todo!() | ||
} |