1 /* 2 * Copyright (C) 2015-2020 Alibaba Group Holding Limited 3 */ 4 #include <stdio.h> 5 #include <stdlib.h> 6 #include <aos/errno.h> 7 #include <aos/kernel.h> 8 #include "aos/init.h" 9 #include "board.h" 10 #include <k_api.h> 11 #include "aos/cli.h" 12 13 extern int usb_class_detect; 14 usb_test_internal()15static int usb_test_internal() 16 { 17 printf("\r\n\r\n"); 18 printf("***************************************************************\r\n"); 19 printf("*********************** USB Test ******************************\r\n"); 20 printf("** How to test: ***********************************************\r\n"); 21 printf("***************************************************************\r\n"); 22 printf("***************************************************************\r\n"); 23 printf("\r\n ===usb test start====\r\n"); 24 /* 25 usb_class_detect = 1; 26 27 if (usb_class_detect > 0) { 28 printf("===Result : usb test PASS !!! ===\r\n"); 29 return 0; 30 } else { 31 printf("===Warning: usb test FAIL !!! ===\r\n"); 32 return -1; 33 } 34 */ 35 return 0; 36 } 37 handle_usbtest_cmd(char * pwbuf,int blen,int argc,char ** argv)38static void handle_usbtest_cmd(char *pwbuf, int blen, int argc, char **argv) 39 { 40 usb_test_internal(); 41 } 42 static struct cli_command usbtest_cmd = { 43 .name = "usbtest", 44 .help = "usbtest", 45 .function = handle_usbtest_cmd 46 }; 47 usb_test(void)48int usb_test(void) 49 { 50 aos_cli_register_command(&usbtest_cmd); 51 return usb_test_internal(); 52 } 53