X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=kern%2Fmsg.h;h=32232c56e018d3e2d487bddfb318fc840a50a96c;hb=HEAD;hp=d9b06707cc37d62be7427eaf2824650cc43c4664;hpb=277b540c0764dd376dcf583acdc97a2b2fd3d8e6;p=bertos.git diff --git a/kern/msg.h b/kern/msg.h deleted file mode 100755 index d9b06707..00000000 --- a/kern/msg.h +++ /dev/null @@ -1,79 +0,0 @@ -/*! - * \file - * - * - * \brief Simple inter-process messaging system - * - * This module implements a common system for executing - * a user defined action calling a hook function. - * - * \version $Id$ - * - * \author Bernardo Innocenti - */ - -/*#* - *#* $Log$ - *#* Revision 1.3 2004/08/25 14:12:09 rasky - *#* Aggiornato il comment block dei log RCS - *#* - *#* Revision 1.2 2004/08/14 19:37:57 rasky - *#* Merge da SC: macros.h, pool.h, BIT_CHANGE, nome dei processi, etc. - *#* - *#* Revision 1.1 2004/06/06 15:11:08 bernie - *#* Import into DevLib. - *#* - *#*/ -#ifndef KERN_MSG_H -#define KERN_MSG_H - -#include "event.h" -#include - - -typedef struct MsgPort -{ - List queue; /*!< Messages queued at this port */ - Event evn; /*!< Event to trigger when a message arrives */ -} MsgPort; - - -typedef struct Msg -{ - Node link; /*!< Link into message port queue */ - MsgPort *replyPort; /*!< Port to which the msg is to be replied */ - /* User data may follow */ -} Msg; - - -/*! Initialize a message port */ -INLINE void msg_initPort(MsgPort* port, Event event) -{ - INITLIST(&port->queue); - port->evn = event; -} - -/*! Queue \a msg into \a port, triggering the associated event */ -INLINE void msg_put(MsgPort* port, Msg* msg) -{ - ADDTAIL(&port->queue, &msg->link); - event_do(&port->evn); -} - -/* Get the first message from the queue of \a port, or NULL if the port is empty */ -INLINE Msg* msg_get(MsgPort* port) -{ - return (Msg*)REMHEAD(&port->queue); -} - -/*! Send back (reply) \a msg to its sender */ -INLINE void msg_reply(Msg* msg) -{ - msg_put(msg->replyPort, msg); -} - -#endif /* KERN_MSG_H */