sched/mqueue: correct list parameter

1. correct list parameter
2. move global data to bss

Signed-off-by: chao an <anchao@lixiang.com>
This commit is contained in:
chao an 2024-04-11 15:36:29 +08:00 committed by Xiang Xiao
parent 9a4afbcb62
commit 23e9489345
2 changed files with 10 additions and 4 deletions

View File

@ -42,13 +42,13 @@
* item. * item.
*/ */
struct list_node g_msgfree = LIST_INITIAL_VALUE(g_msgfree); struct list_node g_msgfree;
/* The g_msgfreeInt is a list of messages that are reserved for use by /* The g_msgfreeInt is a list of messages that are reserved for use by
* interrupt handlers. * interrupt handlers.
*/ */
struct list_node g_msgfreeirq = LIST_INITIAL_VALUE(g_msgfreeirq); struct list_node g_msgfreeirq;
#endif #endif
@ -95,7 +95,7 @@ static FAR void *sysv_msgblockinit(FAR struct list_node *list,
int i; int i;
for (i = 0; i < nmsgs; i++) for (i = 0; i < nmsgs; i++)
{ {
list_add_tail(&g_msgfreelist, &msg->node); list_add_tail(list, &msg->node);
msg++; msg++;
} }
@ -144,6 +144,8 @@ void nxmq_initialize(void)
/* Initialize a block of messages for general use */ /* Initialize a block of messages for general use */
#ifndef CONFIG_DISABLE_MQUEUE #ifndef CONFIG_DISABLE_MQUEUE
list_initialize(&g_msgfree);
msg = mq_msgblockinit(&g_msgfree, msg, CONFIG_PREALLOC_MQ_MSGS, msg = mq_msgblockinit(&g_msgfree, msg, CONFIG_PREALLOC_MQ_MSGS,
MQ_ALLOC_FIXED); MQ_ALLOC_FIXED);
@ -151,11 +153,15 @@ void nxmq_initialize(void)
* interrupt handlers * interrupt handlers
*/ */
list_initialize(&g_msgfreeirq);
msg = mq_msgblockinit(&g_msgfreeirq, msg, CONFIG_PREALLOC_MQ_IRQ_MSGS, msg = mq_msgblockinit(&g_msgfreeirq, msg, CONFIG_PREALLOC_MQ_IRQ_MSGS,
MQ_ALLOC_IRQ); MQ_ALLOC_IRQ);
#endif #endif
#ifndef CONFIG_DISABLE_MQUEUE_SYSV #ifndef CONFIG_DISABLE_MQUEUE_SYSV
list_initialize(&g_msgfreelist);
msg = sysv_msgblockinit(&g_msgfreelist, msg, CONFIG_PREALLOC_MQ_MSGS); msg = sysv_msgblockinit(&g_msgfreelist, msg, CONFIG_PREALLOC_MQ_MSGS);
#endif #endif

View File

@ -42,7 +42,7 @@ static FAR struct msgq_s **g_msgqs; /* The pointer of two layer file descriptors
* Public Data * Public Data
****************************************************************************/ ****************************************************************************/
struct list_node g_msgfreelist = LIST_INITIAL_VALUE(g_msgfreelist); struct list_node g_msgfreelist;
/**************************************************************************** /****************************************************************************
* Private Functions * Private Functions