X-Git-Url: http://git.droids-corp.org/?p=protos%2Fxbee-avr.git;a=blobdiff_plain;f=commands_gen.c;h=2c1a11d33260fe4a8945d90ba9cab66d4c023240;hp=1dbb749f6740a95c5758c133fadc828fdc61627d;hb=21d10011bc4b009d7a09131b955953fa7aba3815;hpb=d6014994e06ebe952d51bef2e36a795f624c4b4d diff --git a/commands_gen.c b/commands_gen.c index 1dbb749..2c1a11d 100644 --- a/commands_gen.c +++ b/commands_gen.c @@ -56,22 +56,24 @@ struct cmd_reset_result { /* function called when cmd_reset is parsed successfully */ static void cmd_reset_parsed(void * parsed_result, void * data) { + (void)parsed_result; + (void)data; #ifdef HOST_VERSION hostsim_exit(); #endif reset(); } -prog_char str_reset_arg0[] = "reset"; -parse_pgm_token_string_t cmd_reset_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_reset_result, arg0, str_reset_arg0); +const char PROGMEM str_reset_arg0[] = "reset"; +const parse_token_string_t PROGMEM cmd_reset_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_reset_result, arg0, str_reset_arg0); -prog_char help_reset[] = "Reset the board"; -parse_pgm_inst_t cmd_reset = { +const char PROGMEM help_reset[] = "Reset the board"; +const parse_inst_t PROGMEM cmd_reset = { .f = cmd_reset_parsed, /* function to call */ .data = NULL, /* 2nd arg of func */ .help_str = help_reset, .tokens = { /* token list, NULL terminated */ - (prog_void *)&cmd_reset_arg0, + (PGM_P)&cmd_reset_arg0, NULL, }, }; @@ -87,6 +89,8 @@ struct cmd_bootloader_result { /* function called when cmd_bootloader is parsed successfully */ static void cmd_bootloader_parsed(void *parsed_result, void *data) { + (void)parsed_result; + (void)data; #ifndef HOST_VERSION bootloader(); #else @@ -94,16 +98,16 @@ static void cmd_bootloader_parsed(void *parsed_result, void *data) #endif } -prog_char str_bootloader_arg0[] = "bootloader"; -parse_pgm_token_string_t cmd_bootloader_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_bootloader_result, arg0, str_bootloader_arg0); +const char PROGMEM str_bootloader_arg0[] = "bootloader"; +const parse_token_string_t PROGMEM cmd_bootloader_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_bootloader_result, arg0, str_bootloader_arg0); -prog_char help_bootloader[] = "Launch the bootloader"; -parse_pgm_inst_t cmd_bootloader = { +const char PROGMEM help_bootloader[] = "Launch the bootloader"; +const parse_inst_t PROGMEM cmd_bootloader = { .f = cmd_bootloader_parsed, /* function to call */ .data = NULL, /* 2nd arg of func */ .help_str = help_bootloader, .tokens = { /* token list, NULL terminated */ - (prog_void *)&cmd_bootloader_arg0, + (PGM_P)&cmd_bootloader_arg0, NULL, }, }; @@ -120,23 +124,25 @@ struct cmd_scheduler_result { /* function called when cmd_scheduler is parsed successfully */ static void cmd_scheduler_parsed(void *parsed_result, void *data) { + (void)parsed_result; + (void)data; scheduler_dump_events(); scheduler_stats_dump(); } -prog_char str_scheduler_arg0[] = "scheduler"; -parse_pgm_token_string_t cmd_scheduler_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_scheduler_result, arg0, str_scheduler_arg0); -prog_char str_scheduler_arg1[] = "show"; -parse_pgm_token_string_t cmd_scheduler_arg1 = TOKEN_STRING_INITIALIZER(struct cmd_scheduler_result, arg1, str_scheduler_arg1); +const char PROGMEM str_scheduler_arg0[] = "scheduler"; +const parse_token_string_t PROGMEM cmd_scheduler_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_scheduler_result, arg0, str_scheduler_arg0); +const char PROGMEM str_scheduler_arg1[] = "show"; +const parse_token_string_t PROGMEM cmd_scheduler_arg1 = TOKEN_STRING_INITIALIZER(struct cmd_scheduler_result, arg1, str_scheduler_arg1); -prog_char help_scheduler[] = "Show scheduler events"; -parse_pgm_inst_t cmd_scheduler = { +const char PROGMEM help_scheduler[] = "Show scheduler events"; +const parse_inst_t PROGMEM cmd_scheduler = { .f = cmd_scheduler_parsed, /* function to call */ .data = NULL, /* 2nd arg of func */ .help_str = help_scheduler, .tokens = { /* token list, NULL terminated */ - (prog_void *)&cmd_scheduler_arg0, - (prog_void *)&cmd_scheduler_arg1, + (PGM_P)&cmd_scheduler_arg0, + (PGM_P)&cmd_scheduler_arg1, NULL, }, }; @@ -153,12 +159,12 @@ struct cmd_log_result { }; /* keep it sync with string choice */ -static const prog_char uart_log[] = "uart"; -static const prog_char i2c_log[] = "i2c"; -static const prog_char default_log[] = "default"; +static const char PROGMEM uart_log[] = "uart"; +static const char PROGMEM i2c_log[] = "i2c"; +static const char PROGMEM default_log[] = "default"; struct log_name_and_num { - const prog_char * name; + const char *name; uint8_t num; }; @@ -181,7 +187,7 @@ log_name2num(const char * s) return 0; } -const prog_char * +const char * log_num2name(uint8_t num) { uint8_t i; @@ -198,7 +204,7 @@ log_num2name(uint8_t num) static void cmd_log_do_show(void) { uint8_t i, empty=1; - const prog_char * name; + const char *name; printf_P(PSTR("log level is %d\r\n"), xbeeboard.log_level); for (i=0; iarg1, PSTR("level"))) { xbeeboard.log_level = res->arg2; } @@ -229,36 +236,36 @@ static void cmd_log_parsed(void * parsed_result, void * data) cmd_log_do_show(); } -prog_char str_log_arg0[] = "log"; -parse_pgm_token_string_t cmd_log_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_log_result, arg0, str_log_arg0); -prog_char str_log_arg1[] = "level"; -parse_pgm_token_string_t cmd_log_arg1 = TOKEN_STRING_INITIALIZER(struct cmd_log_result, arg1, str_log_arg1); -parse_pgm_token_num_t cmd_log_arg2 = TOKEN_NUM_INITIALIZER(struct cmd_log_result, arg2, INT8); +const char PROGMEM str_log_arg0[] = "log"; +const parse_token_string_t PROGMEM cmd_log_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_log_result, arg0, str_log_arg0); +const char PROGMEM str_log_arg1[] = "level"; +const parse_token_string_t PROGMEM cmd_log_arg1 = TOKEN_STRING_INITIALIZER(struct cmd_log_result, arg1, str_log_arg1); +const parse_token_num_t PROGMEM cmd_log_arg2 = TOKEN_NUM_INITIALIZER(struct cmd_log_result, arg2, INT8); -prog_char help_log[] = "Set log options: level (0 -> 5)"; -parse_pgm_inst_t cmd_log = { +const char PROGMEM help_log[] = "Set log options: level (0 -> 5)"; +const parse_inst_t PROGMEM cmd_log = { .f = cmd_log_parsed, /* function to call */ .data = NULL, /* 2nd arg of func */ .help_str = help_log, .tokens = { /* token list, NULL terminated */ - (prog_void *)&cmd_log_arg0, - (prog_void *)&cmd_log_arg1, - (prog_void *)&cmd_log_arg2, + (PGM_P)&cmd_log_arg0, + (PGM_P)&cmd_log_arg1, + (PGM_P)&cmd_log_arg2, NULL, }, }; -prog_char str_log_arg1_show[] = "show"; -parse_pgm_token_string_t cmd_log_arg1_show = TOKEN_STRING_INITIALIZER(struct cmd_log_result, arg1, str_log_arg1_show); +const char PROGMEM str_log_arg1_show[] = "show"; +const parse_token_string_t PROGMEM cmd_log_arg1_show = TOKEN_STRING_INITIALIZER(struct cmd_log_result, arg1, str_log_arg1_show); -prog_char help_log_show[] = "Show configured logs"; -parse_pgm_inst_t cmd_log_show = { +const char PROGMEM help_log_show[] = "Show configured logs"; +const parse_inst_t PROGMEM cmd_log_show = { .f = cmd_log_parsed, /* function to call */ .data = NULL, /* 2nd arg of func */ .help_str = help_log_show, .tokens = { /* token list, NULL terminated */ - (prog_void *)&cmd_log_arg0, - (prog_void *)&cmd_log_arg1_show, + (PGM_P)&cmd_log_arg0, + (PGM_P)&cmd_log_arg1_show, NULL, }, }; @@ -272,12 +279,14 @@ struct cmd_log_type_result { }; /* function called when cmd_log is parsed successfully */ -static void cmd_log_type_parsed(void * parsed_result, void * data) +static void cmd_log_type_parsed(void * parsed_result, void *data) { struct cmd_log_type_result *res = (struct cmd_log_type_result *) parsed_result; uint8_t lognum; uint8_t i; - + + (void)data; + lognum = log_name2num(res->arg2); if (lognum == 0) { printf_P(PSTR("Cannot find log num\r\n")); @@ -315,24 +324,24 @@ static void cmd_log_type_parsed(void * parsed_result, void * data) cmd_log_do_show(); } -prog_char str_log_arg1_type[] = "type"; -parse_pgm_token_string_t cmd_log_arg1_type = TOKEN_STRING_INITIALIZER(struct cmd_log_type_result, arg1, str_log_arg1_type); +const char PROGMEM str_log_arg1_type[] = "type"; +const parse_token_string_t PROGMEM cmd_log_arg1_type = TOKEN_STRING_INITIALIZER(struct cmd_log_type_result, arg1, str_log_arg1_type); /* keep it sync with log_name_and_num above */ -prog_char str_log_arg2_type[] = "uart#rs#servo#traj#i2c#oa#strat#i2cproto#ext#sensor#bd#cs"; -parse_pgm_token_string_t cmd_log_arg2_type = TOKEN_STRING_INITIALIZER(struct cmd_log_type_result, arg2, str_log_arg2_type); -prog_char str_log_arg3[] = "on#off"; -parse_pgm_token_string_t cmd_log_arg3 = TOKEN_STRING_INITIALIZER(struct cmd_log_type_result, arg3, str_log_arg3); +const char PROGMEM str_log_arg2_type[] = "uart#rs#servo#traj#i2c#oa#strat#i2cproto#ext#sensor#bd#cs"; +const parse_token_string_t PROGMEM cmd_log_arg2_type = TOKEN_STRING_INITIALIZER(struct cmd_log_type_result, arg2, str_log_arg2_type); +const char PROGMEM str_log_arg3[] = "on#off"; +const parse_token_string_t PROGMEM cmd_log_arg3 = TOKEN_STRING_INITIALIZER(struct cmd_log_type_result, arg3, str_log_arg3); -prog_char help_log_type[] = "Set log type"; -parse_pgm_inst_t cmd_log_type = { +const char PROGMEM help_log_type[] = "Set log type"; +const parse_inst_t PROGMEM cmd_log_type = { .f = cmd_log_type_parsed, /* function to call */ .data = NULL, /* 2nd arg of func */ .help_str = help_log_type, .tokens = { /* token list, NULL terminated */ - (prog_void *)&cmd_log_arg0, - (prog_void *)&cmd_log_arg1_type, - (prog_void *)&cmd_log_arg2_type, - (prog_void *)&cmd_log_arg3, + (PGM_P)&cmd_log_arg0, + (PGM_P)&cmd_log_arg1_type, + (PGM_P)&cmd_log_arg2_type, + (PGM_P)&cmd_log_arg3, NULL, }, }; @@ -349,6 +358,8 @@ struct cmd_stack_space_result { /* function called when cmd_stack_space is parsed successfully */ static void cmd_stack_space_parsed(void *parsed_result, void *data) { + (void)parsed_result; + (void)data; #ifdef HOST_VERSION printf("not implemented\n"); #else @@ -356,16 +367,16 @@ static void cmd_stack_space_parsed(void *parsed_result, void *data) #endif } -prog_char str_stack_space_arg0[] = "stack_space"; -parse_pgm_token_string_t cmd_stack_space_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_stack_space_result, arg0, str_stack_space_arg0); +const char PROGMEM str_stack_space_arg0[] = "stack_space"; +const parse_token_string_t PROGMEM cmd_stack_space_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_stack_space_result, arg0, str_stack_space_arg0); -prog_char help_stack_space[] = "Display remaining stack space"; -parse_pgm_inst_t cmd_stack_space = { +const char PROGMEM help_stack_space[] = "Display remaining stack space"; +const parse_inst_t PROGMEM cmd_stack_space = { .f = cmd_stack_space_parsed, /* function to call */ .data = NULL, /* 2nd arg of func */ .help_str = help_stack_space, .tokens = { /* token list, NULL terminated */ - (prog_void *)&cmd_stack_space_arg0, + (PGM_P)&cmd_stack_space_arg0, NULL, }, };