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 #define USB_PNP_NOTIFY_SERVICE_NAME "hdf_usb_pnp_notify_service" 16 17 typedef enum { 18 USB_PNP_NORMAL_STATUS, 19 USB_PNP_ADD_STATUS, 20 USB_PNP_REMOVE_STATUS 21 } UsbPnpDriverStatus; 22 23 struct UsbPnpMatchIdTable { 24 const char *moduleName; 25 const char *serviceName; 26 const char *deviceMatchAttr; 27 28 int32_t interfaceClassLength; 29 uint32_t interfaceClassMask; 30 int32_t interfaceSubClassLength; 31 uint32_t interfaceSubClassMask; 32 int32_t interfaceProtocolLength; 33 uint32_t interfaceProtocolMask; 34 int32_t interfaceLength; 35 uint32_t interfaceMask; 36 37 uint8_t pnpMatchFlag; 38 39 uint8_t length; 40 41 uint16_t matchFlag; 42 43 uint16_t vendorId; 44 uint16_t productId; 45 46 uint16_t bcdDeviceLow; 47 uint16_t bcdDeviceHigh; 48 49 uint8_t deviceClass; 50 uint8_t deviceSubClass; 51 uint8_t deviceProtocol; 52 53 uint8_t interfaceClass[USB_PNP_INFO_MAX_INTERFACES]; 54 uint8_t interfaceSubClass[USB_PNP_INFO_MAX_INTERFACES]; 55 uint8_t interfaceProtocol[USB_PNP_INFO_MAX_INTERFACES]; 56 57 uint8_t interfaceNumber[USB_PNP_INFO_MAX_INTERFACES]; 58 }; 59 60 struct UsbPnpDeviceListTable { 61 struct DListHead list; 62 const char *moduleName; 63 const char *serviceName; 64 const char *deviceMatchAttr; 65 UsbPnpDriverStatus status; 66 uintptr_t usbDevAddr; 67 int32_t devNum; 68 int32_t busNum; 69 int32_t interfaceLength; 70 uint8_t interfaceNumber[USB_PNP_INFO_MAX_INTERFACES]; 71 }; 72 73 struct UsbPnpRemoveInfo { 74 uint8_t removeType; 75 uintptr_t usbDevAddr; 76 int32_t devNum; 77 int32_t busNum; 78 uint8_t interfaceNum; 79 }; 80 81 int UsbDdkPnpLoaderEventReceived(void *priv, uint32_t id, struct HdfSBuf *data); 82 int UsbDdkPnpLoaderEventHandle(void); 83 84 #endif /* USB_DDK_PNP_LOADER_H */ 85