WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
los_rwsem_pri.h
浏览该文件的文档.
1/* ----------------------------------------------------------------------------
2 * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.
3 * Description: Read And Write Semaphore Private HeadFile
4 * Author: Huawei LiteOS Team
5 * Create: 2022-06-16
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_RWSEM_PRI_H
30#define _LOS_RWSEM_PRI_H
31
32#include "los_rwsem.h"
33#include "los_list.h"
34
35#ifdef __cplusplus
36extern "C" {
37#endif /* __cplusplus */
38
39#define RWSEM_COUNT_MAX 0xFFFF
40#if (LOSCFG_BASE_IPC_RWSEM_LIMIT < 0) || (LOSCFG_BASE_IPC_RWSEM_LIMIT > RWSEM_COUNT_MAX)
41#error "LOSCFG_BASE_IPC_RWSEM_LIMIT config error!"
42#endif
43
44typedef struct {
45 UINT8 rwsemState; /* RW semaphore state */
46 INT16 rwsemCount; /* Number of holders of RW semaphore */
47 UINT32 rwsemId; /* RW semaphore control structure ID */
48 LOS_DL_LIST waitList; /* List of tasks that are waiting on a RW semaphore */
49} OsRwsemCB;
50
51/* RW semaphore information control block */
53
54#define GET_RWSEM_LIST(ptr) LOS_DL_LIST_ENTRY(ptr, OsRwsemCB, waitList)
55
56#ifdef LOSCFG_BASE_CORE_SYS_RES_CHECK
57#define RWSEM_SPLIT_BIT 16
58#define SET_RWSEM_ID(count, rwsemId) (((count) << RWSEM_SPLIT_BIT) | (rwsemId))
59#define GET_RWSEM_INDEX(rwsemId) ((rwsemId) & ((1U << RWSEM_SPLIT_BIT) - 1))
60#define GET_RWSEM_COUNT(rwsemId) ((rwsemId) >> RWSEM_SPLIT_BIT)
61#else
62#define GET_RWSEM_INDEX(rwsemId) (rwsemId)
63#endif
64
65#define GET_RWSEM(rwsemId) (g_osAllRwsem + GET_RWSEM_INDEX(rwsemId))
66
72
77
79
80#ifdef __cplusplus
81}
82#endif /* __cplusplus */
83
84#endif /* _LOS_RWSEM_PRI_H */
RwsemState
Definition los_rwsem_pri.h:67
@ RWSEM_INITIAL
Definition los_rwsem_pri.h:69
@ RWSEM_WRITING
Definition los_rwsem_pri.h:68
@ RWSEM_READING
Definition los_rwsem_pri.h:70
RwsemWaitType
Definition los_rwsem_pri.h:73
@ RWSEM_WRITE
Definition los_rwsem_pri.h:75
@ RWSEM_READ
Definition los_rwsem_pri.h:74
UINT32 OsRwsemInit(VOID)
OsRwsemCB * g_osAllRwsem
signed short INT16
Definition los_typedef.h:54
#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_rwsem_pri.h:44
UINT8 rwsemState
Definition los_rwsem_pri.h:45
UINT32 rwsemId
Definition los_rwsem_pri.h:47
LOS_DL_LIST waitList
Definition los_rwsem_pri.h:48
INT16 rwsemCount
Definition los_rwsem_pri.h:46