WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
los_driverbase_pri.h
浏览该文件的文档.
1/* ---------------------------------------------------------------------------
2 * Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
3 * Description: Driver Framework Inner Header File
4 * Author: Huawei LiteOS Team
5 * Create: 2020-08-15
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_DRIVER_BASE_PRI_H
30#define _LOS_DRIVER_BASE_PRI_H
31
32#include "los_driverbase.h"
33
38
39#define DEVICE_LOCK(dev) (VOID)LOS_MuxPend((dev)->mutex, LOS_WAIT_FOREVER)
40#define DEVICE_UNLOCK(dev) (VOID)LOS_MuxPost((dev)->mutex)
41
42#define DRIVER_LOCK(drv) (VOID)LOS_MuxPend((drv)->mutex, LOS_WAIT_FOREVER)
43#define DRIVER_UNLOCK(drv) (VOID)LOS_MuxPost((drv)->mutex)
44
45#define PM_LOCK(lock) (VOID)LOS_MuxPend((lock), LOS_WAIT_FOREVER)
46#define PM_UNLOCK(lock) (VOID)LOS_MuxPost((lock))
47
48#define DRIVER_BASE_LOCK(lock) (VOID)LOS_MuxPend((lock), LOS_WAIT_FOREVER)
49#define DRIVER_BASE_UNLOCK(lock) (VOID)LOS_MuxPost((lock))
50
54
55void OsDevicePmAdd(struct LosDevice *dev);
56void OsDevicePmRemove(struct LosDevice *dev);
57
59{
60 return (strcmp(dev->name, drv->name) == 0);
61}
62
64{
65 DRIVER_LOCK(drv);
66 LOS_ListTailInsert(&drv->deviceList, &dev->driverNode);
67 DRIVER_UNLOCK(drv);
68}
69
71{
72 DRIVER_LOCK(drv);
73 LOS_ListDelete(&dev->driverNode);
74 DRIVER_UNLOCK(drv);
75}
76
85
94
103
112
113#endif
#define STATIC
Definition common_def.h:57
#define INLINE
Definition common_def.h:65
void OsDevicePmRemove(struct LosDevice *dev)
UINT32 OsDriverBaseInit(VOID)
STATIC INLINE VOID OsSysRemoveDevice(struct LosDevice *dev)
Definition los_driverbase_pri.h:86
UINT32 g_pmListMutex
STATIC INLINE BOOL OsDeviceMatchDriver(struct LosDevice *dev, struct LosDriver *drv)
Definition los_driverbase_pri.h:58
void OsDevicePmAdd(struct LosDevice *dev)
UINT32 OsDriverAttachDevice(struct LosDriver *drv, struct LosDevice *dev)
#define DRIVER_BASE_LOCK(lock)
Definition los_driverbase_pri.h:48
STATIC INLINE VOID OsSysAddDriver(struct LosDriver *drv)
Definition los_driverbase_pri.h:95
UINT32 OsDriverDetachDevice(struct LosDriver *drv, struct LosDevice *dev)
STATIC INLINE VOID OsSysRemoveDriver(struct LosDriver *drv)
Definition los_driverbase_pri.h:104
UINT32 g_driverBaseMutex
STATIC INLINE VOID OsDeviceBindDriver(struct LosDevice *dev, struct LosDriver *drv)
Definition los_driverbase_pri.h:63
LOS_DL_LIST g_driverList
LOS_DL_LIST g_deviceList
STATIC INLINE VOID OsSysAddDevice(struct LosDevice *dev)
Definition los_driverbase_pri.h:77
STATIC INLINE VOID OsDeviceUnbindDriver(struct LosDevice *dev, struct LosDriver *drv)
Definition los_driverbase_pri.h:70
#define DRIVER_BASE_UNLOCK(lock)
Definition los_driverbase_pri.h:49
#define DRIVER_LOCK(drv)
Definition los_driverbase_pri.h:42
#define DRIVER_UNLOCK(drv)
Definition los_driverbase_pri.h:43
#define VOID
Definition los_typedef.h:88
#define TRUE
Definition los_typedef.h:98
#define FALSE
Definition los_typedef.h:94
unsigned int UINT32
Definition los_typedef.h:52
size_t BOOL
Definition los_typedef.h:83
Definition los_list.h:47
Definition los_driverbase.h:70
const CHAR * name
Definition los_driverbase.h:71
BOOL isRegistered
Definition los_driverbase.h:77
LOS_DL_LIST deviceItem
Definition los_driverbase.h:74
LOS_DL_LIST driverNode
Definition los_driverbase.h:73
Definition los_driverbase.h:111
BOOL isRegistered
Definition los_driverbase.h:116
LOS_DL_LIST deviceList
Definition los_driverbase.h:113
LOS_DL_LIST driverItem
Definition los_driverbase.h:114
const CHAR * name
Definition los_driverbase.h:112