1094332d3Sopenharmony_ci/* 2094332d3Sopenharmony_ci * Copyright (c) 2021 Huawei Device Co., Ltd. 3094332d3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4094332d3Sopenharmony_ci * you may not use this file except in compliance with the License. 5094332d3Sopenharmony_ci * You may obtain a copy of the License at 6094332d3Sopenharmony_ci * 7094332d3Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8094332d3Sopenharmony_ci * 9094332d3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10094332d3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11094332d3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12094332d3Sopenharmony_ci * See the License for the specific language governing permissions and 13094332d3Sopenharmony_ci * limitations under the License. 14094332d3Sopenharmony_ci */ 15094332d3Sopenharmony_ci 16094332d3Sopenharmony_ci#ifndef USB_HOST_DDK_TEST_H 17094332d3Sopenharmony_ci#define USB_HOST_DDK_TEST_H 18094332d3Sopenharmony_ci 19094332d3Sopenharmony_ci#include <stdio.h> 20094332d3Sopenharmony_ci#include <unistd.h> 21094332d3Sopenharmony_ci#include <sys/time.h> 22094332d3Sopenharmony_ci#include <hdf_sbuf.h> 23094332d3Sopenharmony_ci#ifdef __LITEOS_USB_HOST_DDK_TEST__ 24094332d3Sopenharmony_ci#include "hdf_base.h" 25094332d3Sopenharmony_ci#include "hdf_base.h" 26094332d3Sopenharmony_ci#include "hdf_log.h" 27094332d3Sopenharmony_ci#include "hdf_io_service_if.h" 28094332d3Sopenharmony_ci#include "osal_mem.h" 29094332d3Sopenharmony_ci#else 30094332d3Sopenharmony_ci#include <servmgr_hdi.h> 31094332d3Sopenharmony_ci#include <hdf_remote_service.h> 32094332d3Sopenharmony_ci#include "usb_serial.h" 33094332d3Sopenharmony_ci#endif 34094332d3Sopenharmony_ci#include "osal_time.h" 35094332d3Sopenharmony_ci 36094332d3Sopenharmony_ci#ifdef __cplusplus 37094332d3Sopenharmony_ciextern "C" { 38094332d3Sopenharmony_ci#endif /* __cplusplus */ 39094332d3Sopenharmony_ci 40094332d3Sopenharmony_ci#define DATA_MAX_LEN 512 41094332d3Sopenharmony_ci 42094332d3Sopenharmony_ci#ifdef __LITEOS_USB_HOST_DDK_TEST__ 43094332d3Sopenharmony_citypedef enum { 44094332d3Sopenharmony_ci HOST_ACM_SYNC_READ = 1, 45094332d3Sopenharmony_ci HOST_ACM_SYNC_WRITE, 46094332d3Sopenharmony_ci HOST_ACM_ASYNC_READ, 47094332d3Sopenharmony_ci HOST_ACM_ASYNC_WRITE, 48094332d3Sopenharmony_ci HOST_ACM_CTRL_READ, 49094332d3Sopenharmony_ci HOST_ACM_CTRL_WRITE, 50094332d3Sopenharmony_ci HOST_ACM_CTRL_CLASS_SYNC, 51094332d3Sopenharmony_ci HOST_ACM_CTRL_GET_STATUS, 52094332d3Sopenharmony_ci HOST_ACM_CTRL_SYNC_DESCRIPTOR, 53094332d3Sopenharmony_ci HOST_ACM_CTRL_ASYNC_DESCRIPTOR, 54094332d3Sopenharmony_ci HOST_ACM_CTRL_GET_CONFIGURATION, 55094332d3Sopenharmony_ci HOST_ACM_CTRL_GET_INTERFACE, 56094332d3Sopenharmony_ci HOST_ACM_SPEED_TEST, 57094332d3Sopenharmony_ci HOST_ACM_SET_BAUDRATE, 58094332d3Sopenharmony_ci HOST_ACM_GET_BAUDRATE, 59094332d3Sopenharmony_ci HOST_ACM_ADD_INTERFACE, 60094332d3Sopenharmony_ci HOST_ACM_REMOVE_INTERFACE, 61094332d3Sopenharmony_ci} AcmModuleTestCmdType; 62094332d3Sopenharmony_ci#endif 63094332d3Sopenharmony_ci 64094332d3Sopenharmony_ciint32_t UsbHostDdkTestInit(const char *apiType); 65094332d3Sopenharmony_ciint32_t UsbHostDdkTestAsyncRead(char *readSbuf); 66094332d3Sopenharmony_civoid UsbHostDdkTestAsyncWrite(const char *buf); 67094332d3Sopenharmony_civoid UsbHostDdkTestSyncRead(char *readSbuf); 68094332d3Sopenharmony_civoid UsbHostDdkTestSyncWrite(const char *buf); 69094332d3Sopenharmony_civoid UsbHostDdkTestCtrlClass(char *readSbuf); 70094332d3Sopenharmony_civoid UsbHostDdkTestStdGetDes(char *readSbuf); 71094332d3Sopenharmony_civoid UsbHostDdkTestStdGetDesAsync(char *readSbuf); 72094332d3Sopenharmony_civoid UsbHostDdkTestStdGetStatus(char *readSbuf); 73094332d3Sopenharmony_civoid UsbHostDdkTestSetBaudrate(uint32_t value); 74094332d3Sopenharmony_civoid UsbHostDdkTestGetBaudrate(char *readSbuf); 75094332d3Sopenharmony_civoid UsbHostDdkTestAddInterface(uint32_t value); 76094332d3Sopenharmony_civoid UsbHostDdkTestRemoveInterface(uint32_t value); 77094332d3Sopenharmony_ciint32_t UsbHostDdkTestOpen(int32_t cmdType); 78094332d3Sopenharmony_ciint32_t UsbHostDdkTestClose(int32_t cmdType); 79094332d3Sopenharmony_ci 80094332d3Sopenharmony_civoid TestStdGetConf(void); 81094332d3Sopenharmony_civoid TestStdGetInterface(void); 82094332d3Sopenharmony_civoid TestSpeed(void); 83094332d3Sopenharmony_civoid TestExit(void); 84094332d3Sopenharmony_cibool TestGetExitFlag(void); 85094332d3Sopenharmony_ci#ifdef __cplusplus 86094332d3Sopenharmony_ci} 87094332d3Sopenharmony_ci#endif /* __cplusplus */ 88094332d3Sopenharmony_ci 89094332d3Sopenharmony_ci#endif 90