• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef USBFN_DEV_MGR_H
17 #define USBFN_DEV_MGR_H
18 
19 #include "usb_object.h"
20 #include "device_resource_if.h"
21 #include "usbfn_device.h"
22 #include "usbfn_request.h"
23 #include "usbfn_interface.h"
24 #include "usbfn_io_mgr.h"
25 #include "adapter_if.h"
26 
27 struct UsbFnDeviceMgr {
28     struct UsbFnDevice         fnDev;
29     uint8_t                    numFunc;
30     struct UsbFnFuncMgr        *funcMgr;
31     char                       name[MAX_NAMELEN];
32     char                       udcName[MAX_NAMELEN];
33     UsbFnDeviceState           devState;
34     struct UsbFnInterfaceMgr   *interfaceMgr;
35     const struct DeviceResourceNode  *node;
36     struct UsbFnDeviceDesc     *des;
37     struct OsalThread          thread;
38     bool                       running;
39 };
40 
41 const struct UsbFnDeviceMgr *UsbFnMgrDeviceCreate(const char *udcName,
42     struct UsbFnDeviceDesc *des, const struct DeviceResourceNode *node);
43 int32_t UsbFnMgrDeviceRemove(struct UsbFnDevice *fnDevice);
44 const struct UsbFnDeviceMgr *UsbFnMgrDeviceGet(const char *udcName);
45 int32_t UsbFnMgrDeviceGetState(struct UsbFnDevice *fnDevice, UsbFnDeviceState *devState);
46 const struct UsbFnInterfaceMgr *UsbFnMgrDeviceGetInterface(struct UsbFnDevice *fnDevice, uint8_t interfaceIndex);
47 int32_t UsbFnMgrStartRecvEvent(struct UsbFnInterface *interface, uint32_t eventMask,
48     UsbFnEventCallback callback, void *context);
49 int32_t UsbFnStopRecvEvent(struct UsbFnInterface *interface);
50 
51 #endif /* USBFN_DEV_MGR_H */
52