1 /* 2 * Copyright (c) 2020-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 USB_OBJECT_H 17 #define USB_OBJECT_H 18 19 #include <stdint.h> 20 #include <stdatomic.h> 21 #include <pthread.h> 22 #include <sys/time.h> 23 #include "securec.h" 24 #include "hdf_base.h" 25 #include "hdf_slist.h" 26 #include "hdf_dlist.h" 27 #include "hdf_log.h" 28 #include "osal_mem.h" 29 #include "osal_mutex.h" 30 #include "osal_sem.h" 31 #include "osal_thread.h" 32 #include "osal_time.h" 33 #include "osal_atomic.h" 34 35 #define MAX_OBJECT_ID (0x7FFFFFFF) 36 37 typedef enum { 38 /* request completed without error. */ 39 USB_REQUEST_COMPLETED, 40 /* request completed with short data. */ 41 USB_REQUEST_COMPLETED_SHORT, 42 /* request failed */ 43 USB_REQUEST_ERROR, 44 /* the request timeout */ 45 USB_REQUEST_TIMEOUT, 46 /* request was cancelled */ 47 USB_REQUEST_CANCELLED, 48 /* request wall stalled */ 49 USB_REQUEST_STALL, 50 /* Device was disconnected */ 51 USB_REQUEST_NO_DEVICE, 52 /* Device sent more data than requested */ 53 USB_REQUEST_OVERFLOW, 54 } UsbRequestStatus; 55 56 typedef enum { 57 USB_PIPE_DIRECTION_OUT = 0x00, 58 USB_PIPE_DIRECTION_IN = 0x80, 59 } UsbPipeDirection; 60 61 typedef enum { 62 USB_PIPE_TYPE_CONTROL = 0U, 63 USB_PIPE_TYPE_ISOCHRONOUS = 1U, 64 USB_PIPE_TYPE_BULK = 2U, 65 USB_PIPE_TYPE_INTERRUPT = 3U, 66 } UsbPipeType; 67 68 typedef enum { 69 USB_INTERFACE_STATUS_NORMAL, 70 USB_INTERFACE_STATUS_ADD, 71 USB_INTERFACE_STATUS_REMOVE, 72 USB_INTERFACE_STATUS_OTHER, 73 } UsbInterfaceStatus; 74 75 struct UsbObject { 76 int32_t objectId; 77 struct DListHead entry; 78 }; 79 80 #endif /* USB_OBJECT_H */ 81