xous: add can_call_from_interrupt() to SysCall

This function can be used to determine if a particular syscall may be
called from an interrupt context.

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2020-11-01 16:26:33 +08:00
parent 719549a2cb
commit bb304d412a

View file

@ -847,6 +847,16 @@ impl SysCall {
_ => None,
}
}
/// Returns `true` if the given syscall may be called from an IRQ context
pub fn can_call_from_interrupt(&self) -> bool {
matches!(self, SysCall::TrySendMessage(_, _)
| SysCall::TryConnect(_)
| SysCall::ReturnToParent(_, _)
| SysCall::ReturnScalar2(_, _, _)
| SysCall::ReturnScalar1(_, _)
| SysCall::ReturnMemory(_, _))
}
}
extern "Rust" {