WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
los_queue_pri.h
浏览该文件的文档.
1/* ----------------------------------------------------------------------------
2 * Copyright (c) Huawei Technologies Co., Ltd. 2013-2019. All rights reserved.
3 * Description: Queue Private HeadFile
4 * Author: Huawei LiteOS Team
5 * Create: 2013-01-01
6 * Redistribution and use in source and binary forms, with or without modification,
7 * are permitted provided that the following conditions are met:
8 * 1. Redistributions of source code must retain the above copyright notice, this list of
9 * conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11 * of conditions and the following disclaimer in the documentation and/or other materials
12 * provided with the distribution.
13 * 3. Neither the name of the copyright holder nor the names of its contributors may be used
14 * to endorse or promote products derived from this software without specific prior written
15 * permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
18 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
20 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
23 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 * --------------------------------------------------------------------------- */
28
29#ifndef _LOS_QUEUE_PRI_H
30#define _LOS_QUEUE_PRI_H
31
32#include "los_queue.h"
33
34#ifdef __cplusplus
35extern "C" {
36#endif /* __cplusplus */
37
43
44typedef enum {
48
50
51#define OS_QUEUE_OPERATE_TYPE(ReadOrWrite, HeadOrTail) (((UINT32)(HeadOrTail) << 1) | (ReadOrWrite))
52#define OS_QUEUE_READ_WRITE_GET(type) ((type) & 0x01U)
53#define OS_QUEUE_READ_HEAD (OS_QUEUE_READ | (OS_QUEUE_HEAD << 1))
54#define OS_QUEUE_READ_TAIL (OS_QUEUE_READ | (OS_QUEUE_TAIL << 1))
55#define OS_QUEUE_WRITE_HEAD (OS_QUEUE_WRITE | (OS_QUEUE_HEAD << 1))
56#define OS_QUEUE_WRITE_TAIL (OS_QUEUE_WRITE | (OS_QUEUE_TAIL << 1))
57#define OS_QUEUE_OPERATE_GET(type) ((type) & 0x03U)
58#define OS_QUEUE_IS_READ(type) (OS_QUEUE_READ_WRITE_GET(type) == OS_QUEUE_READ)
59#define OS_QUEUE_IS_WRITE(type) (OS_QUEUE_READ_WRITE_GET(type) == OS_QUEUE_WRITE)
60
61/* queue memory type */
62#define OS_QUEUE_ALLOC_DYNAMIC 0
63#define OS_QUEUE_ALLOC_STATIC 1
64#define OS_QUEUE_NORMAL 0
65
66/* COUNT | INDEX split bit */
67#ifdef LOSCFG_BASE_CORE_SYS_RES_CHECK
68#define QUEUE_SPLIT_BIT 16
69#define SET_QUEUE_ID(count, queueId) (((count) << QUEUE_SPLIT_BIT) | (queueId))
70#define GET_QUEUE_INDEX(queueId) ((queueId) & ((1U << QUEUE_SPLIT_BIT) - 1))
71#define GET_QUEUE_COUNT(queueId) ((queueId) >> QUEUE_SPLIT_BIT)
72#else
73#define GET_QUEUE_INDEX(queueId) (queueId)
74#endif
75#define GET_QUEUE_HANDLE(queueId) (((LosQueueCB *)g_osAllQueue) + GET_QUEUE_INDEX(queueId))
76/* Obtain the head node in a queue doubly linked list. */
77#define GET_QUEUE_LIST(ptr) LOS_DL_LIST_ENTRY(ptr, LosQueueCB, readWriteList[OS_QUEUE_WRITE])
78
79/* Queue information block structure */
80typedef struct {
81 UINT8 *queueHandle; /* Pointer to a queue handle */
82 UINT8 queueState; /* state */
83 UINT8 queueMemType; /* memory type */
84 UINT16 queueLen; /* length */
85 UINT16 queueSize; /* Node size */
86 UINT32 queueId; /* queueId */
87 UINT16 queueHead; /* Node head */
88 UINT16 queueTail; /* Node tail */
89 UINT16 readWriteableCnt[OS_QUEUE_N_RW]; /* Count of readable or writable resources, 0:readable, 1:writable */
90 LOS_DL_LIST readWriteList[OS_QUEUE_N_RW]; /* the linked list to be read or written, 0:readlist, 1:writelist */
91 LOS_DL_LIST memList; /* Pointer to the memory linked list */
93
94/* Queue information control block */
96
97/* alloc a stationary memory for a mail according to queueId */
98extern VOID *OsQueueMailAlloc(UINT32 queueId, VOID *mailPool, UINT32 timeout);
99/* free a stationary memory for a mail according to queueId. */
100extern UINT32 OsQueueMailFree(UINT32 queueId, VOID *mailPool, VOID *mailMem);
102
103#ifdef __cplusplus
104}
105#endif /* __cplusplus */
106
107#endif /* _LOS_QUEUE_PRI_H */
UINT32 OsQueueMailFree(UINT32 queueId, VOID *mailPool, VOID *mailMem)
UINT32 OsQueueInit(VOID)
LosQueueCB * g_osAllQueue
QueueHeadTail
Definition los_queue_pri.h:44
@ OS_QUEUE_TAIL
Definition los_queue_pri.h:46
@ OS_QUEUE_HEAD
Definition los_queue_pri.h:45
UINT32 QueueMsgHead
Definition los_queue_pri.h:49
QueueReadWrite
Definition los_queue_pri.h:38
@ OS_QUEUE_N_RW
Definition los_queue_pri.h:41
@ OS_QUEUE_WRITE
Definition los_queue_pri.h:40
@ OS_QUEUE_READ
Definition los_queue_pri.h:39
VOID * OsQueueMailAlloc(UINT32 queueId, VOID *mailPool, UINT32 timeout)
unsigned short UINT16
Definition los_typedef.h:51
#define VOID
Definition los_typedef.h:88
unsigned char UINT8
Definition los_typedef.h:50
unsigned int UINT32
Definition los_typedef.h:52
Definition los_list.h:47
Definition los_queue_pri.h:80
UINT16 queueHead
Definition los_queue_pri.h:87
UINT8 queueState
Definition los_queue_pri.h:82
UINT16 queueLen
Definition los_queue_pri.h:84
UINT16 queueTail
Definition los_queue_pri.h:88
UINT32 queueId
Definition los_queue_pri.h:86
LOS_DL_LIST memList
Definition los_queue_pri.h:91
UINT16 queueSize
Definition los_queue_pri.h:85
UINT8 * queueHandle
Definition los_queue_pri.h:81
UINT8 queueMemType
Definition los_queue_pri.h:83