projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Modify the module selection page
[bertos.git]
/
bertos
/
kern
/
msg.h
diff --git
a/bertos/kern/msg.h
b/bertos/kern/msg.h
index ba584b764ba7d20e9629c01833f0efb90ebeed1e..05bbd7ef18c174782f6f368b3c3f7e2f595179cc 100644
(file)
--- a/
bertos/kern/msg.h
+++ b/
bertos/kern/msg.h
@@
-27,7
+27,7
@@
* the GNU General Public License.
*
* Copyright 2004 Develer S.r.l. (http://www.develer.com/)
* the GNU General Public License.
*
* Copyright 2004 Develer S.r.l. (http://www.develer.com/)
- * Copyright 1999,2001 Bern
ardo Innocenti <bernie@develer.com
>
+ * Copyright 1999,2001 Bern
ie Innocenti <bernie@codewiz.org
>
*
* -->
*
*
* -->
*
@@
-37,7
+37,7
@@
*
* \version $Id$
*
*
* \version $Id$
*
- * \author Bern
ardo Innocenti <bernie@develer.com
>
+ * \author Bern
ie Innocenti <bernie@codewiz.org
>
*
* \brief Simple inter-process messaging system
*
*
* \brief Simple inter-process messaging system
*
@@
-106,6
+106,8
@@
* } TestMsg;
*
*
* } TestMsg;
*
*
+ * static cpu_stack_t sender_stack[CONFIG_KERN_MINSTACKSIZE / sizeof(cpu_stack_t)];
+ *
* // A process that sends two messages and waits for replies.
* static void sender_proc(void)
* {
* // A process that sends two messages and waits for replies.
* static void sender_proc(void)
* {
@@
-114,30
+116,30
@@
* TestMsg msg2;
* Msg *reply;
*
* TestMsg msg2;
* Msg *reply;
*
- * msg_initPort(&reply_port,
- * event_createSignal(proc_current(), SIG
F
_SINGLE);
+ * msg_initPort(&
test_
reply_port,
+ * event_createSignal(proc_current(), SIG_SINGLE);
*
* // Fill-in first message and send it out.
* msg1.x = 3;
* msg1.y = 2;
* msg1.msg.replyPort = &test_reply_port;
*
* // Fill-in first message and send it out.
* msg1.x = 3;
* msg1.y = 2;
* msg1.msg.replyPort = &test_reply_port;
- * msg_put(&test_port, &msg1);
+ * msg_put(&test_port, &msg1
.msg
);
*
* // Fill-in second message and send it out too.
* msg2.x = 5;
* msg2.y = 4;
* msg2.msg.replyPort = &test_reply_port;
*
* // Fill-in second message and send it out too.
* msg2.x = 5;
* msg2.y = 4;
* msg2.msg.replyPort = &test_reply_port;
- * msg_put(&test_port, &msg
1
);
+ * msg_put(&test_port, &msg
2.msg
);
*
* // Wait for a reply...
* sig_wait(SIG_SINGLE);
*
*
* // Wait for a reply...
* sig_wait(SIG_SINGLE);
*
-
* reply = (TestMsg *)msg_get(&test_reply_port
);
+
reply = containerof(msg_get(&test_reply_port), TestMsg, msg
);
* ASSERT(reply != NULL);
* ASSERT(reply->result == 5);
*
* // Get reply to second message.
* ASSERT(reply != NULL);
* ASSERT(reply->result == 5);
*
* // Get reply to second message.
- * while (!(reply =
(TestMsg *)msg_get(&test_reply_port
))
+ * while (!(reply =
containerof(msg_get(&test_reply_port), TestMsg, msg)
))
* {
* // Not yet, be patient and wait some more.
* sig_wait(SIG_SINGLE);
* {
* // Not yet, be patient and wait some more.
* sig_wait(SIG_SINGLE);
@@
-151,23
+153,22
@@
* static void receiver_proc(void)
* {
* msg_initPort(&test_port,
* static void receiver_proc(void)
* {
* msg_initPort(&test_port,
- * event_createSignal(proc_current(), SIG
F
_EXAMPLE);
+ * event_createSignal(proc_current(), SIG_EXAMPLE);
*
*
- * proc_new(sender_proc, (iptr_t)&test_port,
- * sender_stack, sizeof(sender_stack);
+ * proc_new(sender_proc, NULL,sizeof(sender_stack), sender_stack);
*
* for (;;)
* {
*
* for (;;)
* {
- * sigmask_t sigs = sig_wait(SIG
F
_EXAMPLE | more_signals);
+ * sigmask_t sigs = sig_wait(SIG_EXAMPLE | more_signals);
*
*
- * if (sigs & SIG
F
_EXAMPLE)
+ * if (sigs & SIG_EXAMPLE)
* {
* TestMsg *emsg;
* {
* TestMsg *emsg;
- * while
(emsg = (TestMsg *)msg_get(&test_port
)
+ * while
((emsg = containerof(msg_get(&test_port), TestMsg, msg))
)
* {
* // Do something with the message
* emsg->result = emsg->x + emsg->y;
* {
* // Do something with the message
* emsg->result = emsg->x + emsg->y;
- * msg_reply(
(Msg *)
msg);
+ * msg_reply(
emsg->
msg);
* }
* }
* }
* }
* }
* }
@@
-180,7
+181,7
@@
#define KERN_MSG_H
#include <mware/event.h>
#define KERN_MSG_H
#include <mware/event.h>
-#include <
mware
/list.h>
+#include <
struct
/list.h>
#include <kern/proc.h>
typedef struct MsgPort
#include <kern/proc.h>
typedef struct MsgPort