Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/console/cmd.c

    r40fb017 r96b02eb9  
    7878static cmd_info_t help_info = {
    7979        .name = "help",
    80         .description = "List supported commands.",
     80        .description = "List of supported commands.",
    8181        .func = cmd_help,
    8282        .argc = 0
    8383};
    8484
    85 /* Data and methods for 'reboot' command. */
    8685static int cmd_reboot(cmd_arg_t *argv);
    8786static cmd_info_t reboot_info = {
    8887        .name = "reboot",
    89         .description = "Reboot system.",
     88        .description = "Reboot.",
    9089        .func = cmd_reboot,
    9190        .argc = 0
    9291};
    9392
    94 /* Data and methods for 'uptime' command. */
    9593static int cmd_uptime(cmd_arg_t *argv);
    9694static cmd_info_t uptime_info = {
    9795        .name = "uptime",
    98         .description = "Show system uptime.",
     96        .description = "Print uptime information.",
    9997        .func = cmd_uptime,
    10098        .argc = 0
    10199};
    102100
    103 /* Data and methods for 'continue' command. */
    104101static int cmd_continue(cmd_arg_t *argv);
    105102static cmd_info_t continue_info = {
     
    111108
    112109#ifdef CONFIG_TEST
    113 
    114 /* Data and methods for 'test' command. */
    115110static char test_buf[MAX_CMDLINE + 1];
    116111static int cmd_test(cmd_arg_t *argv);
     
    124119static cmd_info_t test_info = {
    125120        .name = "test",
    126         .description = "<test> List kernel tests or run a test.",
     121        .description = "Print list of kernel tests or run a test.",
    127122        .func = cmd_test,
    128123        .argc = 1,
     
    130125};
    131126
    132 /* Data and methods for 'bench' command. */
    133127static int cmd_bench(cmd_arg_t *argv);
    134128static cmd_arg_t bench_argv[] = {
     
    144138static cmd_info_t bench_info = {
    145139        .name = "bench",
    146         .description = "<test> <count> Run kernel test as benchmark.",
     140        .description = "Run kernel test as benchmark.",
    147141        .func = cmd_bench,
    148142        .argc = 2,
    149143        .argv = bench_argv
    150144};
    151 
    152 #endif /* CONFIG_TEST */
     145#endif
    153146
    154147/* Data and methods for 'description' command. */
    155148static int cmd_desc(cmd_arg_t *argv);
    156149static void desc_help(void);
    157 static char desc_buf[MAX_CMDLINE + 1];
     150static char desc_buf[MAX_CMDLINE+1];
    158151static cmd_arg_t desc_argv = {
    159152        .type = ARG_TYPE_STRING,
     
    163156static cmd_info_t desc_info = {
    164157        .name = "describe",
    165         .description = "<command> Describe specified command.",
     158        .description = "Describe specified command.",
    166159        .help = desc_help,
    167160        .func = cmd_desc,
     
    172165/* Data and methods for 'symaddr' command. */
    173166static int cmd_symaddr(cmd_arg_t *argv);
    174 static char symaddr_buf[MAX_CMDLINE + 1];
     167static char symaddr_buf[MAX_CMDLINE+1];
    175168static cmd_arg_t symaddr_argv = {
    176169        .type = ARG_TYPE_STRING,
     
    180173static cmd_info_t symaddr_info = {
    181174        .name = "symaddr",
    182         .description = "<symbol> Return symbol address.",
     175        .description = "Return symbol address.",
    183176        .func = cmd_symaddr,
    184177        .argc = 1,
     
    186179};
    187180
    188 /* Data and methods for 'set4' command. */
    189 static char set_buf[MAX_CMDLINE + 1];
     181static char set_buf[MAX_CMDLINE+1];
    190182static int cmd_set4(cmd_arg_t *argv);
    191183static cmd_arg_t set4_argv[] = {
     
    201193static cmd_info_t set4_info = {
    202194        .name = "set4",
    203         .description = "<addr> <value> Set 4B memory location to a value.",
     195        .description = "set <dest_addr> <value> - 4byte version",
    204196        .func = cmd_set4,
    205197        .argc = 2,
     
    221213static cmd_info_t call0_info = {
    222214        .name = "call0",
    223         .description = "<function> Call function().",
     215        .description = "call0 <function> -> call function().",
    224216        .func = cmd_call0,
    225217        .argc = 1,
     
    236228static cmd_info_t mcall0_info = {
    237229        .name = "mcall0",
    238         .description = "<function> Call function() on each CPU.",
     230        .description = "mcall0 <function> -> call function() on each CPU.",
    239231        .func = cmd_mcall0,
    240232        .argc = 1,
     
    258250static cmd_info_t call1_info = {
    259251        .name = "call1",
    260         .description = "<function> <arg1> Call function(arg1).",
     252        .description = "call1 <function> <arg1> -> call function(arg1).",
    261253        .func = cmd_call1,
    262254        .argc = 2,
     
    285277static cmd_info_t call2_info = {
    286278        .name = "call2",
    287         .description = "<function> <arg1> <arg2> Call function(arg1, arg2).",
     279        .description = "call2 <function> <arg1> <arg2> -> call function(arg1,arg2).",
    288280        .func = cmd_call2,
    289281        .argc = 3,
     
    318310static cmd_info_t call3_info = {
    319311        .name = "call3",
    320         .description = "<function> <arg1> <arg2> <arg3> Call function(arg1, arg2, arg3).",
     312        .description = "call3 <function> <arg1> <arg2> <arg3> -> call function(arg1,arg2,arg3).",
    321313        .func = cmd_call3,
    322314        .argc = 4,
     
    348340cmd_info_t tlb_info = {
    349341        .name = "tlb",
    350         .description = "Print TLB of the current CPU.",
     342        .description = "Print TLB of current processor.",
    351343        .help = NULL,
    352344        .func = cmd_tlb,
     
    385377};
    386378
    387 #ifdef CONFIG_UDEBUG
    388 
    389 /* Data and methods for 'btrace' command */
    390 static int cmd_btrace(cmd_arg_t *argv);
    391 static cmd_arg_t btrace_argv = {
    392         .type = ARG_TYPE_INT,
    393 };
    394 static cmd_info_t btrace_info = {
    395         .name = "btrace",
    396         .description = "<threadid> Show thread stack trace.",
    397         .func = cmd_btrace,
    398         .argc = 1,
    399         .argv = &btrace_argv
    400 };
    401 
    402 #endif /* CONFIG_UDEBUG */
    403379
    404380static int cmd_sched(cmd_arg_t *argv);
    405381static cmd_info_t sched_info = {
    406382        .name = "scheduler",
    407         .description = "Show scheduler information.",
     383        .description = "List all scheduler information.",
    408384        .func = cmd_sched,
    409385        .argc = 0
     
    430406static cmd_info_t zones_info = {
    431407        .name = "zones",
    432         .description = "List memory zones.",
     408        .description = "List of memory zones.",
    433409        .func = cmd_zones,
    434410        .argc = 0
     411};
     412
     413/* Data and methods for 'ipc' command */
     414static int cmd_ipc(cmd_arg_t *argv);
     415static cmd_arg_t ipc_argv = {
     416        .type = ARG_TYPE_INT,
     417};
     418static cmd_info_t ipc_info = {
     419        .name = "ipc",
     420        .description = "ipc <taskid> Show IPC information of given task.",
     421        .func = cmd_ipc,
     422        .argc = 1,
     423        .argv = &ipc_argv
     424};
     425
     426/* Data and methods for 'kill' command */
     427static int cmd_kill(cmd_arg_t *argv);
     428static cmd_arg_t kill_argv = {
     429        .type = ARG_TYPE_INT,
     430};
     431static cmd_info_t kill_info = {
     432        .name = "kill",
     433        .description = "kill <taskid> Kill a task.",
     434        .func = cmd_kill,
     435        .argc = 1,
     436        .argv = &kill_argv
    435437};
    436438
     
    443445static cmd_info_t zone_info = {
    444446        .name = "zone",
    445         .description = "<zone> Show memory zone structure.",
     447        .description = "Show memory zone structure.",
    446448        .func = cmd_zone,
    447449        .argc = 1,
    448450        .argv = &zone_argv
    449 };
    450 
    451 /* Data and methods for 'ipc' command */
    452 static int cmd_ipc(cmd_arg_t *argv);
    453 static cmd_arg_t ipc_argv = {
    454         .type = ARG_TYPE_INT,
    455 };
    456 static cmd_info_t ipc_info = {
    457         .name = "ipc",
    458         .description = "<taskid> Show IPC information of a task.",
    459         .func = cmd_ipc,
    460         .argc = 1,
    461         .argv = &ipc_argv
    462 };
    463 
    464 /* Data and methods for 'kill' command */
    465 static int cmd_kill(cmd_arg_t *argv);
    466 static cmd_arg_t kill_argv = {
    467         .type = ARG_TYPE_INT,
    468 };
    469 static cmd_info_t kill_info = {
    470         .name = "kill",
    471         .description = "<taskid> Kill a task.",
    472         .func = cmd_kill,
    473         .argc = 1,
    474         .argv = &kill_argv
    475451};
    476452
     
    506482        &cpus_info,
    507483        &desc_info,
     484        &reboot_info,
     485        &uptime_info,
    508486        &halt_info,
    509487        &help_info,
    510488        &ipc_info,
    511489        &kill_info,
    512         &physmem_info,
    513         &reboot_info,
    514         &sched_info,
    515490        &set4_info,
    516491        &slabs_info,
     492        &sysinfo_info,
    517493        &symaddr_info,
    518         &sysinfo_info,
     494        &sched_info,
     495        &threads_info,
    519496        &tasks_info,
    520         &threads_info,
     497        &physmem_info,
    521498        &tlb_info,
    522         &uptime_info,
    523499        &version_info,
    524500        &zones_info,
     
    528504        &bench_info,
    529505#endif
    530 #ifdef CONFIG_UDEBUG
    531         &btrace_info,
    532 #endif
    533506        NULL
    534507};
     
    553526        for (i = 0; basic_commands[i]; i++) {
    554527                cmd_initialize(basic_commands[i]);
    555         }
    556 
    557         for (i = 0; basic_commands[i]; i++) {
    558                 if (!cmd_register(basic_commands[i])) {
    559                         printf("Cannot register command %s\n",
    560                             basic_commands[i]->name);
    561                 }
    562         }
    563 }
     528                if (!cmd_register(basic_commands[i]))
     529                        printf("Cannot register command %s\n", basic_commands[i]->name);
     530        }
     531}
     532
    564533
    565534/** List supported commands.
     
    605574}
    606575
     576
    607577/** Reboot the system.
    608578 *
     
    618588        return 1;
    619589}
     590
    620591
    621592/** Print system uptime information.
     
    853824}
    854825
     826
    855827/** Print detailed description of 'describe' command. */
    856828void desc_help(void)
     
    939911 * @return Always 1
    940912 */
    941 int cmd_slabs(cmd_arg_t *argv)
     913int cmd_slabs(cmd_arg_t * argv)
    942914{
    943915        slab_print_list();
     
    951923 * @return Always 1
    952924 */
    953 int cmd_sysinfo(cmd_arg_t *argv)
     925int cmd_sysinfo(cmd_arg_t * argv)
    954926{
    955927        sysinfo_dump(NULL);
     
    957929}
    958930
    959 /** Command for listing thread information
     931
     932/** Command for listings Thread information
    960933 *
    961934 * @param argv Ignored
     
    975948}
    976949
    977 /** Command for listing task information
     950/** Command for listings Task information
    978951 *
    979952 * @param argv Ignored
     
    993966}
    994967
    995 #ifdef CONFIG_UDEBUG
    996 
    997 /** Command for printing thread stack trace
     968/** Command for listings Thread information
     969 *
     970 * @param argv Ignores
     971 *
     972 * @return Always 1
     973 */
     974int cmd_sched(cmd_arg_t * argv)
     975{
     976        sched_print_list();
     977        return 1;
     978}
     979
     980/** Command for listing memory zones
     981 *
     982 * @param argv Ignored
     983 *
     984 * return Always 1
     985 */
     986int cmd_zones(cmd_arg_t * argv)
     987{
     988        zones_print_list();
     989        return 1;
     990}
     991
     992/** Command for memory zone details
    998993 *
    999994 * @param argv Integer argument from cmdline expected
    1000995 *
    1001996 * return Always 1
    1002  *
    1003  */
    1004 int cmd_btrace(cmd_arg_t *argv)
    1005 {
    1006         thread_stack_trace(argv[0].intval);
    1007         return 1;
    1008 }
    1009 
    1010 #endif /* CONFIG_UDEBUG */
    1011 
    1012 /** Command for printing scheduler information
    1013  *
    1014  * @param argv Ignores
    1015  *
    1016  * @return Always 1
    1017  */
    1018 int cmd_sched(cmd_arg_t *argv)
    1019 {
    1020         sched_print_list();
    1021         return 1;
    1022 }
    1023 
    1024 /** Command for listing memory zones
    1025  *
    1026  * @param argv Ignored
     997 */
     998int cmd_zone(cmd_arg_t * argv)
     999{
     1000        zone_print_one(argv[0].intval);
     1001        return 1;
     1002}
     1003
     1004/** Command for printing task ipc details
     1005 *
     1006 * @param argv Integer argument from cmdline expected
    10271007 *
    10281008 * return Always 1
    10291009 */
    1030 int cmd_zones(cmd_arg_t *argv)
    1031 {
    1032         zones_print_list();
    1033         return 1;
    1034 }
    1035 
    1036 /** Command for memory zone details
     1010int cmd_ipc(cmd_arg_t * argv)
     1011{
     1012        ipc_print_task(argv[0].intval);
     1013        return 1;
     1014}
     1015
     1016/** Command for killing a task
    10371017 *
    10381018 * @param argv Integer argument from cmdline expected
    10391019 *
    1040  * return Always 1
    1041  */
    1042 int cmd_zone(cmd_arg_t *argv)
    1043 {
    1044         zone_print_one(argv[0].intval);
    1045         return 1;
    1046 }
    1047 
    1048 /** Command for printing task IPC details
    1049  *
    1050  * @param argv Integer argument from cmdline expected
    1051  *
    1052  * return Always 1
    1053  */
    1054 int cmd_ipc(cmd_arg_t *argv)
    1055 {
    1056         ipc_print_task(argv[0].intval);
    1057         return 1;
    1058 }
    1059 
    1060 /** Command for killing a task
    1061  *
    1062  * @param argv Integer argument from cmdline expected
    1063  *
    10641020 * return 0 on failure, 1 on success.
    10651021 */
    1066 int cmd_kill(cmd_arg_t *argv)
     1022int cmd_kill(cmd_arg_t * argv)
    10671023{
    10681024        if (task_kill(argv[0].intval) != EOK)
Note: See TracChangeset for help on using the changeset viewer.