mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
sleep_ms() bug exhibitition
This commit is contained in:
parent
6677d79834
commit
184a284da5
3 changed files with 35 additions and 10 deletions
|
|
@ -12,7 +12,7 @@ pub fn callback_thread(_: u32) {
|
|||
if CB_RUN.load(Ordering::Relaxed) {
|
||||
|
||||
CB_RUN.store(false, Ordering::Relaxed);
|
||||
ticktimer_server::sleep_ms(ticktimer_conn, 2000).unwrap();
|
||||
ticktimer_server::sleep_ms(ticktimer_conn, 10000).unwrap();
|
||||
// just send a bogus message
|
||||
xous::send_message(callback_conn, Message::Scalar(ScalarMessage{
|
||||
id: 0xdeadbeef, arg1: 0, arg2: 0, arg3: 0, arg4: 0,
|
||||
|
|
@ -38,7 +38,7 @@ impl CallBack {
|
|||
}
|
||||
|
||||
impl<'a> ShellCmdApi<'a> for CallBack {
|
||||
cmd_api!(callback);
|
||||
cmd_api!(cb);
|
||||
|
||||
fn process(&mut self, _args: String::<1024>, _env: &mut CommonEnv) -> Result<Option<String::<1024>>, xous::Error> {
|
||||
use core::fmt::Write;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
use xous::{Message, ScalarMessage};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct TimerToken {
|
||||
token: u64, // this field is 48 bits wide, random number
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Opcode {
|
||||
/// Reset the timer
|
||||
|
|
@ -13,6 +18,24 @@ pub enum Opcode {
|
|||
|
||||
/// Recalculate the sleep time
|
||||
RecalculateSleep,
|
||||
/*
|
||||
////////// new APIs
|
||||
/// Subscribe to wakeup alarms. Takes in the server name that's subcribed, returns a Token to refer to the subscription.
|
||||
SubscribeWakeup(xous::String::<64>),
|
||||
|
||||
/// set an alarm in milliseconds, which is returned via the SubscribeWakeup registration token
|
||||
WakeupAlarm(u16, TimerToken),
|
||||
|
||||
/// The generic message that gets sent to other servers, at the alarm time
|
||||
WakeupMessage,
|
||||
|
||||
/// Request a blocking, in-line delay server -- returns a CID that can be used to send the BlockingDelayMs message
|
||||
/// each request consumes a thread in the ticktimer that tracks & responds to a blockingdelay
|
||||
RequestBlockingDelay,
|
||||
|
||||
/// Do a blocking delay. Responds with the current ElapsedMs by default.
|
||||
BlockingDelayMs(u32),
|
||||
*/
|
||||
}
|
||||
|
||||
impl<'a> core::convert::TryFrom<&'a Message> for Opcode {
|
||||
|
|
|
|||
|
|
@ -349,14 +349,16 @@ fn xmain() -> ! {
|
|||
.expect("TickTimer: couldn't return time request");
|
||||
//info!("TickTimer: done returning value");
|
||||
}
|
||||
Opcode::SleepMs(ms) => recalculate_sleep(
|
||||
&mut ticktimer,
|
||||
&mut sleep_heap,
|
||||
Some(SleepResponse {
|
||||
msec: ms,
|
||||
sender: envelope.sender,
|
||||
}),
|
||||
),
|
||||
Opcode::SleepMs(ms) => {
|
||||
recalculate_sleep(
|
||||
&mut ticktimer,
|
||||
&mut sleep_heap,
|
||||
Some(SleepResponse {
|
||||
msec: ms,
|
||||
sender: envelope.sender,
|
||||
}),
|
||||
);
|
||||
}
|
||||
Opcode::RecalculateSleep => {
|
||||
recalculate_sleep(&mut ticktimer, &mut sleep_heap, None);
|
||||
//info!("TickTimer: Done recalculating");
|
||||
|
|
|
|||
Loading…
Reference in a new issue