• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
3  *
4  * HDF is dual licensed: you can use it either under the terms of
5  * the GPL, or the BSD license, at your option.
6  * See the LICENSE file in the root of this repository for complete details.
7  */
8 
9 #ifndef USB_DDK_PNP_LOADER_H
10 #define USB_DDK_PNP_LOADER_H
11 
12 #include "devmgr_service_if.h"
13 #include "hdf_usb_pnp_manage.h"
14 
15 typedef enum { USB_PNP_NORMAL_STATUS, USB_PNP_ADD_STATUS, USB_PNP_REMOVE_STATUS } UsbPnpDriverStatus;
16 
17 struct UsbPnpMatchIdTable {
18     const char *moduleName;
19     const char *serviceName;
20     const char *deviceMatchAttr;
21 
22     int32_t interfaceClassLength;
23     uint32_t interfaceClassMask;
24     int32_t interfaceSubClassLength;
25     uint32_t interfaceSubClassMask;
26     int32_t interfaceProtocolLength;
27     uint32_t interfaceProtocolMask;
28     int32_t interfaceLength;
29     uint32_t interfaceMask;
30 
31     uint8_t pnpMatchFlag;
32 
33     uint8_t length;
34 
35     uint16_t matchFlag;
36 
37     uint16_t vendorId;
38     uint16_t productId;
39 
40     uint16_t bcdDeviceLow;
41     uint16_t bcdDeviceHigh;
42 
43     uint8_t deviceClass;
44     uint8_t deviceSubClass;
45     uint8_t deviceProtocol;
46 
47     uint8_t interfaceClass[USB_PNP_INFO_MAX_INTERFACES];
48     uint8_t interfaceSubClass[USB_PNP_INFO_MAX_INTERFACES];
49     uint8_t interfaceProtocol[USB_PNP_INFO_MAX_INTERFACES];
50 
51     uint8_t interfaceNumber[USB_PNP_INFO_MAX_INTERFACES];
52 };
53 
54 struct UsbPnpDeviceListTable {
55     struct DListHead list;
56     const char *moduleName;
57     const char *serviceName;
58     const char *deviceMatchAttr;
59     UsbPnpDriverStatus status;
60     uint64_t usbDevAddr;
61     int32_t devNum;
62     int32_t busNum;
63     int32_t interfaceLength;
64     uint8_t interfaceNumber[USB_PNP_INFO_MAX_INTERFACES];
65 };
66 
67 struct UsbPnpRemoveInfo {
68     uint8_t removeType;
69     uint64_t usbDevAddr;
70     int32_t devNum;
71     int32_t busNum;
72     uint8_t interfaceNum;
73 };
74 
75 int32_t UsbDdkPnpLoaderEventReceived(void *usbPnpManagerPtr, uint32_t id, struct HdfSBuf *data);
76 int32_t UsbDdkPnpLoaderEventHandle(void);
77 
78 #endif /* USB_DDK_PNP_LOADER_H */
79