summaryrefslogtreecommitdiff
path: root/bsp/allwinner/libraries/sunxi-hal/hal/test/usb/host/hci_ed_test.c
blob: 75a24ac3c31acbd7e89fd8e4837c46d543e10bfa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>

#include <usb/hal_hci.h>
#include <hal_cmd.h>
#include <hal_log.h>

static void show_ed_test_help(void)
{
    printf("Usage: hci_ed_test hci_num test_type\n");
    printf("hci_num  : 0/1\n");
    printf("test_type: test_not_operating\n");
    printf("           : test_j_state\n");
    printf("           : test_k_state\n");
    printf("           : test_se0_nak\n");
    printf("           : test_pack\n");
    printf("           : test_force_enable\n");
    printf("           : test_mask\n");
}

static int cmd_hal_hci_ed_test(int argc, const char **argv)
{
    int hci_num = 0;

    if (argc != 3)
    {
        show_ed_test_help();
        return 0;
    }
    hci_num = atoi(argv[1]);
    if (hci_num != 0 && hci_num != 1)
    {
        printf("err hci_num:%s\n", argv[1]);
        show_ed_test_help();
        return 0;
    }
    ehci_ed_test(hci_num, argv[2], strlen(argv[2]));
    return 0;

}
FINSH_FUNCTION_EXPORT_CMD(cmd_hal_hci_ed_test, __cmd_hci_ed_test, hci hal ed tests)

static void show_hci_dl_adjust(void)
{
    printf("Usage: hci_dl_adjust hci_num driver_level\n");
    printf("hci_num  : 0/1\n");
    printf("driver_level: [0-15]\n");
}

static int cmd_hci_dl_adjust(int argc, const char **argv)
{
    int hci_num = 0;
    int driver_level = 0;

    if (argc != 3)
    {
        show_hci_dl_adjust();
        return 0;
    }
    hci_num = atoi(argv[1]);
    driver_level = atoi(argv[2]);
    if (hci_num != 0 && hci_num != 1)
    {
        printf("hci_num err:%s\n", argv[1]);
        show_ed_test_help();
        return 0;
    }
    if (driver_level < 0 || driver_level > 15)
    {
        printf("driver_level err:%s\n", argv[2]);
        show_ed_test_help();
        return 0;
    }
    ehci_usb_driverlevel_adjust(hci_num, driver_level);
    return 0;

}
FINSH_FUNCTION_EXPORT_CMD(cmd_hci_dl_adjust, __cmd_hci_dl_adjust, hci driver level adjust)