RIOT-OS/RIOT — pull request #1890 by kaspar030 (2014-10-28 10:33:29+00:00)
Title: core: ipc: introduce new IPC api

Here's take three on my IPC changes.

Difference from v2 (summary for anyone who took a look):
- not changing legacy API. Old API still in place. New functions use bmsg_* (for blobmsg or bigmsg). We can rename later, let's test old code first.
- I'm not using multiple "message endpoints" having a message queue each anymore. There were too many open questions of semantic behaviour unanswered. Now, every thread has one message receive queue, but a different way to receive messages for different ```msg_node_t```.

Changes:
I've introduced a new family of IPC functions (bmsg_*). The main differences are:
- A message sent using the bmsg_* API is just an anonymous buffer. A message send takes a buffer and it's size, not a msg_t structure.
- The buffer can have any size (probably wordsize is the limit)
- Messages are not sent to PIDs as recipient, but to "msg_node_t" pointers.
- Every thread has at least one message node (tcb->msg_node)
- A thread can initialize multiple msg_node_t, so it can receive messages for different "addresses". (e.g., a fs thread handling multiple file descriptors using these endpoints).
- It's possible to create a thread without messaging capabilities (e.g., for the idle thread).

WARNING:
Everything using message queues will need to change code as I didn't find a way to keep the old initialization in a sane way. Usually it's a simple two-line change, have look at the commit adapting everything to that msg_queue API.

This makes use of disableIRQ/enableIRQ throughout messaging, but does not use sched_yield yet. @Kijewski, I can still use thread_yield everywhere, it's just yielding too much, right?

Initial benchmarking shows that this is a little less than 5% slower in synthetik tests, both using the legacy API wrapper and when sending bmsg_ buffers. IMHO it's worth it for the added flexibility. Probably there's even room for optimization.

Please take a look at the concept.