1 /*
2  * Copyright (c) 2008-2009 Travis Geiselbrecht
3  *
4  * Use of this source code is governed by a MIT-style
5  * license that can be found in the LICENSE file or at
6  * https://opensource.org/licenses/MIT
7  */
8 #pragma once
9 
10 #include <lk/compiler.h>
11 #include <stdbool.h>
12 #include <stddef.h>
13 #include <sys/types.h>
14 
15 __BEGIN_CDECLS
16 
17 /* command args */
18 typedef struct {
19     const char *str;
20     unsigned long u;
21     void *p;
22     long i;
23     bool b;
24 } console_cmd_args;
25 
26 typedef int (*console_cmd_func)(int argc, const console_cmd_args *argv);
27 
28 #define CMD_AVAIL_NORMAL (0x1 << 0)
29 #define CMD_AVAIL_PANIC  (0x1 << 1)
30 #define CMD_AVAIL_ALWAYS (CMD_AVAIL_NORMAL | CMD_AVAIL_PANIC)
31 
32 __END_CDECLS
33 
34 /* Register a static block of commands at init time when lib/console is
35  * paret of the build. Otherwise stub out these definitions so that they do
36  * not get included.
37  */
38 #if WITH_LIB_CONSOLE
39 
40 /* pull the equivalent strctures and macros out of lib/console's headers */
41 #include <lib/console/cmd.h>
42 
43 #else
44 
45 /* no command blocks, so null them out */
46 #define STATIC_COMMAND_START
47 #define STATIC_COMMAND_END(name)
48 #define STATIC_COMMAND_START_NAMED(name)
49 #define STATIC_COMMAND_END_NAMED(name)
50 
51 #define STATIC_COMMAND(command_str, help_str, func)
52 #define STATIC_COMMAND_MASKED(command_str, help_str, func, availability_mask)
53 
54 
55 #endif
56