Rev 1929 | Rev 2020 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1929 | Rev 2019 | ||
---|---|---|---|
Line 63... | Line 63... | ||
63 | #include <proc/thread.h> |
63 | #include <proc/thread.h> |
64 | #include <proc/task.h> |
64 | #include <proc/task.h> |
65 | #include <ipc/ipc.h> |
65 | #include <ipc/ipc.h> |
66 | #include <ipc/irq.h> |
66 | #include <ipc/irq.h> |
67 | 67 | ||
- | 68 | #ifdef CONFIG_TEST |
|
- | 69 | #include <test.h> |
|
- | 70 | #endif |
|
- | 71 | ||
68 | /* Data and methods for 'help' command. */ |
72 | /* Data and methods for 'help' command. */ |
69 | static int cmd_help(cmd_arg_t *argv); |
73 | static int cmd_help(cmd_arg_t *argv); |
70 | static cmd_info_t help_info = { |
74 | static cmd_info_t help_info = { |
71 | .name = "help", |
75 | .name = "help", |
72 | .description = "List of supported commands.", |
76 | .description = "List of supported commands.", |
Line 74... | Line 78... | ||
74 | .argc = 0 |
78 | .argc = 0 |
75 | }; |
79 | }; |
76 | 80 | ||
77 | static cmd_info_t exit_info = { |
81 | static cmd_info_t exit_info = { |
78 | .name = "exit", |
82 | .name = "exit", |
79 | .description ="Exit kconsole", |
83 | .description = "Exit kconsole", |
80 | .argc = 0 |
84 | .argc = 0 |
81 | }; |
85 | }; |
82 | 86 | ||
83 | static int cmd_continue(cmd_arg_t *argv); |
87 | static int cmd_continue(cmd_arg_t *argv); |
84 | static cmd_info_t continue_info = { |
88 | static cmd_info_t continue_info = { |
85 | .name = "continue", |
89 | .name = "continue", |
86 | .description ="Return console back to userspace.", |
90 | .description = "Return console back to userspace.", |
87 | .func = cmd_continue, |
91 | .func = cmd_continue, |
88 | .argc = 0 |
92 | .argc = 0 |
89 | }; |
93 | }; |
90 | 94 | ||
- | 95 | #ifdef CONFIG_TEST |
|
- | 96 | static int cmd_tests(cmd_arg_t *argv); |
|
- | 97 | static cmd_info_t tests_info = { |
|
- | 98 | .name = "tests", |
|
- | 99 | .description = "Print available kernel tests.", |
|
- | 100 | .func = cmd_tests, |
|
- | 101 | .argc = 0 |
|
- | 102 | }; |
|
- | 103 | ||
- | 104 | static char test_buf[MAX_CMDLINE + 1]; |
|
- | 105 | static int cmd_test(cmd_arg_t *argv); |
|
- | 106 | static cmd_arg_t test_argv[] = { |
|
- | 107 | { |
|
- | 108 | .type = ARG_TYPE_STRING, |
|
- | 109 | .buffer = test_buf, |
|
- | 110 | .len = sizeof(test_buf) |
|
- | 111 | } |
|
- | 112 | }; |
|
- | 113 | static cmd_info_t test_info = { |
|
- | 114 | .name = "test", |
|
- | 115 | .description = "Run kernel test.", |
|
- | 116 | .func = cmd_test, |
|
- | 117 | .argc = 1, |
|
- | 118 | .argv = test_argv |
|
- | 119 | }; |
|
- | 120 | #endif |
|
- | 121 | ||
91 | /* Data and methods for 'description' command. */ |
122 | /* Data and methods for 'description' command. */ |
92 | static int cmd_desc(cmd_arg_t *argv); |
123 | static int cmd_desc(cmd_arg_t *argv); |
93 | static void desc_help(void); |
124 | static void desc_help(void); |
94 | static char desc_buf[MAX_CMDLINE+1]; |
125 | static char desc_buf[MAX_CMDLINE+1]; |
95 | static cmd_arg_t desc_argv = { |
126 | static cmd_arg_t desc_argv = { |
Line 375... | Line 406... | ||
375 | &tasks_info, |
406 | &tasks_info, |
376 | &tlb_info, |
407 | &tlb_info, |
377 | &version_info, |
408 | &version_info, |
378 | &zones_info, |
409 | &zones_info, |
379 | &zone_info, |
410 | &zone_info, |
- | 411 | #ifdef CONFIG_TEST |
|
- | 412 | &tests_info, |
|
- | 413 | &test_info, |
|
- | 414 | #endif |
|
380 | NULL |
415 | NULL |
381 | }; |
416 | }; |
382 | 417 | ||
383 | 418 | ||
384 | /** Initialize command info structure. |
419 | /** Initialize command info structure. |
Line 803... | Line 838... | ||
803 | printf("Use userspace controls to redraw the screen.\n"); |
838 | printf("Use userspace controls to redraw the screen.\n"); |
804 | arch_release_console(); |
839 | arch_release_console(); |
805 | return 1; |
840 | return 1; |
806 | } |
841 | } |
807 | 842 | ||
- | 843 | /** Command for printing kernel tests list. |
|
- | 844 | * |
|
- | 845 | * @param argv Ignored. |
|
- | 846 | * |
|
- | 847 | * return Always 1. |
|
- | 848 | */ |
|
- | 849 | int cmd_tests(cmd_arg_t *argv) |
|
- | 850 | { |
|
- | 851 | test_t *test; |
|
- | 852 | ||
- | 853 | for (test = tests; test->name != NULL; test++) |
|
- | 854 | printf("%s\t%s\n", test->name, test->desc); |
|
- | 855 | ||
- | 856 | return 1; |
|
- | 857 | } |
|
- | 858 | ||
- | 859 | /** Command for returning kernel tests |
|
- | 860 | * |
|
- | 861 | * @param argv Argument vector. |
|
- | 862 | * |
|
- | 863 | * return Always 1. |
|
- | 864 | */ |
|
- | 865 | int cmd_test(cmd_arg_t *argv) |
|
- | 866 | { |
|
- | 867 | bool fnd = false; |
|
- | 868 | test_t *test; |
|
- | 869 | ||
- | 870 | for (test = tests; test->name != NULL; test++) { |
|
- | 871 | if (strcmp(test->name, argv->buffer) == 0) { |
|
- | 872 | fnd = true; |
|
- | 873 | test->entry(); |
|
- | 874 | break; |
|
- | 875 | } |
|
- | 876 | } |
|
- | 877 | ||
- | 878 | if (!fnd) |
|
- | 879 | printf("Unknown test.\n"); |
|
- | 880 | ||
- | 881 | return 1; |
|
- | 882 | } |
|
- | 883 | ||
808 | /** @} |
884 | /** @} |
809 | */ |
885 | */ |