1094332d3Sopenharmony_ci/*
2094332d3Sopenharmony_ci * Copyright (c) 2020-2024 Huawei Device Co., Ltd.
3094332d3Sopenharmony_ci *
4094332d3Sopenharmony_ci * HDF is dual licensed: you can use it either under the terms of
5094332d3Sopenharmony_ci * the GPL, or the BSD license, at your option.
6094332d3Sopenharmony_ci * See the LICENSE file in the root of this repository for complete details.
7094332d3Sopenharmony_ci */
8094332d3Sopenharmony_ci
9094332d3Sopenharmony_ci#ifndef USB_DDK_PNP_LOADER_H
10094332d3Sopenharmony_ci#define USB_DDK_PNP_LOADER_H
11094332d3Sopenharmony_ci
12094332d3Sopenharmony_ci#include "hdf_dlist.h"
13094332d3Sopenharmony_ci#include "hdf_sbuf.h"
14094332d3Sopenharmony_ci#include "hdf_usb_pnp_manage.h"
15094332d3Sopenharmony_ci
16094332d3Sopenharmony_citypedef enum { USB_PNP_NORMAL_STATUS, USB_PNP_ADD_STATUS, USB_PNP_REMOVE_STATUS } UsbPnpDriverStatus;
17094332d3Sopenharmony_ci
18094332d3Sopenharmony_cistruct UsbPnpMatchIdTable {
19094332d3Sopenharmony_ci    const char *moduleName;
20094332d3Sopenharmony_ci    const char *serviceName;
21094332d3Sopenharmony_ci    const char *deviceMatchAttr;
22094332d3Sopenharmony_ci
23094332d3Sopenharmony_ci    int32_t interfaceClassLength;
24094332d3Sopenharmony_ci    uint32_t interfaceClassMask;
25094332d3Sopenharmony_ci    int32_t interfaceSubClassLength;
26094332d3Sopenharmony_ci    uint32_t interfaceSubClassMask;
27094332d3Sopenharmony_ci    int32_t interfaceProtocolLength;
28094332d3Sopenharmony_ci    uint32_t interfaceProtocolMask;
29094332d3Sopenharmony_ci    int32_t interfaceLength;
30094332d3Sopenharmony_ci    uint32_t interfaceMask;
31094332d3Sopenharmony_ci
32094332d3Sopenharmony_ci    uint8_t pnpMatchFlag;
33094332d3Sopenharmony_ci
34094332d3Sopenharmony_ci    uint8_t length;
35094332d3Sopenharmony_ci
36094332d3Sopenharmony_ci    uint16_t matchFlag;
37094332d3Sopenharmony_ci
38094332d3Sopenharmony_ci    uint16_t vendorId;
39094332d3Sopenharmony_ci    uint16_t productId;
40094332d3Sopenharmony_ci
41094332d3Sopenharmony_ci    uint16_t bcdDeviceLow;
42094332d3Sopenharmony_ci    uint16_t bcdDeviceHigh;
43094332d3Sopenharmony_ci
44094332d3Sopenharmony_ci    uint8_t deviceClass;
45094332d3Sopenharmony_ci    uint8_t deviceSubClass;
46094332d3Sopenharmony_ci    uint8_t deviceProtocol;
47094332d3Sopenharmony_ci
48094332d3Sopenharmony_ci    uint8_t interfaceClass[USB_PNP_INFO_MAX_INTERFACES];
49094332d3Sopenharmony_ci    uint8_t interfaceSubClass[USB_PNP_INFO_MAX_INTERFACES];
50094332d3Sopenharmony_ci    uint8_t interfaceProtocol[USB_PNP_INFO_MAX_INTERFACES];
51094332d3Sopenharmony_ci
52094332d3Sopenharmony_ci    uint8_t interfaceNumber[USB_PNP_INFO_MAX_INTERFACES];
53094332d3Sopenharmony_ci};
54094332d3Sopenharmony_ci
55094332d3Sopenharmony_cistruct UsbPnpDeviceListTable {
56094332d3Sopenharmony_ci    struct DListHead list;
57094332d3Sopenharmony_ci    const char *moduleName;
58094332d3Sopenharmony_ci    const char *serviceName;
59094332d3Sopenharmony_ci    const char *deviceMatchAttr;
60094332d3Sopenharmony_ci    UsbPnpDriverStatus status;
61094332d3Sopenharmony_ci    uint64_t usbDevAddr;
62094332d3Sopenharmony_ci    int32_t devNum;
63094332d3Sopenharmony_ci    int32_t busNum;
64094332d3Sopenharmony_ci    int32_t interfaceLength;
65094332d3Sopenharmony_ci    uint8_t interfaceNumber[USB_PNP_INFO_MAX_INTERFACES];
66094332d3Sopenharmony_ci};
67094332d3Sopenharmony_ci
68094332d3Sopenharmony_cistruct UsbPnpRemoveInfo {
69094332d3Sopenharmony_ci    uint8_t removeType;
70094332d3Sopenharmony_ci    uint64_t usbDevAddr;
71094332d3Sopenharmony_ci    int32_t devNum;
72094332d3Sopenharmony_ci    int32_t busNum;
73094332d3Sopenharmony_ci    uint8_t interfaceNum;
74094332d3Sopenharmony_ci};
75094332d3Sopenharmony_ci
76094332d3Sopenharmony_ciint32_t UsbDdkPnpLoaderEventReceived(void *usbPnpManagerPtr, uint32_t id, struct HdfSBuf *data);
77094332d3Sopenharmony_ciint32_t UsbDdkPnpLoaderEventHandle(void);
78094332d3Sopenharmony_ci
79094332d3Sopenharmony_ci#endif /* USB_DDK_PNP_LOADER_H */
80