RIOT-OS/RIOT — pull request #1270 by kaspar030 (2014-06-03 20:10:31+00:00)
Title: core: Improve core IPC

WIP

This is the first iteration of my IPC rework.

I'm trying to:
1. make it possible to send large messages (more than type+value)
2. decouple threads / message endpoints
3. make the API more consistent

If you want to try this, beware some API changes (in order to get old code running):
1. msg_t is now called msg_pulse_t
2. Functions for sending these "pulse" messages are renamed to "msg_*_pulse" (e.g., msg_send_pulse/msg_receive_pulse)
3. msg_send_pulse doesn't take the "block" parameter. Use msg_try_send_pulse instead
4. msg queues are now a module. add "USEMODULE += msg_queue lib" to your Makefile if you need them
5. msg queues have to be initialized differently:
use
```char queue_buf[MSG_QUEUE_SPACE()];
thread_msg_queue_init(queue_buf, sizeof(queue_buf), 0);``` to get the old behaviour.

I've converted some of the tests and some random other code while testing.

The final API will be split in two: one for pulses which can be sent from thread to thread, and one ```raw``` API that can be used to send arbitrary buffers from msg_node_t to msg_node_t. Every thread has at least one msg_node_t (unless created with CREAT_NOMSG). Internally, pulses are implemented using the raw API. In the long run, I expect every non-trivial program to use the raw API, that's why these functions are "msg_send" and it's not "msg_send" for pulse and "msg_send_raw" for the new API.

Working so far (in my limited testing):
1. Old code runs using new pulse API
2. simple large message tests work
3. Message queues work for both pulses and large messages
4. Send functions accept (require) msg_node_t target parameter

Todo:
1. convert receive functions to use msg_node_t other than current treads
2. test/fix/design the interesting cases for multiple msg_node per thread
3. ...

This is work in progress. While I like the overall direction, some things need refinement (e.g., the different msg/tcb/queue/msg_node structs are connected like a spider web).