msgq.h

来自「还是arm7操作源码」· C头文件 代码 · 共 64 行

H
64
字号
/******************************************************************************
   Copyright (c) 2006 by RockOS.
   All rights reserved.

   This software is supported by the Rock Software Workroom.

   Any bugs please contact the author with e-mail or QQ:
     E-mail : baobaoba520@yahoo.com.cn
         QQ : 59681888
*******************************************************************************
File name   : msgq.h
Description : header file for message queue management for RockOS.
            : 
            : 
Auther      : sunxinqiu
History     :
  2006-3-15   first release.
******************************************************************************/
#ifndef __MSGQ_H__
#define __MSGQ_H__

#ifdef __cplusplus
extern "C" {
#endif

enum
{
    OS_MSGQ_FREE    = 1,
    OS_MSGQ_BUSY    = 2
};

typedef struct
{
    U16 state;

    U16 runningPriority;    /* running priority for this msg queue. */

    HTASK owner;    /* the owner task. */

    U32 total;      /* max msg handle in this queue. */
    volatile U32 current;    /* current msg handle in this queue. */

    HQUEUE pendTaskQ;   /* all tasks pending on this msg queue (On send msg). */

    volatile U32 head, tail;
    HMSG * pBuffer; /* the message buffer. */
}MSGQCB;

extern MSGQCB g_msgQCB[];

STATUS msgQ_init (void);
HMSGQ msgQCreate (HTASK owner, U32 total);
STATUS msgQSend (HMSG hmsg, HTASK task, U32 timeout);
STATUS msgQReceive (HMSG * phmsg, U32 timeout);
STATUS msgQDelete (HMSGQ qid);

#ifdef __cplusplus
}
#endif

#endif


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?