+// Settings for the test message.
+//Process 0
+#define INC_PROC_T0 1
+#define DELAY_PROC_T0 INC_PROC_T0*DELAY
+//Process 1
+#define INC_PROC_T1 3
+#define DELAY_PROC_T1 INC_PROC_T1*DELAY
+//Process 2
+#define INC_PROC_T2 5
+#define DELAY_PROC_T2 INC_PROC_T2*DELAY
+//Process 3
+#define INC_PROC_T3 7
+#define DELAY_PROC_T3 INC_PROC_T3*DELAY
+//Process 4
+#define INC_PROC_T4 11
+#define DELAY_PROC_T4 INC_PROC_T4*DELAY
+//Process 5
+#define INC_PROC_T5 13
+#define DELAY_PROC_T5 INC_PROC_T5*DELAY
+
+/*
+ * These macros generate the code needed to create the test process functions.
+ */
+#define RECV_PROC(num, sig) static void receiver_proc##num(void) \
+ { \
+ TestMsg *rec_msg; \
+ for (;;) \
+ { \
+ sig_wait(sig); \
+ kprintf("Proc[%d]..get message\n", num); \
+ rec_msg = containerof(msg_get(&test_port##num), TestMsg, msg); \
+ timer_delay(rec_msg->delay); \
+ rec_msg->result += rec_msg->val; \
+ kprintf("Proc[%d]..process message val[%d],delay[%d],res[%d]\n", num, rec_msg->val, rec_msg->delay, rec_msg->result); \
+ msg_reply(&rec_msg->msg); \
+ kprintf("Proc[%d] reply\n", num); \
+ } \
+ }
+
+#define SEND_MSG(num) \
+ do { \
+ kprintf("Main send message to proc[%d]\n", num); \
+ msg##num.msg.replyPort = &test_portMain; \
+ msg_put(&test_port##num, &msg##num.msg); \
+ } while(0)