• 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 USB_HOST_DDK_TEST_H
17 #define USB_HOST_DDK_TEST_H
18 
19 #include <stdio.h>
20 #include <unistd.h>
21 #include <sys/time.h>
22 #include <hdf_sbuf.h>
23 #ifdef __LITEOS_USB_HOST_DDK_TEST__
24 #include "hdf_base.h"
25 #include "hdf_base.h"
26 #include "hdf_log.h"
27 #include "hdf_io_service_if.h"
28 #include "osal_mem.h"
29 #else
30 #include <servmgr_hdi.h>
31 #include <hdf_remote_service.h>
32 #include "usb_serial.h"
33 #endif
34 #include "osal_time.h"
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif /* __cplusplus */
39 
40 #define DATA_MAX_LEN        512
41 
42 #ifdef __LITEOS_USB_HOST_DDK_TEST__
43 typedef enum {
44     HOST_ACM_SYNC_READ = 1,
45     HOST_ACM_SYNC_WRITE,
46     HOST_ACM_ASYNC_READ,
47     HOST_ACM_ASYNC_WRITE,
48     HOST_ACM_CTRL_READ,
49     HOST_ACM_CTRL_WRITE,
50     HOST_ACM_CTRL_CLASS_SYNC,
51     HOST_ACM_CTRL_GET_STATUS,
52     HOST_ACM_CTRL_SYNC_DESCRIPTOR,
53     HOST_ACM_CTRL_ASYNC_DESCRIPTOR,
54     HOST_ACM_CTRL_GET_CONFIGURATION,
55     HOST_ACM_CTRL_GET_INTERFACE,
56     HOST_ACM_SPEED_TEST,
57     HOST_ACM_SET_BAUDRATE,
58     HOST_ACM_GET_BAUDRATE,
59     HOST_ACM_ADD_INTERFACE,
60     HOST_ACM_REMOVE_INTERFACE,
61 } AcmModuleTestCmdType;
62 #endif
63 
64 int32_t UsbHostDdkTestInit(const char *apiType);
65 int32_t UsbHostDdkTestAsyncRead(char *readSbuf);
66 void UsbHostDdkTestAsyncWrite(const char *buf);
67 void UsbHostDdkTestSyncRead(char *readSbuf);
68 void UsbHostDdkTestSyncWrite(const char *buf);
69 void UsbHostDdkTestCtrlClass(char *readSbuf);
70 void UsbHostDdkTestStdGetDes(char *readSbuf);
71 void UsbHostDdkTestStdGetDesAsync(char *readSbuf);
72 void UsbHostDdkTestStdGetStatus(char *readSbuf);
73 void UsbHostDdkTestSetBaudrate(uint32_t value);
74 void UsbHostDdkTestGetBaudrate(char *readSbuf);
75 void UsbHostDdkTestAddInterface(uint32_t value);
76 void UsbHostDdkTestRemoveInterface(uint32_t value);
77 int32_t UsbHostDdkTestOpen(int32_t cmdType);
78 int32_t UsbHostDdkTestClose(int32_t cmdType);
79 
80 void TestStdGetConf(void);
81 void TestStdGetInterface(void);
82 void TestSpeed(void);
83 void TestExit(void);
84 bool TestGetExitFlag(void);
85 #ifdef __cplusplus
86 }
87 #endif /* __cplusplus */
88 
89 #endif
90