anchao commented on code in PR #7088: URL: https://github.com/apache/incubator-nuttx/pull/7088#discussion_r1000098656
########## sched/mqueue/msg.h: ########## @@ -0,0 +1,98 @@ +/******************************************************************************** + * sched/mqueue/msg.h + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ********************************************************************************/ + +#ifndef __SCHED_MQUEUE_MSG_H +#define __SCHED_MQUEUE_MSG_H + +/******************************************************************************** + * Included Files + ********************************************************************************/ + +#include <nuttx/config.h> +#include <nuttx/compiler.h> + +#include <nuttx/irq.h> +#include <nuttx/list.h> +#include <nuttx/mqueue.h> +#include <sys/msg.h> + +#include <errno.h> + +#if defined(CONFIG_MQ_MAXMSGSIZE) && CONFIG_MQ_MAXMSGSIZE > 0 + +/******************************************************************************** + * Pre-processor Definitions + ********************************************************************************/ + +#define MSG_MAX_BYTES CONFIG_MQ_MAXMSGSIZE +#define MSG_MAX_MSGS 16 + +/******************************************************************************** + * Public Type Definitions + ********************************************************************************/ + +struct msgq_s +{ + struct mqueue_cmn_s cmn; + struct list_node msglist; /* Prioritized message list */ + key_t key; + int16_t maxmsgs; /* Maximum number of messages in the queue */ + int16_t nmsgs; /* Number of message in the queue */ + uint16_t maxmsgsize; /* Max size of message in message queue */ +}; + +struct msgbuf_s +{ + struct list_node node; + uint16_t msize; /* Message data length */ + long mtype; /* Message type, must be > 0 */ + char mtext[MSG_MAX_BYTES]; /* Message data */ +}; + +/******************************************************************************** + * Public Data + ********************************************************************************/ + +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +EXTERN struct list_node g_msgfreelist; Review Comment: reference from other files: sched/mqueue/msgrcv.c:219: list_add_tail(&g_msgfreelist, &msg->node); sched/mqueue/msgsnd.c:194: msg = (FAR struct msgbuf_s *)list_remove_head(&g_msgfreelist); sched/mqueue/msginternal.c:54:struct list_node g_msgfreelist = LIST_INITIAL_VALUE(g_msgfreelist); sched/mqueue/msginternal.c:127: list_add_tail(&g_msgfreelist, &msg->node); sched/mqueue/msginternal.c:179: list_add_tail(&g_msgfreelist, &entry->node); sched/mqueue/msg.h:79:EXTERN struct list_node g_msgfreelist; -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org