1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

examples: adjusted output and README for IPC pingpong

This commit is contained in:
Hauke Petersen 2014-05-14 15:11:01 +02:00
parent fbdc18cd63
commit 279b5cc5ca
2 changed files with 29 additions and 27 deletions

View File

@ -10,28 +10,28 @@ an incrementing number back to the main thread.
The correct output should look like this:
```
kernel_init(): This is RIOT! (Version: xxx)
This is RIOT! (Version: xxx)
kernel_init(): jumping into first task...
Hello world!
second_thread starting.
2nd: got msg from 1
Got msg with content 2
2nd: got msg from 1
Got msg with content 3
2nd: got msg from 1
Got msg with content 4
2nd: got msg from 1
Got msg with content 5
2nd: got msg from 1
Got msg with content 6
2nd: got msg from 1
Got msg with content 7
2nd: got msg from 1
Got msg with content 8
2nd: got msg from 1
Got msg with content 9
2nd: got msg from 1
Got msg with content 10
2nd: got msg from 1
Starting IPC Ping-pong example...
1st thread started, pid: 1
2nd thread started, pid: 2
2nd: Got msg from 1
1st: Got msg with content 2
2nd: Got msg from 1
1st: Got msg with content 3
2nd: Got msg from 1
1st: Got msg with content 4
2nd: Got msg from 1
1st: Got msg with content 5
2nd: Got msg from 1
1st: Got msg with content 6
2nd: Got msg from 1
1st: Got msg with content 7
2nd: Got msg from 1
1st: Got msg with content 8
2nd: Got msg from 1
1st: Got msg with content 9
2nd: Got msg from 1
1st: Got msg with content 10
[...]
```

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2013 Freie Universität Berlin
* Copyright (C) 2014 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser General
* Public License. See the file LICENSE in the top level directory for more
@ -14,6 +14,7 @@
* @brief IPC pingpong application
*
* @author Kaspar Schleiser <kaspar@schleiser.de>
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
*
* @}
*/
@ -26,12 +27,12 @@
void second_thread(void)
{
printf("second_thread starting.\n");
printf("2nd thread started, pid: %i\n", thread_getpid());
msg_t m;
while (1) {
msg_receive(&m);
printf("2nd: got msg from %i\n", m.sender_pid);
printf("2nd: Got msg from %i\n", m.sender_pid);
m.content.value++;
msg_reply(&m, &m);
}
@ -41,7 +42,8 @@ char second_thread_stack[KERNEL_CONF_STACKSIZE_MAIN];
int main(void)
{
printf("Hello world!\n");
printf("Starting IPC Ping-pong example...\n");
printf("1st thread started, pid: %i\n", thread_getpid());
msg_t m;
@ -53,6 +55,6 @@ int main(void)
while (1) {
msg_send_receive(&m, &m, pid);
printf("Got msg with content %u\n", m.content.value);
printf("1st: Got msg with content %u\n", (unsigned int)m.content.value);
}
}