diff options
author | Vincent Palatin <vpalatin@chromium.org> | 2012-01-23 23:07:58 +0000 |
---|---|---|
committer | Vincent Palatin <vpalatin@chromium.org> | 2012-01-24 00:50:08 +0000 |
commit | c21f07e58e48144a97a844668aae68644f8e8dec (patch) | |
tree | 12a0b7f04e085a0d2035e9bfbe05013530f99501 /common/memory_commands.c | |
parent | a2a85365d600b93ecd10d44d1a5a2115ce0252f1 (diff) | |
download | chrome-ec-c21f07e58e48144a97a844668aae68644f8e8dec.tar.gz |
register console commands at compile-time
Instead of using a runtime callback to register the console commands,
put them in a special linker section. So we can do a macro to "register"
them during the build.
It saves 684 bytes and a few microseconds at startup.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BUG=None
TEST=run a few commands from the BDS command line.
Change-Id: Id33ea210b9035bf76ed720373c74c5dd24ccd1b1
Diffstat (limited to 'common/memory_commands.c')
-rw-r--r-- | common/memory_commands.c | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/common/memory_commands.c b/common/memory_commands.c index e54d567080..3a0a8ec83e 100644 --- a/common/memory_commands.c +++ b/common/memory_commands.c @@ -31,6 +31,8 @@ static int command_write_word(int argc, char **argv) return EC_SUCCESS; } +DECLARE_CONSOLE_COMMAND(ww, command_write_word); +DECLARE_CONSOLE_COMMAND(writeword, command_write_word); static int command_read_word(int argc, char **argv) @@ -50,21 +52,5 @@ static int command_read_word(int argc, char **argv) return EC_SUCCESS; } - - -static const struct console_command console_commands[] = { - {"rw", command_read_word}, - {"ww", command_write_word}, - {"readword", command_read_word}, - {"writeword", command_write_word}, -}; -static const struct console_group command_group = { - "Memory", console_commands, ARRAY_SIZE(console_commands) -}; - - -int memory_commands_init(void) -{ - /* Register our internal commands */ - return console_register_commands(&command_group); -} +DECLARE_CONSOLE_COMMAND(rw, command_read_word); +DECLARE_CONSOLE_COMMAND(readword, command_read_word); |