[lib][console] rename some console command types to be prefixed with console_
Some of the structures, notably 'cmd', in the lib console stuff are a little too generically named and have collided with some other code so prefix the names a bit more cleanly with console_ The change is largely mechanical, and folks with out of tree code can easily switch by renaming: cmd -> console_cmd cmd_args -> console_cmd_args cmd_block -> console_cmd_block console_cmd -> console_cmd_func Apologies if this breaks you but it should be pretty easy to fix.
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
void read_xyz(void);
|
||||
|
||||
STATIC_COMMAND_START
|
||||
STATIC_COMMAND("read_xyz", "read xyz vectors", (console_cmd)&read_xyz)
|
||||
STATIC_COMMAND("read_xyz", "read xyz vectors", (console_cmd_func)&read_xyz)
|
||||
STATIC_COMMAND_END(accelerometer);
|
||||
|
||||
void read_xyz(void) {
|
||||
|
||||
@@ -127,7 +127,7 @@ int tftp_callback(void *data, size_t len, void *arg) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int loader(int argc, const cmd_args *argv) {
|
||||
static int loader(int argc, const console_cmd_args *argv) {
|
||||
static int any_slot = 0;
|
||||
static int elf_slot = 1;
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ error:
|
||||
* a somewhat fugly pci config space examine/modify command. this should probably
|
||||
* be broken up a bit.
|
||||
*/
|
||||
static int pci_config(int argc, const cmd_args *argv) {
|
||||
static int pci_config(int argc, const console_cmd_args *argv) {
|
||||
pci_location_t loc;
|
||||
pci_config_t config;
|
||||
uint32_t offset;
|
||||
@@ -206,7 +206,7 @@ error:
|
||||
return -2;
|
||||
}
|
||||
|
||||
static int pci_cmd(int argc, const cmd_args *argv) {
|
||||
static int pci_cmd(int argc, const console_cmd_args *argv) {
|
||||
if (argc < 2) {
|
||||
printf("pci commands:\n");
|
||||
usage:
|
||||
|
||||
@@ -274,7 +274,7 @@ static void validate_memset(void) {
|
||||
}
|
||||
}
|
||||
|
||||
static int string_tests(int argc, const cmd_args *argv) {
|
||||
static int string_tests(int argc, const console_cmd_args *argv) {
|
||||
src = memalign(64, BUFFER_SIZE + 256);
|
||||
dst = memalign(64, BUFFER_SIZE + 256);
|
||||
src2 = memalign(64, BUFFER_SIZE + 256);
|
||||
|
||||
@@ -225,7 +225,7 @@ __NO_INLINE static void bench_sincos(void) {
|
||||
|
||||
#endif // WITH_LIB_LIBM
|
||||
|
||||
int benchmarks(int argc, const cmd_args *argv) {
|
||||
int benchmarks(int argc, const console_cmd_args *argv) {
|
||||
bench_set_overhead();
|
||||
bench_memset();
|
||||
bench_memcpy();
|
||||
|
||||
@@ -50,7 +50,7 @@ static void bench_cache(size_t bufsize, uint8_t *buf) {
|
||||
printf("took %llu usecs to clean %d bytes (hot)\n", t, bufsize);
|
||||
}
|
||||
|
||||
static int cache_tests(int argc, const cmd_args *argv) {
|
||||
static int cache_tests(int argc, const console_cmd_args *argv) {
|
||||
uint8_t *buf;
|
||||
buf = (uint8_t *)((argc > 1) ? argv[1].u : 0UL);
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
} \
|
||||
} while (0);
|
||||
|
||||
int cbuf_tests(int argc, const cmd_args *argv) {
|
||||
int cbuf_tests(int argc, const console_cmd_args *argv) {
|
||||
cbuf_t cbuf;
|
||||
|
||||
printf("running basic tests...\n");
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <kernel/event.h>
|
||||
#include <platform.h>
|
||||
|
||||
int clock_tests(int argc, const cmd_args *argv) {
|
||||
int clock_tests(int argc, const console_cmd_args *argv) {
|
||||
ulong c;
|
||||
lk_time_t t;
|
||||
lk_bigtime_t t2;
|
||||
|
||||
@@ -52,7 +52,7 @@ static int fibo_thread(void *argv) {
|
||||
return retcode0 + retcode1;
|
||||
}
|
||||
|
||||
int fibo(int argc, const cmd_args *argv) {
|
||||
int fibo(int argc, const console_cmd_args *argv) {
|
||||
|
||||
if (argc < 2) {
|
||||
printf("not enough args\n");
|
||||
|
||||
@@ -70,7 +70,7 @@ static void arm_float_instruction_trap_test(void) {
|
||||
}
|
||||
#endif
|
||||
|
||||
static void float_tests(void) {
|
||||
static int float_tests(int argc, const console_cmd_args *argv) {
|
||||
printf("floating point test:\n");
|
||||
|
||||
/* test lazy fpu load on separate thread */
|
||||
@@ -97,10 +97,12 @@ static void float_tests(void) {
|
||||
/* test all the instruction traps */
|
||||
arm_float_instruction_trap_test();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
STATIC_COMMAND_START
|
||||
STATIC_COMMAND("float_tests", "floating point test", (console_cmd)&float_tests)
|
||||
STATIC_COMMAND("float_tests", "floating point test", &float_tests)
|
||||
STATIC_COMMAND_END(float_tests);
|
||||
|
||||
#endif // ARM_WITH_VFP || ARCH_ARM64
|
||||
|
||||
@@ -10,15 +10,15 @@
|
||||
|
||||
#include <lk/console_cmd.h>
|
||||
|
||||
int cbuf_tests(int argc, const cmd_args *argv);
|
||||
int fibo(int argc, const cmd_args *argv);
|
||||
int port_tests(int argc, const cmd_args *argv);
|
||||
int spinner(int argc, const cmd_args *argv);
|
||||
int thread_tests(int argc, const cmd_args *argv);
|
||||
int benchmarks(int argc, const cmd_args *argv);
|
||||
int clock_tests(int argc, const cmd_args *argv);
|
||||
int printf_tests(int argc, const cmd_args *argv);
|
||||
int printf_tests_float(int argc, const cmd_args *argv);
|
||||
int cbuf_tests(int argc, const console_cmd_args *argv);
|
||||
int fibo(int argc, const console_cmd_args *argv);
|
||||
int port_tests(int argc, const console_cmd_args *argv);
|
||||
int spinner(int argc, const console_cmd_args *argv);
|
||||
int thread_tests(int argc, const console_cmd_args *argv);
|
||||
int benchmarks(int argc, const console_cmd_args *argv);
|
||||
int clock_tests(int argc, const console_cmd_args *argv);
|
||||
int printf_tests(int argc, const console_cmd_args *argv);
|
||||
int printf_tests_float(int argc, const console_cmd_args *argv);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ out:
|
||||
printf("done with tests\n");
|
||||
}
|
||||
|
||||
static int mem_test(int argc, const cmd_args *argv) {
|
||||
static int mem_test(int argc, const console_cmd_args *argv) {
|
||||
if (argc < 2) {
|
||||
printf("not enough arguments\n");
|
||||
usage:
|
||||
|
||||
@@ -707,7 +707,7 @@ int group_waiting(void) {
|
||||
|
||||
#define RUN_TEST(t) result = t(); if (result) goto fail
|
||||
|
||||
int port_tests(int argc, const cmd_args *argv) {
|
||||
int port_tests(int argc, const console_cmd_args *argv) {
|
||||
int result;
|
||||
int count = 3;
|
||||
while (count--) {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat"
|
||||
|
||||
int printf_tests(int argc, const cmd_args *argv) {
|
||||
int printf_tests(int argc, const console_cmd_args *argv) {
|
||||
printf("printf tests\n");
|
||||
|
||||
printf("numbers:\n");
|
||||
@@ -111,7 +111,7 @@ int printf_tests(int argc, const cmd_args *argv) {
|
||||
|
||||
#include "float_test_vec.c"
|
||||
|
||||
int printf_tests_float(int argc, const cmd_args *argv) {
|
||||
int printf_tests_float(int argc, const console_cmd_args *argv) {
|
||||
printf("floating point printf tests\n");
|
||||
|
||||
for (size_t i = 0; i < float_test_vec_size; i++) {
|
||||
|
||||
@@ -578,7 +578,7 @@ static void spinlock_test(void) {
|
||||
#undef COUNT
|
||||
}
|
||||
|
||||
int thread_tests(int argc, const cmd_args *argv) {
|
||||
int thread_tests(int argc, const console_cmd_args *argv) {
|
||||
mutex_test();
|
||||
semaphore_test();
|
||||
event_test();
|
||||
@@ -603,7 +603,7 @@ static int spinner_thread(void *arg) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int spinner(int argc, const cmd_args *argv) {
|
||||
int spinner(int argc, const console_cmd_args *argv) {
|
||||
if (argc < 2) {
|
||||
printf("not enough args\n");
|
||||
printf("usage: %s <priority> <rt>\n", argv[0].str);
|
||||
|
||||
@@ -136,7 +136,7 @@ static void dcc_rx_callback(uint32_t val) {
|
||||
printf("count %d\n", count);
|
||||
}
|
||||
|
||||
static int cmd_dcc(int argc, const cmd_args *argv) {
|
||||
static int cmd_dcc(int argc, const console_cmd_args *argv) {
|
||||
static bool dcc_started = false;
|
||||
|
||||
if (argc < 2) {
|
||||
|
||||
@@ -42,7 +42,7 @@ static unsigned int get_flag_value(const char *str) {
|
||||
/* Ideally this would be generic, but different platforms have varying manners of handling gpio
|
||||
* numbers / banks etc. Nvidia uses A-F, ST uses # and ports, Xilinx uses #s and banks. Etc.
|
||||
*/
|
||||
static int cmd_gpio(int argc, const cmd_args *argv) {
|
||||
static int cmd_gpio(int argc, const console_cmd_args *argv) {
|
||||
if (argc == 4 && !strcmp(argv[1].str,"set")) {
|
||||
unsigned int gpio = argv[2].u;
|
||||
unsigned int value = argv[3].u;
|
||||
|
||||
4
external/lib/aes/test/aes_test.c
vendored
4
external/lib/aes/test/aes_test.c
vendored
@@ -32,7 +32,7 @@ static const uint8_t expected_ciphertext[] = {
|
||||
0xd8, 0xcd, 0xb7, 0x80, 0x70, 0xb4, 0xc5, 0x5a
|
||||
};
|
||||
|
||||
static int aes_command(int argc, const cmd_args *argv)
|
||||
static int aes_command(int argc, const console_cmd_args *argv)
|
||||
{
|
||||
AES_KEY aes_key;
|
||||
uint8_t ciphertext[AES_BLOCK_SIZE];
|
||||
@@ -60,7 +60,7 @@ static int aes_command(int argc, const cmd_args *argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int aes_bench(int argc, const cmd_args *argv)
|
||||
static int aes_bench(int argc, const console_cmd_args *argv)
|
||||
{
|
||||
uint32_t c;
|
||||
int i;
|
||||
|
||||
16
external/lib/cksum/debug.c
vendored
16
external/lib/cksum/debug.c
vendored
@@ -30,10 +30,10 @@
|
||||
|
||||
#include <lk/console_cmd.h>
|
||||
|
||||
static int cmd_crc16(int argc, const cmd_args *argv);
|
||||
static int cmd_crc32(int argc, const cmd_args *argv);
|
||||
static int cmd_adler32(int argc, const cmd_args *argv);
|
||||
static int cmd_cksum_bench(int argc, const cmd_args *argv);
|
||||
static int cmd_crc16(int argc, const console_cmd_args *argv);
|
||||
static int cmd_crc32(int argc, const console_cmd_args *argv);
|
||||
static int cmd_adler32(int argc, const console_cmd_args *argv);
|
||||
static int cmd_cksum_bench(int argc, const console_cmd_args *argv);
|
||||
|
||||
STATIC_COMMAND_START
|
||||
#if LK_DEBUGLEVEL > 0
|
||||
@@ -46,7 +46,7 @@ STATIC_COMMAND("bench_cksum", "benchmark the checksum routines", &cmd_cksum_benc
|
||||
#endif
|
||||
STATIC_COMMAND_END(crc);
|
||||
|
||||
static int cmd_crc16(int argc, const cmd_args *argv)
|
||||
static int cmd_crc16(int argc, const console_cmd_args *argv)
|
||||
{
|
||||
if (argc < 3) {
|
||||
printf("not enough arguments\n");
|
||||
@@ -61,7 +61,7 @@ static int cmd_crc16(int argc, const cmd_args *argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmd_crc32(int argc, const cmd_args *argv)
|
||||
static int cmd_crc32(int argc, const console_cmd_args *argv)
|
||||
{
|
||||
if (argc < 3) {
|
||||
printf("not enough arguments\n");
|
||||
@@ -76,7 +76,7 @@ static int cmd_crc32(int argc, const cmd_args *argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmd_adler32(int argc, const cmd_args *argv)
|
||||
static int cmd_adler32(int argc, const console_cmd_args *argv)
|
||||
{
|
||||
if (argc < 3) {
|
||||
printf("not enough arguments\n");
|
||||
@@ -91,7 +91,7 @@ static int cmd_adler32(int argc, const cmd_args *argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmd_cksum_bench(int argc, const cmd_args *argv)
|
||||
static int cmd_cksum_bench(int argc, const console_cmd_args *argv)
|
||||
{
|
||||
#define BUFSIZE 0x1000
|
||||
#define ITER 16384
|
||||
|
||||
2
external/lib/lwip/cmd.c
vendored
2
external/lib/lwip/cmd.c
vendored
@@ -28,7 +28,7 @@
|
||||
#include <lwip/api.h>
|
||||
#include <lwip/ip_addr.h>
|
||||
|
||||
static int net_cmd(int argc, const cmd_args *argv)
|
||||
static int net_cmd(int argc, const console_cmd_args *argv)
|
||||
{
|
||||
if (argc < 2) {
|
||||
printf("%s commands:\n", argv[0].str);
|
||||
|
||||
@@ -27,10 +27,10 @@
|
||||
#include <platform.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static int cmd_threads(int argc, const cmd_args *argv);
|
||||
static int cmd_threadstats(int argc, const cmd_args *argv);
|
||||
static int cmd_threadload(int argc, const cmd_args *argv);
|
||||
static int cmd_kevlog(int argc, const cmd_args *argv);
|
||||
static int cmd_threads(int argc, const console_cmd_args *argv);
|
||||
static int cmd_threadstats(int argc, const console_cmd_args *argv);
|
||||
static int cmd_threadload(int argc, const console_cmd_args *argv);
|
||||
static int cmd_kevlog(int argc, const console_cmd_args *argv);
|
||||
|
||||
STATIC_COMMAND_START
|
||||
#if LK_DEBUGLEVEL > 1
|
||||
@@ -46,7 +46,7 @@ STATIC_COMMAND_MASKED("kevlog", "dump kernel event log", &cmd_kevlog, CMD_AVAIL_
|
||||
STATIC_COMMAND_END(kernel);
|
||||
|
||||
#if LK_DEBUGLEVEL > 1
|
||||
static int cmd_threads(int argc, const cmd_args *argv) {
|
||||
static int cmd_threads(int argc, const console_cmd_args *argv) {
|
||||
printf("thread list:\n");
|
||||
dump_all_threads();
|
||||
|
||||
@@ -55,7 +55,7 @@ static int cmd_threads(int argc, const cmd_args *argv) {
|
||||
#endif
|
||||
|
||||
#if THREAD_STATS
|
||||
static int cmd_threadstats(int argc, const cmd_args *argv) {
|
||||
static int cmd_threadstats(int argc, const console_cmd_args *argv) {
|
||||
for (uint i = 0; i < SMP_MAX_CPUS; i++) {
|
||||
if (!mp_is_cpu_active(i))
|
||||
continue;
|
||||
@@ -127,7 +127,7 @@ static enum handler_return threadload(struct timer *t, lk_time_t now, void *arg)
|
||||
return INT_NO_RESCHEDULE;
|
||||
}
|
||||
|
||||
static int cmd_threadload(int argc, const cmd_args *argv) {
|
||||
static int cmd_threadload(int argc, const console_cmd_args *argv) {
|
||||
static bool showthreadload = false;
|
||||
static timer_t tltimer;
|
||||
|
||||
@@ -201,7 +201,7 @@ void kernel_evlog_dump(void) {
|
||||
kernel_evlog_enable = true;
|
||||
}
|
||||
|
||||
static int cmd_kevlog(int argc, const cmd_args *argv) {
|
||||
static int cmd_kevlog(int argc, const console_cmd_args *argv) {
|
||||
printf("kernel event log:\n");
|
||||
kernel_evlog_dump();
|
||||
|
||||
|
||||
@@ -251,14 +251,14 @@ status_t novm_alloc_specific_pages(void *address, size_t pages) {
|
||||
|
||||
#if LK_DEBUGLEVEL > 1
|
||||
|
||||
static int cmd_novm(int argc, const cmd_args *argv);
|
||||
static int cmd_novm(int argc, const console_cmd_args *argv);
|
||||
static void novm_dump(void);
|
||||
|
||||
STATIC_COMMAND_START
|
||||
STATIC_COMMAND("novm", "page allocator (for devices without VM support) debug commands", &cmd_novm)
|
||||
STATIC_COMMAND_END(novm);
|
||||
|
||||
static int cmd_novm(int argc, const cmd_args *argv) {
|
||||
static int cmd_novm(int argc, const console_cmd_args *argv) {
|
||||
if (argc < 2) {
|
||||
notenoughargs:
|
||||
printf("not enough arguments\n");
|
||||
|
||||
@@ -396,7 +396,7 @@ static void dump_arena(const pmm_arena_t *arena, bool dump_pages) {
|
||||
}
|
||||
}
|
||||
|
||||
static int cmd_pmm(int argc, const cmd_args *argv) {
|
||||
static int cmd_pmm(int argc, const console_cmd_args *argv) {
|
||||
if (argc < 2) {
|
||||
notenoughargs:
|
||||
printf("not enough arguments\n");
|
||||
|
||||
@@ -129,7 +129,7 @@ vmm_aspace_t *vaddr_to_aspace(void *ptr) {
|
||||
}
|
||||
}
|
||||
|
||||
static int cmd_vm(int argc, const cmd_args *argv) {
|
||||
static int cmd_vm(int argc, const console_cmd_args *argv) {
|
||||
if (argc < 2) {
|
||||
notenoughargs:
|
||||
printf("not enough arguments\n");
|
||||
|
||||
@@ -712,7 +712,7 @@ static void dump_aspace(const vmm_aspace_t *a) {
|
||||
}
|
||||
}
|
||||
|
||||
static int cmd_vmm(int argc, const cmd_args *argv) {
|
||||
static int cmd_vmm(int argc, const console_cmd_args *argv) {
|
||||
if (argc < 2) {
|
||||
notenoughargs:
|
||||
printf("not enough arguments\n");
|
||||
|
||||
@@ -28,14 +28,14 @@
|
||||
#define SUB_ERASE_TEST_SAMPLES (32)
|
||||
|
||||
#if LK_DEBUGLEVEL > 0
|
||||
static int cmd_bio(int argc, const cmd_args *argv);
|
||||
static int cmd_bio(int argc, const console_cmd_args *argv);
|
||||
static int bio_test_device(bdev_t *device);
|
||||
|
||||
STATIC_COMMAND_START
|
||||
STATIC_COMMAND("bio", "block io debug commands", &cmd_bio)
|
||||
STATIC_COMMAND_END(bio);
|
||||
|
||||
static int cmd_bio(int argc, const cmd_args *argv) {
|
||||
static int cmd_bio(int argc, const console_cmd_args *argv) {
|
||||
int rc = 0;
|
||||
|
||||
if (argc < 2) {
|
||||
|
||||
@@ -98,7 +98,7 @@ status_t buildsig_search(const void *_ptr, size_t search_len, size_t max_len, co
|
||||
|
||||
extern char __rom_start;
|
||||
|
||||
static int cmd_buildsig(int argc, const cmd_args *argv) {
|
||||
static int cmd_buildsig(int argc, const console_cmd_args *argv) {
|
||||
if (argc < 2) {
|
||||
//notenoughargs:
|
||||
printf("not enough args\n");
|
||||
|
||||
@@ -69,18 +69,18 @@ static void dump_history(void);
|
||||
/* a linear array of statically defined command blocks,
|
||||
defined in the linker script.
|
||||
*/
|
||||
extern const cmd_block __start_commands __WEAK;
|
||||
extern const cmd_block __stop_commands __WEAK;
|
||||
extern const console_cmd_block __start_commands __WEAK;
|
||||
extern const console_cmd_block __stop_commands __WEAK;
|
||||
|
||||
static int cmd_help(int argc, const cmd_args *argv);
|
||||
static int cmd_help_panic(int argc, const cmd_args *argv);
|
||||
static int cmd_echo(int argc, const cmd_args *argv);
|
||||
static int cmd_test(int argc, const cmd_args *argv);
|
||||
static int cmd_help(int argc, const console_cmd_args *argv);
|
||||
static int cmd_help_panic(int argc, const console_cmd_args *argv);
|
||||
static int cmd_echo(int argc, const console_cmd_args *argv);
|
||||
static int cmd_test(int argc, const console_cmd_args *argv);
|
||||
#if CONSOLE_ENABLE_HISTORY
|
||||
static int cmd_history(int argc, const cmd_args *argv);
|
||||
static int cmd_history(int argc, const console_cmd_args *argv);
|
||||
#endif
|
||||
#if CONSOLE_ENABLE_REPEAT
|
||||
static int cmd_repeat(int argc, const cmd_args *argv);
|
||||
static int cmd_repeat(int argc, const console_cmd_args *argv);
|
||||
#endif
|
||||
|
||||
STATIC_COMMAND_START
|
||||
@@ -99,7 +99,7 @@ STATIC_COMMAND("repeat", "repeats command multiple times", &cmd_repeat)
|
||||
STATIC_COMMAND_END(help);
|
||||
|
||||
#if CONSOLE_ENABLE_HISTORY
|
||||
static int cmd_history(int argc, const cmd_args *argv) {
|
||||
static int cmd_history(int argc, const console_cmd_args *argv) {
|
||||
dump_history();
|
||||
return 0;
|
||||
}
|
||||
@@ -176,7 +176,7 @@ static const char *prev_history(uint *cursor) {
|
||||
#endif // CONSOLE_ENABLE_HISTORY
|
||||
|
||||
#if CONSOLE_ENABLE_REPEAT
|
||||
static int cmd_repeat(int argc, const cmd_args *argv) {
|
||||
static int cmd_repeat(int argc, const console_cmd_args *argv) {
|
||||
if (argc < 4) goto usage;
|
||||
int times = argv[1].i;
|
||||
int delay = argv[2].i;
|
||||
@@ -219,9 +219,9 @@ usage:
|
||||
}
|
||||
#endif // CONSOLE_ENABLE_REPEAT
|
||||
|
||||
static const cmd *match_command(const char *command, const uint8_t availability_mask) {
|
||||
for (const cmd_block *block = &__start_commands; block != &__stop_commands; block++) {
|
||||
const cmd *curr_cmd = block->list;
|
||||
static const console_cmd *match_command(const char *command, const uint8_t availability_mask) {
|
||||
for (const console_cmd_block *block = &__start_commands; block != &__stop_commands; block++) {
|
||||
const console_cmd *curr_cmd = block->list;
|
||||
for (size_t i = 0; i < block->count; i++) {
|
||||
if ((availability_mask & curr_cmd[i].availability_mask) == 0) {
|
||||
continue;
|
||||
@@ -351,7 +351,7 @@ done:
|
||||
return pos;
|
||||
}
|
||||
|
||||
static int tokenize_command(const char *inbuffer, const char **continuebuffer, char *buffer, size_t buflen, cmd_args *args, int arg_count) {
|
||||
static int tokenize_command(const char *inbuffer, const char **continuebuffer, char *buffer, size_t buflen, console_cmd_args *args, int arg_count) {
|
||||
int inpos;
|
||||
int outpos;
|
||||
int arg;
|
||||
@@ -523,7 +523,7 @@ done:
|
||||
return arg;
|
||||
}
|
||||
|
||||
static void convert_args(int argc, cmd_args *argv) {
|
||||
static void convert_args(int argc, console_cmd_args *argv) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < argc; i++) {
|
||||
@@ -548,12 +548,12 @@ static status_t command_loop(int (*get_line)(const char **, void *), void *get_l
|
||||
#if WITH_LIB_ENV
|
||||
bool report_result;
|
||||
#endif
|
||||
cmd_args *args = NULL;
|
||||
console_cmd_args *args = NULL;
|
||||
const char *buffer;
|
||||
const char *continuebuffer;
|
||||
char *outbuf = NULL;
|
||||
|
||||
args = (cmd_args *) malloc (MAX_NUM_ARGS * sizeof(cmd_args));
|
||||
args = (console_cmd_args *) malloc (MAX_NUM_ARGS * sizeof(console_cmd_args));
|
||||
if (unlikely(args == NULL)) {
|
||||
goto no_mem_error;
|
||||
}
|
||||
@@ -602,7 +602,7 @@ static status_t command_loop(int (*get_line)(const char **, void *), void *get_l
|
||||
convert_args(argc, args);
|
||||
|
||||
/* try to match the command */
|
||||
const cmd *command = match_command(args[0].str, CMD_AVAIL_NORMAL);
|
||||
const console_cmd *command = match_command(args[0].str, CMD_AVAIL_NORMAL);
|
||||
if (!command) {
|
||||
if (showprompt)
|
||||
printf("command not found\n");
|
||||
@@ -729,8 +729,8 @@ int console_run_script_locked(const char *string) {
|
||||
return console_run_script_etc(string, true);
|
||||
}
|
||||
|
||||
console_cmd console_get_command_handler(const char *commandstr) {
|
||||
const cmd *command = match_command(commandstr, CMD_AVAIL_NORMAL);
|
||||
console_cmd_func console_get_command_handler(const char *commandstr) {
|
||||
const console_cmd *command = match_command(commandstr, CMD_AVAIL_NORMAL);
|
||||
|
||||
if (command)
|
||||
return command->cmd_callback;
|
||||
@@ -741,8 +741,8 @@ console_cmd console_get_command_handler(const char *commandstr) {
|
||||
static int cmd_help_impl(uint8_t availability_mask) {
|
||||
printf("command list by block:\n");
|
||||
|
||||
for (const cmd_block *block = &__start_commands; block != &__stop_commands; block++) {
|
||||
const cmd *curr_cmd = block->list;
|
||||
for (const console_cmd_block *block = &__start_commands; block != &__stop_commands; block++) {
|
||||
const console_cmd *curr_cmd = block->list;
|
||||
printf(" [%s]\n", block->name);
|
||||
for (size_t i = 0; i < block->count; i++) {
|
||||
if ((availability_mask & curr_cmd[i].availability_mask) == 0) {
|
||||
@@ -757,15 +757,15 @@ static int cmd_help_impl(uint8_t availability_mask) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmd_help(int argc, const cmd_args *argv) {
|
||||
static int cmd_help(int argc, const console_cmd_args *argv) {
|
||||
return cmd_help_impl(CMD_AVAIL_NORMAL);
|
||||
}
|
||||
|
||||
static int cmd_help_panic(int argc, const cmd_args *argv) {
|
||||
static int cmd_help_panic(int argc, const console_cmd_args *argv) {
|
||||
return cmd_help_impl(CMD_AVAIL_PANIC);
|
||||
}
|
||||
|
||||
static int cmd_echo(int argc, const cmd_args *argv) {
|
||||
static int cmd_echo(int argc, const console_cmd_args *argv) {
|
||||
if (argc > 1)
|
||||
echo = argv[1].b;
|
||||
return NO_ERROR;
|
||||
@@ -809,7 +809,7 @@ done:
|
||||
void panic_shell_start(void) {
|
||||
dprintf(INFO, "entering panic shell loop\n");
|
||||
char input_buffer[PANIC_LINE_LEN];
|
||||
cmd_args args[MAX_NUM_ARGS];
|
||||
console_cmd_args args[MAX_NUM_ARGS];
|
||||
|
||||
// panic_fd allows us to do I/O using the polling drivers.
|
||||
// These drivers function even if interrupts are disabled.
|
||||
@@ -837,7 +837,7 @@ void panic_shell_start(void) {
|
||||
|
||||
convert_args(argc, args);
|
||||
|
||||
const cmd *command = match_command(args[0].str, CMD_AVAIL_PANIC);
|
||||
const console_cmd *command = match_command(args[0].str, CMD_AVAIL_PANIC);
|
||||
if (!command) {
|
||||
fputs("command not found\n", panic_fd);
|
||||
continue;
|
||||
@@ -848,7 +848,7 @@ void panic_shell_start(void) {
|
||||
}
|
||||
|
||||
#if LK_DEBUGLEVEL > 1
|
||||
static int cmd_test(int argc, const cmd_args *argv) {
|
||||
static int cmd_test(int argc, const console_cmd_args *argv) {
|
||||
int i;
|
||||
|
||||
printf("argc %d, argv %p\n", argc, argv);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
void console_start(void);
|
||||
int console_run_script(const char *string);
|
||||
int console_run_script_locked(const char *string); // special case from inside a command
|
||||
console_cmd console_get_command_handler(const char *command);
|
||||
console_cmd_func console_get_command_handler(const char *command);
|
||||
void console_abort_script(void);
|
||||
|
||||
/* panic shell api */
|
||||
|
||||
@@ -20,27 +20,27 @@
|
||||
typedef struct {
|
||||
const char *cmd_str;
|
||||
const char *help_str;
|
||||
const console_cmd cmd_callback;
|
||||
const console_cmd_func cmd_callback;
|
||||
uint8_t availability_mask;
|
||||
} cmd;
|
||||
} console_cmd;
|
||||
|
||||
/* a block of commands to register */
|
||||
typedef struct _cmd_block {
|
||||
const char *name;
|
||||
size_t count;
|
||||
const cmd *list;
|
||||
} cmd_block;
|
||||
const console_cmd *list;
|
||||
} console_cmd_block;
|
||||
|
||||
#define STATIC_COMMAND_START static const cmd _cmd_list[] = {
|
||||
#define STATIC_COMMAND_START static const console_cmd _cmd_list[] = {
|
||||
|
||||
#define STATIC_COMMAND_END(name) }; const cmd_block _cmd_block_##name \
|
||||
#define STATIC_COMMAND_END(name) }; const console_cmd_block _cmd_block_##name \
|
||||
__ALIGNED(sizeof(void *)) __SECTION("commands") = \
|
||||
{ #name, sizeof(_cmd_list) / sizeof(_cmd_list[0]), _cmd_list }
|
||||
|
||||
/* same as above but with a suffixed name to make the list unique within the file */
|
||||
#define STATIC_COMMAND_START_NAMED(name) static const cmd _cmd_list_##name[] = {
|
||||
#define STATIC_COMMAND_START_NAMED(name) static const console_cmd _cmd_list_##name[] = {
|
||||
|
||||
#define STATIC_COMMAND_END_NAMED(name) }; const cmd_block _cmd_block_##name \
|
||||
#define STATIC_COMMAND_END_NAMED(name) }; const console_cmd_block _cmd_block_##name \
|
||||
__ALIGNED(sizeof(void *)) __SECTION("commands") = \
|
||||
{ #name, sizeof(_cmd_list_##name) / sizeof(_cmd_list_##name[0]), _cmd_list_##name }
|
||||
|
||||
|
||||
@@ -24,16 +24,16 @@
|
||||
#include <kernel/vm.h>
|
||||
#endif
|
||||
|
||||
static int cmd_display_mem(int argc, const cmd_args *argv);
|
||||
static int cmd_modify_mem(int argc, const cmd_args *argv);
|
||||
static int cmd_fill_mem(int argc, const cmd_args *argv);
|
||||
static int cmd_reset(int argc, const cmd_args *argv);
|
||||
static int cmd_memtest(int argc, const cmd_args *argv);
|
||||
static int cmd_copy_mem(int argc, const cmd_args *argv);
|
||||
static int cmd_chain(int argc, const cmd_args *argv);
|
||||
static int cmd_sleep(int argc, const cmd_args *argv);
|
||||
static int cmd_crash(int argc, const cmd_args *argv);
|
||||
static int cmd_stackstomp(int argc, const cmd_args *argv);
|
||||
static int cmd_display_mem(int argc, const console_cmd_args *argv);
|
||||
static int cmd_modify_mem(int argc, const console_cmd_args *argv);
|
||||
static int cmd_fill_mem(int argc, const console_cmd_args *argv);
|
||||
static int cmd_reset(int argc, const console_cmd_args *argv);
|
||||
static int cmd_memtest(int argc, const console_cmd_args *argv);
|
||||
static int cmd_copy_mem(int argc, const console_cmd_args *argv);
|
||||
static int cmd_chain(int argc, const console_cmd_args *argv);
|
||||
static int cmd_sleep(int argc, const console_cmd_args *argv);
|
||||
static int cmd_crash(int argc, const console_cmd_args *argv);
|
||||
static int cmd_stackstomp(int argc, const console_cmd_args *argv);
|
||||
|
||||
STATIC_COMMAND_START
|
||||
#if LK_DEBUGLEVEL > 0
|
||||
@@ -58,7 +58,7 @@ STATIC_COMMAND("sleep", "sleep number of seconds", &cmd_sleep)
|
||||
STATIC_COMMAND("sleepm", "sleep number of milliseconds", &cmd_sleep)
|
||||
STATIC_COMMAND_END(mem);
|
||||
|
||||
static int cmd_display_mem(int argc, const cmd_args *argv) {
|
||||
static int cmd_display_mem(int argc, const console_cmd_args *argv) {
|
||||
/* save the last address and len so we can continue where we left off */
|
||||
static unsigned long address;
|
||||
static size_t len;
|
||||
@@ -147,7 +147,7 @@ static int cmd_display_mem(int argc, const cmd_args *argv) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmd_modify_mem(int argc, const cmd_args *argv) {
|
||||
static int cmd_modify_mem(int argc, const console_cmd_args *argv) {
|
||||
int size;
|
||||
|
||||
if (argc < 3) {
|
||||
@@ -187,7 +187,7 @@ static int cmd_modify_mem(int argc, const cmd_args *argv) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmd_fill_mem(int argc, const cmd_args *argv) {
|
||||
static int cmd_fill_mem(int argc, const console_cmd_args *argv) {
|
||||
int size;
|
||||
|
||||
if (argc < 4) {
|
||||
@@ -231,7 +231,7 @@ static int cmd_fill_mem(int argc, const cmd_args *argv) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmd_copy_mem(int argc, const cmd_args *argv) {
|
||||
static int cmd_copy_mem(int argc, const console_cmd_args *argv) {
|
||||
if (argc < 4) {
|
||||
printf("not enough arguments\n");
|
||||
printf("%s <source address> <target address> <len>\n", argv[0].str);
|
||||
@@ -247,7 +247,7 @@ static int cmd_copy_mem(int argc, const cmd_args *argv) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmd_memtest(int argc, const cmd_args *argv) {
|
||||
static int cmd_memtest(int argc, const console_cmd_args *argv) {
|
||||
if (argc < 3) {
|
||||
printf("not enough arguments\n");
|
||||
printf("%s <base> <len>\n", argv[0].str);
|
||||
@@ -279,7 +279,7 @@ static int cmd_memtest(int argc, const cmd_args *argv) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmd_chain(int argc, const cmd_args *argv) {
|
||||
static int cmd_chain(int argc, const console_cmd_args *argv) {
|
||||
if (argc < 2) {
|
||||
printf("not enough arguments\n");
|
||||
printf("%s <address>\n", argv[0].str);
|
||||
@@ -291,7 +291,7 @@ static int cmd_chain(int argc, const cmd_args *argv) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmd_sleep(int argc, const cmd_args *argv) {
|
||||
static int cmd_sleep(int argc, const console_cmd_args *argv) {
|
||||
lk_time_t t = 1000; /* default to 1 second */
|
||||
|
||||
if (argc >= 2) {
|
||||
@@ -305,7 +305,7 @@ static int cmd_sleep(int argc, const cmd_args *argv) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmd_crash(int argc, const cmd_args *argv) {
|
||||
static int cmd_crash(int argc, const console_cmd_args *argv) {
|
||||
/* should crash */
|
||||
volatile uint32_t *ptr = (void *)1;
|
||||
*ptr = 1;
|
||||
@@ -316,7 +316,7 @@ static int cmd_crash(int argc, const cmd_args *argv) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmd_stackstomp(int argc, const cmd_args *argv) {
|
||||
static int cmd_stackstomp(int argc, const console_cmd_args *argv) {
|
||||
for (size_t i = 0; i < DEFAULT_STACK_SIZE * 2; i++) {
|
||||
uint8_t death[i];
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ test_normalize("/bleh/bar/../../foo/../meh");
|
||||
#endif
|
||||
|
||||
#if LK_DEBUGLEVEL > 1
|
||||
static int cmd_fs(int argc, const cmd_args *argv);
|
||||
static int cmd_fs(int argc, const console_cmd_args *argv);
|
||||
|
||||
STATIC_COMMAND_START
|
||||
STATIC_COMMAND("fs", "fs debug commands", &cmd_fs)
|
||||
@@ -60,7 +60,7 @@ STATIC_COMMAND_END(fs);
|
||||
|
||||
extern int fs_mount_type(const char *path, const char *device, const char *name);
|
||||
|
||||
static int cmd_fs_ioctl(int argc, const cmd_args *argv) {
|
||||
static int cmd_fs_ioctl(int argc, const console_cmd_args *argv) {
|
||||
if (argc < 3) {
|
||||
printf("not enough arguments\n");
|
||||
return ERR_INVALID_ARGS;
|
||||
@@ -135,7 +135,7 @@ static int cmd_fs_ioctl(int argc, const cmd_args *argv) {
|
||||
return ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
static int cmd_fs(int argc, const cmd_args *argv) {
|
||||
static int cmd_fs(int argc, const console_cmd_args *argv) {
|
||||
int rc = 0;
|
||||
|
||||
if (argc < 2) {
|
||||
|
||||
@@ -56,7 +56,7 @@ static char *prepend_cwd(char *path, size_t len, const char *arg) {
|
||||
return path;
|
||||
}
|
||||
|
||||
static int cmd_ls(int argc, const cmd_args *argv) {
|
||||
static int cmd_ls(int argc, const console_cmd_args *argv) {
|
||||
status_t status = NO_ERROR;
|
||||
|
||||
// construct the path
|
||||
@@ -110,7 +110,7 @@ err:
|
||||
return status;;
|
||||
}
|
||||
|
||||
static int cmd_cd(int argc, const cmd_args *argv) {
|
||||
static int cmd_cd(int argc, const console_cmd_args *argv) {
|
||||
if (argc < 2) {
|
||||
set_cwd(NULL);
|
||||
} else {
|
||||
@@ -130,13 +130,13 @@ static int cmd_cd(int argc, const cmd_args *argv) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmd_pwd(int argc, const cmd_args *argv) {
|
||||
static int cmd_pwd(int argc, const console_cmd_args *argv) {
|
||||
puts(get_cwd());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmd_mkdir(int argc, const cmd_args *argv) {
|
||||
static int cmd_mkdir(int argc, const console_cmd_args *argv) {
|
||||
if (argc < 2) {
|
||||
printf("not enough arguments\n");
|
||||
printf("usage: %s <path>\n", argv[0].str);
|
||||
@@ -154,7 +154,7 @@ static int cmd_mkdir(int argc, const cmd_args *argv) {
|
||||
return status;
|
||||
}
|
||||
|
||||
static int cmd_mkfile(int argc, const cmd_args *argv) {
|
||||
static int cmd_mkfile(int argc, const console_cmd_args *argv) {
|
||||
if (argc < 2) {
|
||||
printf("not enough arguments\n");
|
||||
printf("usage: %s <path> [length]\n", argv[0].str);
|
||||
@@ -178,7 +178,7 @@ err:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int cmd_rm(int argc, const cmd_args *argv) {
|
||||
static int cmd_rm(int argc, const console_cmd_args *argv) {
|
||||
if (argc < 2) {
|
||||
printf("not enough arguments\n");
|
||||
printf("usage: %s <path>\n", argv[0].str);
|
||||
@@ -197,7 +197,7 @@ static int cmd_rm(int argc, const cmd_args *argv) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmd_stat(int argc, const cmd_args *argv) {
|
||||
static int cmd_stat(int argc, const console_cmd_args *argv) {
|
||||
if (argc < 2) {
|
||||
printf("not enough arguments\n");
|
||||
printf("usage: %s <path>\n", argv[0].str);
|
||||
@@ -236,7 +236,7 @@ err:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int cmd_cat(int argc, const cmd_args *argv) {
|
||||
static int cmd_cat(int argc, const console_cmd_args *argv) {
|
||||
status_t status = NO_ERROR;
|
||||
|
||||
if (argc < 2) {
|
||||
|
||||
@@ -629,7 +629,7 @@ static bool test_truncate_file(const char *dev_name) {
|
||||
}
|
||||
|
||||
// Run the SPIFS test suite.
|
||||
static int spifs_test(int argc, const cmd_args *argv) {
|
||||
static int spifs_test(int argc, const console_cmd_args *argv) {
|
||||
if (argc != 3) {
|
||||
printf("Expected 3 arguments, got %d.\n", argc);
|
||||
return -1;
|
||||
@@ -674,7 +674,7 @@ static int spifs_test(int argc, const cmd_args *argv) {
|
||||
}
|
||||
|
||||
// Benchmark SPIFS.
|
||||
static int spifs_bench(int argc, const cmd_args *argv) {
|
||||
static int spifs_bench(int argc, const console_cmd_args *argv) {
|
||||
if (argc != 3) {
|
||||
printf("Expected 3 arguments, got %d.\n", argc);
|
||||
return -1;
|
||||
@@ -785,7 +785,7 @@ finish:
|
||||
return retcode;
|
||||
}
|
||||
|
||||
static int cmd_spifs(int argc, const cmd_args *argv) {
|
||||
static int cmd_spifs(int argc, const console_cmd_args *argv) {
|
||||
if (argc < 3) {
|
||||
printf("not enough arguments:\n");
|
||||
usage:
|
||||
|
||||
@@ -721,7 +721,7 @@ void gfx_draw_pattern_white(void) {
|
||||
|
||||
#if LK_DEBUGLEVEL > 1
|
||||
|
||||
static int cmd_gfx(int argc, const cmd_args *argv);
|
||||
static int cmd_gfx(int argc, const console_cmd_args *argv);
|
||||
|
||||
STATIC_COMMAND_START
|
||||
STATIC_COMMAND("gfx", "gfx commands", &cmd_gfx)
|
||||
@@ -795,7 +795,7 @@ static int gfx_draw_rgb_bars(gfx_surface *surface) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmd_gfx(int argc, const cmd_args *argv) {
|
||||
static int cmd_gfx(int argc, const console_cmd_args *argv) {
|
||||
if (argc < 2) {
|
||||
printf("not enough arguments:\n");
|
||||
usage:
|
||||
|
||||
@@ -298,13 +298,13 @@ static void heap_test(void) {
|
||||
|
||||
#if LK_DEBUGLEVEL > 1
|
||||
|
||||
static int cmd_heap(int argc, const cmd_args *argv);
|
||||
static int cmd_heap(int argc, const console_cmd_args *argv);
|
||||
|
||||
STATIC_COMMAND_START
|
||||
STATIC_COMMAND("heap", "heap debug commands", &cmd_heap)
|
||||
STATIC_COMMAND_END(heap);
|
||||
|
||||
static int cmd_heap(int argc, const cmd_args *argv) {
|
||||
static int cmd_heap(int argc, const console_cmd_args *argv) {
|
||||
if (argc < 2) {
|
||||
notenoughargs:
|
||||
printf("not enough arguments\n");
|
||||
|
||||
@@ -76,14 +76,14 @@ void *page_first_alloc(size_t *size_return) {
|
||||
|
||||
#if LK_DEBUGLEVEL > 1
|
||||
|
||||
static int cmd_page_alloc(int argc, const cmd_args *argv);
|
||||
static int cmd_page_alloc(int argc, const console_cmd_args *argv);
|
||||
static void page_alloc_dump(void);
|
||||
|
||||
STATIC_COMMAND_START
|
||||
STATIC_COMMAND("page_alloc", "page allocator debug commands", &cmd_page_alloc)
|
||||
STATIC_COMMAND_END(page_alloc);
|
||||
|
||||
static int cmd_page_alloc(int argc, const cmd_args *argv) {
|
||||
static int cmd_page_alloc(int argc, const console_cmd_args *argv) {
|
||||
if (argc != 2) {
|
||||
notenoughargs:
|
||||
printf("not enough arguments\n");
|
||||
|
||||
@@ -448,7 +448,7 @@ void klog_dump(int buffer) {
|
||||
_RETENTION_NOCLEAR(static uint8_t klog_test_buf[512]);
|
||||
#endif
|
||||
|
||||
static int cmd_klog(int argc, const cmd_args *argv) {
|
||||
static int cmd_klog(int argc, const console_cmd_args *argv) {
|
||||
status_t err;
|
||||
|
||||
if (argc < 2) {
|
||||
|
||||
@@ -40,7 +40,7 @@ void arp_usage(void) {
|
||||
printf("arp query <ipv4 address> query arp address\n");
|
||||
}
|
||||
|
||||
static int cmd_arp(int argc, const cmd_args *argv) {
|
||||
static int cmd_arp(int argc, const console_cmd_args *argv) {
|
||||
const char *cmd;
|
||||
|
||||
if (argc == 1) {
|
||||
@@ -63,7 +63,7 @@ static int cmd_arp(int argc, const cmd_args *argv) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmd_minip(int argc, const cmd_args *argv) {
|
||||
static int cmd_minip(int argc, const console_cmd_args *argv) {
|
||||
if (argc == 1) {
|
||||
minip_usage:
|
||||
printf("minip commands\n");
|
||||
|
||||
@@ -1177,7 +1177,7 @@ out:
|
||||
}
|
||||
|
||||
/* debug stuff */
|
||||
static int cmd_tcp(int argc, const cmd_args *argv) {
|
||||
static int cmd_tcp(int argc, const console_cmd_args *argv) {
|
||||
status_t err;
|
||||
|
||||
if (argc < 2) {
|
||||
|
||||
@@ -817,7 +817,7 @@ void ptable_dump(void) {
|
||||
}
|
||||
}
|
||||
|
||||
static int cmd_ptable(int argc, const cmd_args *argv) {
|
||||
static int cmd_ptable(int argc, const console_cmd_args *argv) {
|
||||
if (argc < 2) {
|
||||
notenoughargs:
|
||||
printf("not enough arguments\n");
|
||||
|
||||
@@ -498,7 +498,7 @@ static ssize_t hexstr_to_val(const char *str, uint8_t **buf) {
|
||||
return pos;
|
||||
}
|
||||
|
||||
static int cmd_sysparam(int argc, const cmd_args *argv) {
|
||||
static int cmd_sysparam(int argc, const console_cmd_args *argv) {
|
||||
status_t err;
|
||||
|
||||
if (argc < 2) {
|
||||
|
||||
@@ -72,7 +72,7 @@ bool run_all_tests(void) {
|
||||
return all_success;
|
||||
}
|
||||
|
||||
static int do_unittests(int argc, const cmd_args *argv) {
|
||||
static int do_unittests(int argc, const console_cmd_args *argv) {
|
||||
bool result = run_all_tests();
|
||||
|
||||
printf("run_all_tests returned %d\n", result);
|
||||
|
||||
@@ -40,7 +40,7 @@ void print_version(void) {
|
||||
printf("\tbuildid: %s\n", version.buildid);
|
||||
}
|
||||
|
||||
static int cmd_version(int argc, const cmd_args *argv) {
|
||||
static int cmd_version(int argc, const console_cmd_args *argv) {
|
||||
print_version();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -38,12 +38,12 @@ __WEAK void platform_halt(platform_halt_action suggested_action,
|
||||
arch_idle();
|
||||
}
|
||||
|
||||
static int cmd_reboot(int argc, const cmd_args *argv) {
|
||||
static int cmd_reboot(int argc, const console_cmd_args *argv) {
|
||||
platform_halt(HALT_ACTION_REBOOT, HALT_REASON_SW_RESET);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmd_poweroff(int argc, const cmd_args *argv) {
|
||||
static int cmd_poweroff(int argc, const console_cmd_args *argv) {
|
||||
platform_halt(HALT_ACTION_SHUTDOWN, HALT_REASON_SW_RESET);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -531,7 +531,7 @@ void gem_set_macaddr(uint8_t mac[6]) {
|
||||
|
||||
|
||||
/* Debug console commands */
|
||||
static int cmd_gem(int argc, const cmd_args *argv) {
|
||||
static int cmd_gem(int argc, const console_cmd_args *argv) {
|
||||
static uint32_t frames_rx = 0;
|
||||
static uint32_t frames_tx = 0;
|
||||
static bool run_stats = false;
|
||||
|
||||
@@ -233,7 +233,7 @@ int gpio_get(unsigned gpio) {
|
||||
return ((*REG32(GPIO_DATA_RO(bank)) & (1 << bit)) > 0);
|
||||
}
|
||||
|
||||
static int cmd_zynq_gpio(int argc, const cmd_args *argv) {
|
||||
static int cmd_zynq_gpio(int argc, const console_cmd_args *argv) {
|
||||
for (unsigned int bank = 0; bank < 4; bank++) {
|
||||
printf("DIRM_%u (0x%08x): 0x%08x\n", bank, GPIO_DIRM(bank), *REG32(GPIO_DIRM(bank)));
|
||||
printf("OEN_%u (0x%08x): 0x%08x\n", bank, GPIO_OEN(bank), *REG32(GPIO_OEN(bank)));
|
||||
|
||||
@@ -457,7 +457,7 @@ bool platform_abort_autoboot(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static int cmd_zynq(int argc, const cmd_args *argv) {
|
||||
static int cmd_zynq(int argc, const console_cmd_args *argv) {
|
||||
if (argc < 2) {
|
||||
notenoughargs:
|
||||
printf("not enough arguments\n");
|
||||
|
||||
@@ -409,7 +409,7 @@ static int spiflash_ioctl(struct bdev *bdev, int request, void *argp) {
|
||||
}
|
||||
|
||||
// debug tests
|
||||
int cmd_spiflash(int argc, const cmd_args *argv) {
|
||||
int cmd_spiflash(int argc, const console_cmd_args *argv) {
|
||||
if (argc < 2) {
|
||||
notenoughargs:
|
||||
printf("not enough arguments\n");
|
||||
|
||||
@@ -52,7 +52,7 @@ void target_set_debug_led(unsigned int led, bool on) {
|
||||
}
|
||||
}
|
||||
|
||||
static int cmd_i2c_rb(int argc, const cmd_args *argv) {
|
||||
static int cmd_i2c_rb(int argc, const console_cmd_args *argv) {
|
||||
|
||||
if (argc != 3) {
|
||||
printf("usage: i2c_rb <addr> <reg>\n");
|
||||
|
||||
@@ -19,9 +19,9 @@ typedef struct {
|
||||
void *p;
|
||||
long i;
|
||||
bool b;
|
||||
} cmd_args;
|
||||
} console_cmd_args;
|
||||
|
||||
typedef int (*console_cmd)(int argc, const cmd_args *argv);
|
||||
typedef int (*console_cmd_func)(int argc, const console_cmd_args *argv);
|
||||
|
||||
#define CMD_AVAIL_NORMAL (0x1 << 0)
|
||||
#define CMD_AVAIL_PANIC (0x1 << 1)
|
||||
|
||||
Reference in New Issue
Block a user