1 #include <stdio.h>
2 #include <stdint.h>
3 #include <stdlib.h>
4 #include <string.h>
5
6 #include <usb/sunxi_hal_udc.h>
7 #include <hal_cmd.h>
8 #include <hal_log.h>
9
show_ed_test_help(void)10 static void show_ed_test_help(void)
11 {
12 printf("Usage: ed_test test_type\n");
13 printf("test_type: test_j_state\n");
14 printf(" : test_k_state\n");
15 printf(" : test_se0_nak\n");
16 printf(" : test_pack\n");
17 }
18
cmd_hal_udc_ed_test(int argc,const char ** argv)19 static int cmd_hal_udc_ed_test(int argc, const char **argv)
20 {
21 if (argc != 2)
22 {
23 show_ed_test_help();
24 return 0;
25 }
26 ed_test(argv[1], strlen(argv[1]));
27 return 0;
28
29 }
FINSH_FUNCTION_EXPORT_CMD(cmd_hal_udc_ed_test,__cmd_hal_udc_ed_test,udc hal ed tests)30 FINSH_FUNCTION_EXPORT_CMD(cmd_hal_udc_ed_test, __cmd_hal_udc_ed_test, udc hal ed tests)
31
32 static void show_hal_udc_dl_adjust_help(void)
33 {
34 printf("Usage: hal_udc_dl_adjust driverlevel\n");
35 printf("driverlevel: [0-15]\n");
36 }
37
cmd_hal_udc_dl_adjust(int argc,const char ** argv)38 static int cmd_hal_udc_dl_adjust(int argc, const char **argv)
39 {
40 int driver_level = 0;
41 if (argc != 2)
42 {
43 show_hal_udc_dl_adjust_help();
44 return 0;
45 }
46
47 driver_level = atoi(argv[1]);
48
49 if (driver_level < 0 || driver_level > 15)
50 {
51 printf("driver_level err:%s\n", argv[1]);
52 show_hal_udc_dl_adjust_help();
53 return 0;
54 }
55 hal_udc_driverlevel_adjust(driver_level);
56 return 0;
57
58 }
59 FINSH_FUNCTION_EXPORT_CMD(cmd_hal_udc_dl_adjust, __cmd_hal_udc_dl_adjust, udc hal driverlevel adjust)
60