sched/mqueue: move message queue buffer to bss
Signed-off-by: chao an <anchao@lixiang.com>
This commit is contained in:
parent
74702085f0
commit
81c140a953
@ -31,6 +31,21 @@
|
|||||||
#include "mqueue/mqueue.h"
|
#include "mqueue/mqueue.h"
|
||||||
#include "mqueue/msg.h"
|
#include "mqueue/msg.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Type Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
struct msgpool_s
|
||||||
|
{
|
||||||
|
#ifndef CONFIG_DISABLE_MQUEUE
|
||||||
|
struct mqueue_msg_s mqueue[CONFIG_PREALLOC_MQ_MSGS +
|
||||||
|
CONFIG_PREALLOC_MQ_IRQ_MSGS];
|
||||||
|
#endif
|
||||||
|
#ifndef CONFIG_DISABLE_MQUEUE_SYSV
|
||||||
|
struct msgbuf_s msgbuf[CONFIG_PREALLOC_MQ_MSGS];
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Data
|
* Public Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -52,6 +67,14 @@ struct list_node g_msgfreeirq;
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* This is a pool of pre-allocated message queue buffers */
|
||||||
|
|
||||||
|
static struct msgpool_s g_msgpool;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -69,8 +92,8 @@ struct list_node g_msgfreeirq;
|
|||||||
|
|
||||||
#ifndef CONFIG_DISABLE_MQUEUE
|
#ifndef CONFIG_DISABLE_MQUEUE
|
||||||
static FAR void * mq_msgblockinit(FAR struct list_node *list,
|
static FAR void * mq_msgblockinit(FAR struct list_node *list,
|
||||||
FAR struct mqueue_msg_s *mqmsgblock,
|
FAR struct mqueue_msg_s *mqmsgblock,
|
||||||
uint16_t nmsgs, uint8_t alloc_type)
|
uint16_t nmsgs, uint8_t alloc_type)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < nmsgs; i++)
|
for (i = 0; i < nmsgs; i++)
|
||||||
@ -125,22 +148,10 @@ static FAR void *sysv_msgblockinit(FAR struct list_node *list,
|
|||||||
|
|
||||||
void nxmq_initialize(void)
|
void nxmq_initialize(void)
|
||||||
{
|
{
|
||||||
FAR void *msg;
|
FAR void *msg = &g_msgpool;
|
||||||
|
|
||||||
sched_trace_begin();
|
sched_trace_begin();
|
||||||
|
|
||||||
msg = kmm_malloc(
|
|
||||||
#ifndef CONFIG_DISABLE_MQUEUE
|
|
||||||
sizeof(struct mqueue_msg_s) *
|
|
||||||
(CONFIG_PREALLOC_MQ_MSGS + CONFIG_PREALLOC_MQ_IRQ_MSGS)
|
|
||||||
#endif
|
|
||||||
#ifndef CONFIG_DISABLE_MQUEUE_SYSV
|
|
||||||
+ sizeof(struct msgbuf_s) * CONFIG_PREALLOC_MQ_MSGS
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
|
|
||||||
DEBUGASSERT(msg != NULL);
|
|
||||||
|
|
||||||
/* Initialize a block of messages for general use */
|
/* Initialize a block of messages for general use */
|
||||||
|
|
||||||
#ifndef CONFIG_DISABLE_MQUEUE
|
#ifndef CONFIG_DISABLE_MQUEUE
|
||||||
|
Loading…
Reference in New Issue
Block a user