• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * usb_pnp_notify.h
3  *
4  * usb pnp notify adapter of linux
5  *
6  * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
7  *
8  * This software is licensed under the terms of the GNU General Public
9  * License version 2, as published by the Free Software Foundation, and
10  * may be copied, distributed, and modified under those terms.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  */
18 
19 #ifndef USB_PNP_NOTIFY_H
20 #define USB_PNP_NOTIFY_H
21 
22 #include "hdf_base.h"
23 #include "hdf_dlist.h"
24 #include "hdf_usb_pnp_manage.h"
25 #include "osal_mutex.h"
26 
27 #ifdef __cplusplus
28 #if __cplusplus
29 extern "C" {
30 #endif
31 #endif /* __cplusplus */
32 
33 #define USB_PNP_NOTIFY_MSLEEP_TIME  (10)
34 
35 #ifndef INT32_MAX
36 #define INT32_MAX 0x7fffffff
37 #endif
38 
39 typedef enum {
40     USB_INFO_NORMAL_TYPE,
41     USB_INFO_ID_TYPE,
42     USB_INFO_DEVICE_ADDRESS_TYPE,
43 } UsbInfoQueryParaType;
44 
45 typedef enum {
46     USB_PNP_DEVICE_INIT_STATUS,
47     USB_PNP_DEVICE_ADD_STATUS,
48     USB_PNP_DEVICE_REMOVE_STATUS,
49     USB_PNP_DEVICE_INTERFACE_STATUS,
50 } UsbPnpDeviceStatus;
51 
52 struct UsbPnpDeviceInfo {
53     int32_t id;
54     struct OsalMutex lock;
55     UsbPnpDeviceStatus status;
56     struct DListHead list;
57     bool interfaceRemoveStatus[USB_PNP_INFO_MAX_INTERFACES];
58     struct UsbPnpNotifyMatchInfoTable info;
59 };
60 
61 struct UsbInfoQueryPara {
62     UsbInfoQueryParaType type;
63     union {
64         int32_t id;
65         uint64_t usbDevAddr;
66         struct {
67             int32_t devNum;
68             int32_t busNum;
69         };
70     };
71 };
72 
73 union UsbPnpDeviceInfoData {
74     struct usb_device *usbDev;
75     struct UsbPnpAddRemoveInfo *infoData;
76 };
77 
78 #ifdef __cplusplus
79 #if __cplusplus
80 }
81 #endif
82 #endif /* __cplusplus */
83 
84 #endif /* USB_PNP_NOTIFY_H */
85