1 #include <stdio.h>
2 #include <stdint.h>
3 #include <stdlib.h>
4 #include <string.h>
5
6 #include <usb/hal_hci.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: hci_ed_test hci_num test_type\n");
13 printf("hci_num : 0/1\n");
14 printf("test_type: test_not_operating\n");
15 printf(" : test_j_state\n");
16 printf(" : test_k_state\n");
17 printf(" : test_se0_nak\n");
18 printf(" : test_pack\n");
19 printf(" : test_force_enable\n");
20 printf(" : test_mask\n");
21 }
22
cmd_hal_hci_ed_test(int argc,const char ** argv)23 static int cmd_hal_hci_ed_test(int argc, const char **argv)
24 {
25 int hci_num = 0;
26
27 if (argc != 3)
28 {
29 show_ed_test_help();
30 return 0;
31 }
32 hci_num = atoi(argv[1]);
33 if (hci_num != 0 && hci_num != 1)
34 {
35 printf("err hci_num:%s\n", argv[1]);
36 show_ed_test_help();
37 return 0;
38 }
39 ehci_ed_test(hci_num, argv[2], strlen(argv[2]));
40 return 0;
41
42 }
FINSH_FUNCTION_EXPORT_CMD(cmd_hal_hci_ed_test,__cmd_hci_ed_test,hci hal ed tests)43 FINSH_FUNCTION_EXPORT_CMD(cmd_hal_hci_ed_test, __cmd_hci_ed_test, hci hal ed tests)
44
45 static void show_hci_dl_adjust(void)
46 {
47 printf("Usage: hci_dl_adjust hci_num driver_level\n");
48 printf("hci_num : 0/1\n");
49 printf("driver_level: [0-15]\n");
50 }
51
cmd_hci_dl_adjust(int argc,const char ** argv)52 static int cmd_hci_dl_adjust(int argc, const char **argv)
53 {
54 int hci_num = 0;
55 int driver_level = 0;
56
57 if (argc != 3)
58 {
59 show_hci_dl_adjust();
60 return 0;
61 }
62 hci_num = atoi(argv[1]);
63 driver_level = atoi(argv[2]);
64 if (hci_num != 0 && hci_num != 1)
65 {
66 printf("hci_num err:%s\n", argv[1]);
67 show_ed_test_help();
68 return 0;
69 }
70 if (driver_level < 0 || driver_level > 15)
71 {
72 printf("driver_level err:%s\n", argv[2]);
73 show_ed_test_help();
74 return 0;
75 }
76 ehci_usb_driverlevel_adjust(hci_num, driver_level);
77 return 0;
78
79 }
80 FINSH_FUNCTION_EXPORT_CMD(cmd_hci_dl_adjust, __cmd_hci_dl_adjust, hci driver level adjust)
81
82