mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #19998 from fabian18/gnrc_static_messge_queues
gnrc: make message queues static
This commit is contained in:
commit
d252eb7395
@ -46,7 +46,8 @@ static int queue_msg(thread_t *target, const msg_t *m)
|
|||||||
int n = cib_put(&(target->msg_queue));
|
int n = cib_put(&(target->msg_queue));
|
||||||
|
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
DEBUG("queue_msg(): message queue is full (or there is none)\n");
|
DEBUG("queue_msg(): message queue of thread %" PRIkernel_pid
|
||||||
|
" is full (or there is none)\n", target->pid);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,9 +122,13 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* @brief Default stack size to use for the IPv6 thread
|
* @brief Default stack size to use for the IPv6 thread
|
||||||
|
*
|
||||||
|
* @note The message queue was previously allocated on the stack.
|
||||||
|
* The default number of messages is 2³.
|
||||||
|
* Given sizeof(msg_t) == 8, the stack size is reduced by 64 bytes.
|
||||||
*/
|
*/
|
||||||
#ifndef GNRC_IPV6_STACK_SIZE
|
#ifndef GNRC_IPV6_STACK_SIZE
|
||||||
#define GNRC_IPV6_STACK_SIZE (THREAD_STACKSIZE_DEFAULT)
|
#define GNRC_IPV6_STACK_SIZE ((THREAD_STACKSIZE_DEFAULT) - 64)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -62,9 +62,13 @@ extern "C" {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Stack size used for the pktdump thread
|
* @brief Stack size used for the pktdump thread
|
||||||
|
*
|
||||||
|
* @note The message queue was previously allocated on the stack.
|
||||||
|
* The default number of messages is 2³.
|
||||||
|
* Given sizeof(msg_t) == 8, the stack size is reduced by 64 bytes.
|
||||||
*/
|
*/
|
||||||
#ifndef GNRC_PKTDUMP_STACKSIZE
|
#ifndef GNRC_PKTDUMP_STACKSIZE
|
||||||
#define GNRC_PKTDUMP_STACKSIZE (THREAD_STACKSIZE_MAIN)
|
#define GNRC_PKTDUMP_STACKSIZE ((THREAD_STACKSIZE_MAIN) - 64)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,9 +30,13 @@ extern "C" {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Default stack size to use for the 6LoWPAN thread.
|
* @brief Default stack size to use for the 6LoWPAN thread.
|
||||||
|
*
|
||||||
|
* @note The message queue was previously allocated on the stack.
|
||||||
|
* The default number of messages is 2³.
|
||||||
|
* Given sizeof(msg_t) == 8, the stack size is reduced by 64 bytes.
|
||||||
*/
|
*/
|
||||||
#ifndef GNRC_SIXLOWPAN_STACK_SIZE
|
#ifndef GNRC_SIXLOWPAN_STACK_SIZE
|
||||||
#define GNRC_SIXLOWPAN_STACK_SIZE (THREAD_STACKSIZE_DEFAULT)
|
#define GNRC_SIXLOWPAN_STACK_SIZE ((THREAD_STACKSIZE_DEFAULT) - 64)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,9 +57,13 @@ extern "C" {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Default stack size to use for the UDP thread
|
* @brief Default stack size to use for the UDP thread
|
||||||
|
*
|
||||||
|
* @note The message queue was previously allocated on the stack.
|
||||||
|
* The default number of messages is 2³.
|
||||||
|
* Given sizeof(msg_t) == 8, the stack size is reduced by 64 bytes.
|
||||||
*/
|
*/
|
||||||
#ifndef GNRC_UDP_STACK_SIZE
|
#ifndef GNRC_UDP_STACK_SIZE
|
||||||
#define GNRC_UDP_STACK_SIZE (THREAD_STACKSIZE_SMALL)
|
#define GNRC_UDP_STACK_SIZE ((THREAD_STACKSIZE_SMALL) - 64)
|
||||||
#endif
|
#endif
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
#define _MAX_L2_ADDR_LEN (8U)
|
#define _MAX_L2_ADDR_LEN (8U)
|
||||||
|
|
||||||
static char _stack[GNRC_IPV6_STACK_SIZE + DEBUG_EXTRA_STACKSIZE];
|
static char _stack[GNRC_IPV6_STACK_SIZE + DEBUG_EXTRA_STACKSIZE];
|
||||||
|
static msg_t _msg_q[GNRC_IPV6_MSG_QUEUE_SIZE];
|
||||||
|
|
||||||
#ifdef MODULE_FIB
|
#ifdef MODULE_FIB
|
||||||
/**
|
/**
|
||||||
@ -172,12 +173,12 @@ static void _dispatch_next_header(gnrc_pktsnip_t *pkt, unsigned nh,
|
|||||||
|
|
||||||
static void *_event_loop(void *args)
|
static void *_event_loop(void *args)
|
||||||
{
|
{
|
||||||
msg_t msg, reply, msg_q[GNRC_IPV6_MSG_QUEUE_SIZE];
|
msg_t msg, reply;
|
||||||
gnrc_netreg_entry_t me_reg = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL,
|
gnrc_netreg_entry_t me_reg = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL,
|
||||||
thread_getpid());
|
thread_getpid());
|
||||||
|
|
||||||
(void)args;
|
(void)args;
|
||||||
msg_init_queue(msg_q, GNRC_IPV6_MSG_QUEUE_SIZE);
|
msg_init_queue(_msg_q, GNRC_IPV6_MSG_QUEUE_SIZE);
|
||||||
|
|
||||||
/* initialize fragmentation data-structures */
|
/* initialize fragmentation data-structures */
|
||||||
#ifdef MODULE_GNRC_IPV6_EXT_FRAG
|
#ifdef MODULE_GNRC_IPV6_EXT_FRAG
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
static kernel_pid_t _pid = KERNEL_PID_UNDEF;
|
static kernel_pid_t _pid = KERNEL_PID_UNDEF;
|
||||||
|
|
||||||
static char _stack[GNRC_SIXLOWPAN_STACK_SIZE + DEBUG_EXTRA_STACKSIZE];
|
static char _stack[GNRC_SIXLOWPAN_STACK_SIZE + DEBUG_EXTRA_STACKSIZE];
|
||||||
|
static msg_t _msg_q[GNRC_SIXLOWPAN_MSG_QUEUE_SIZE];
|
||||||
|
|
||||||
/* handles GNRC_NETAPI_MSG_TYPE_RCV commands */
|
/* handles GNRC_NETAPI_MSG_TYPE_RCV commands */
|
||||||
static void _receive(gnrc_pktsnip_t *pkt);
|
static void _receive(gnrc_pktsnip_t *pkt);
|
||||||
@ -385,12 +386,12 @@ static void _continue_fragmenting(gnrc_sixlowpan_frag_fb_t *fbuf)
|
|||||||
|
|
||||||
static void *_event_loop(void *args)
|
static void *_event_loop(void *args)
|
||||||
{
|
{
|
||||||
msg_t msg, reply, msg_q[GNRC_SIXLOWPAN_MSG_QUEUE_SIZE];
|
msg_t msg, reply;
|
||||||
gnrc_netreg_entry_t me_reg = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL,
|
gnrc_netreg_entry_t me_reg = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL,
|
||||||
thread_getpid());
|
thread_getpid());
|
||||||
|
|
||||||
(void)args;
|
(void)args;
|
||||||
msg_init_queue(msg_q, GNRC_SIXLOWPAN_MSG_QUEUE_SIZE);
|
msg_init_queue(_msg_q, GNRC_SIXLOWPAN_MSG_QUEUE_SIZE);
|
||||||
|
|
||||||
/* register interest in all 6LoWPAN packets */
|
/* register interest in all 6LoWPAN packets */
|
||||||
gnrc_netreg_register(GNRC_NETTYPE_SIXLOWPAN, &me_reg);
|
gnrc_netreg_register(GNRC_NETTYPE_SIXLOWPAN, &me_reg);
|
||||||
|
@ -44,6 +44,7 @@ kernel_pid_t gnrc_pktdump_pid = KERNEL_PID_UNDEF;
|
|||||||
* @brief Stack for the pktdump thread
|
* @brief Stack for the pktdump thread
|
||||||
*/
|
*/
|
||||||
static char _stack[GNRC_PKTDUMP_STACKSIZE];
|
static char _stack[GNRC_PKTDUMP_STACKSIZE];
|
||||||
|
static msg_t _msg_queue[GNRC_PKTDUMP_MSG_QUEUE_SIZE];
|
||||||
|
|
||||||
static void _dump_snip(gnrc_pktsnip_t *pkt)
|
static void _dump_snip(gnrc_pktsnip_t *pkt)
|
||||||
{
|
{
|
||||||
@ -166,10 +167,9 @@ static void *_eventloop(void *arg)
|
|||||||
{
|
{
|
||||||
(void)arg;
|
(void)arg;
|
||||||
msg_t msg, reply;
|
msg_t msg, reply;
|
||||||
msg_t msg_queue[GNRC_PKTDUMP_MSG_QUEUE_SIZE];
|
|
||||||
|
|
||||||
/* setup the message queue */
|
/* setup the message queue */
|
||||||
msg_init_queue(msg_queue, GNRC_PKTDUMP_MSG_QUEUE_SIZE);
|
msg_init_queue(_msg_queue, GNRC_PKTDUMP_MSG_QUEUE_SIZE);
|
||||||
|
|
||||||
reply.content.value = (uint32_t)(-ENOTSUP);
|
reply.content.value = (uint32_t)(-ENOTSUP);
|
||||||
reply.type = GNRC_NETAPI_MSG_TYPE_ACK;
|
reply.type = GNRC_NETAPI_MSG_TYPE_ACK;
|
||||||
|
@ -43,6 +43,7 @@ static kernel_pid_t _pid = KERNEL_PID_UNDEF;
|
|||||||
* @brief Allocate memory for the UDP thread's stack
|
* @brief Allocate memory for the UDP thread's stack
|
||||||
*/
|
*/
|
||||||
static char _stack[GNRC_UDP_STACK_SIZE + DEBUG_EXTRA_STACKSIZE];
|
static char _stack[GNRC_UDP_STACK_SIZE + DEBUG_EXTRA_STACKSIZE];
|
||||||
|
static msg_t _msg_queue[GNRC_UDP_MSG_QUEUE_SIZE];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Calculate the UDP checksum dependent on the network protocol
|
* @brief Calculate the UDP checksum dependent on the network protocol
|
||||||
@ -220,14 +221,13 @@ static void *_event_loop(void *arg)
|
|||||||
{
|
{
|
||||||
(void)arg;
|
(void)arg;
|
||||||
msg_t msg, reply;
|
msg_t msg, reply;
|
||||||
msg_t msg_queue[GNRC_UDP_MSG_QUEUE_SIZE];
|
|
||||||
gnrc_netreg_entry_t netreg = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL,
|
gnrc_netreg_entry_t netreg = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL,
|
||||||
thread_getpid());
|
thread_getpid());
|
||||||
/* preset reply message */
|
/* preset reply message */
|
||||||
reply.type = GNRC_NETAPI_MSG_TYPE_ACK;
|
reply.type = GNRC_NETAPI_MSG_TYPE_ACK;
|
||||||
reply.content.value = (uint32_t)-ENOTSUP;
|
reply.content.value = (uint32_t)-ENOTSUP;
|
||||||
/* initialize message queue */
|
/* initialize message queue */
|
||||||
msg_init_queue(msg_queue, GNRC_UDP_MSG_QUEUE_SIZE);
|
msg_init_queue(_msg_queue, GNRC_UDP_MSG_QUEUE_SIZE);
|
||||||
/* register UPD at netreg */
|
/* register UPD at netreg */
|
||||||
gnrc_netreg_register(GNRC_NETTYPE_UDP, &netreg);
|
gnrc_netreg_register(GNRC_NETTYPE_UDP, &netreg);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user