From c07976077731e6da417b204ab8b01f9674e12fa7 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Mon, 14 Dec 2020 15:42:22 +0800 Subject: [PATCH] sched/mqueue: Make the pre-allocated irq messages configurable the message can't be dynamically allocated in any irq handler so it's important to let the user extend the number as needed Signed-off-by: Xiang Xiao Change-Id: Ia26584c3815bac6cf24de4c88be0844ac8e8fba2 --- sched/Kconfig | 6 ++++++ sched/mqueue/mq_initialize.c | 2 +- sched/mqueue/mqueue.h | 6 ------ 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sched/Kconfig b/sched/Kconfig index 591e18641d..2a41d1cb19 100644 --- a/sched/Kconfig +++ b/sched/Kconfig @@ -1536,6 +1536,12 @@ config PREALLOC_MQ_MSGS The number of pre-allocated message structures. The system manages a pool of preallocated message structures to minimize dynamic allocations +config PREALLOC_MQ_IRQ_MSGS + int "Number of pre-allocated irq messages" + default 8 + ---help--- + The number of pre-allocated irq message structures. + config MQ_MAXMSGSIZE int "Maximum message size" default 32 diff --git a/sched/mqueue/mq_initialize.c b/sched/mqueue/mq_initialize.c index 2cf9a78ae3..aefd74b562 100644 --- a/sched/mqueue/mq_initialize.c +++ b/sched/mqueue/mq_initialize.c @@ -168,7 +168,7 @@ void nxmq_initialize(void) */ g_msgfreeirqalloc = - mq_msgblockalloc(&g_msgfreeirq, NUM_INTERRUPT_MSGS, + mq_msgblockalloc(&g_msgfreeirq, CONFIG_PREALLOC_MQ_IRQ_MSGS, MQ_ALLOC_IRQ); /* Allocate a block of message queue descriptors */ diff --git a/sched/mqueue/mqueue.h b/sched/mqueue/mqueue.h index 39e4080d5e..0c1b78ad51 100644 --- a/sched/mqueue/mqueue.h +++ b/sched/mqueue/mqueue.h @@ -53,12 +53,6 @@ #define NUM_MSG_DESCRIPTORS 4 -/* This defines the number of messages to set aside for exclusive use by - * interrupt handlers - */ - -#define NUM_INTERRUPT_MSGS 8 - /******************************************************************************** * Public Type Definitions ********************************************************************************/