X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fkern%2Fsignal.h;h=70506fe12f6021339a43443cfdbfac6ed1de969a;hb=3426a97f08f988d40cf01a5bfb18fb4a3f7281ce;hp=de3dc5ec7e80385b1e25f8860c36dc5284a5051d;hpb=f87964692a608f5dc71d84418f9ffa2b70d54368;p=bertos.git diff --git a/bertos/kern/signal.h b/bertos/kern/signal.h index de3dc5ec..70506fe1 100644 --- a/bertos/kern/signal.h +++ b/bertos/kern/signal.h @@ -31,14 +31,17 @@ * * --> * - * \brief Signal module (public interface). + * \defgroup kern_signal Kernel signals + * \ingroup kern + * \{ + * + * \brief Signal module for IPC. * - * \version $Id$ * * \author Bernie Innocenti * * $WIZ$ module_name = "signal" - * $WIZ$ module_depends = "kernel" + * $WIZ$ module_depends = "kernel", "timer" * $WIZ$ module_configuration = "bertos/cfg/cfg_signal.h" */ @@ -46,16 +49,65 @@ #define KERN_SIGNAL_H #include +#include // BV() -/* Fwd decl */ -struct Process; +#include + +#if CONFIG_KERN_SIGNALS /* Inter-process Communication services */ -sigmask_t sig_check(sigmask_t sigs); -void sig_signal(struct Process *proc, sigmask_t sig); -sigmask_t sig_wait(sigmask_t sigs); -sigmask_t sig_waitTimeout(sigmask_t sigs, ticks_t timeout); +sigmask_t sig_checkSignal(Signal *s, sigmask_t sigs); + +INLINE sigmask_t sig_check(sigmask_t sigs) +{ + Process *proc = proc_current(); + return sig_checkSignal(&proc->sig, sigs); +} + +void sig_sendSignal(Signal *s, Process *proc, sigmask_t sig); + +INLINE void sig_send(Process *proc, sigmask_t sig) +{ + sig_sendSignal(&proc->sig, proc, sig); +} + +void sig_postSignal(Signal *s, Process *proc, sigmask_t sig); + +INLINE void sig_post(Process *proc, sigmask_t sig) +{ + sig_postSignal(&proc->sig, proc, sig); +} +/* + * XXX: this is provided for backword compatibility, consider to make this + * deprecated for the future. + */ +INLINE void sig_signal(Process *proc, sigmask_t sig) +{ + sig_postSignal(&proc->sig, proc, sig); +} + +sigmask_t sig_waitSignal(Signal *s, sigmask_t sigs); + +INLINE sigmask_t sig_wait(sigmask_t sigs) +{ + Process *proc = proc_current(); + return sig_waitSignal(&proc->sig, sigs); +} + +sigmask_t sig_waitTimeoutSignal(Signal *s, sigmask_t sigs, ticks_t timeout); + +INLINE sigmask_t sig_waitTimeout(sigmask_t sigs, ticks_t timeout) +{ + Process *proc = proc_current(); + return sig_waitTimeoutSignal(&proc->sig, sigs, timeout); +} + +#endif /* CONFIG_KERN_SIGNALS */ + +int signal_testRun(void); +int signal_testSetup(void); +int signal_testTearDown(void); /** * \name Signal definitions @@ -71,4 +123,6 @@ sigmask_t sig_waitTimeout(sigmask_t sigs, ticks_t timeout); #define SIG_SINGLE BV(7) /**< Used to wait for a single event */ /*\}*/ +/* \} */ //defgroup kern_signal + #endif /* KERN_SIGNAL_H */