summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZachary T Welch <zw@superlucidity.net>2009-11-22 04:13:56 -0800
committerZachary T Welch <zw@superlucidity.net>2009-11-24 21:37:34 -0800
commit7609e1091abfacfc1b62aca06c642e42003aa444 (patch)
tree8051dd2687a840d4078d6f40d3f01c8675300d2e
parent1cbe3ec6f105e35e641293cd7e62e6fefac1b271 (diff)
downloadopenocd_libswd-7609e1091abfacfc1b62aca06c642e42003aa444.tar.gz
openocd_libswd-7609e1091abfacfc1b62aca06c642e42003aa444.tar.bz2
openocd_libswd-7609e1091abfacfc1b62aca06c642e42003aa444.tar.xz
openocd_libswd-7609e1091abfacfc1b62aca06c642e42003aa444.zip
lpc3180_nand_controller: use register_commands()
-rw-r--r--src/flash/lpc3180_nand_controller.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/flash/lpc3180_nand_controller.c b/src/flash/lpc3180_nand_controller.c
index 801607df..2dec3e12 100644
--- a/src/flash/lpc3180_nand_controller.c
+++ b/src/flash/lpc3180_nand_controller.c
@@ -873,13 +873,29 @@ COMMAND_HANDLER(handle_lpc3180_select_command)
return ERROR_OK;
}
+static const struct command_registration lpc3180_exec_command_handlers[] = {
+ {
+ .name = "select",
+ .handler = &handle_lpc3180_select_command,
+ .mode = COMMAND_EXEC,
+ .help = "select <'mlc'|'slc'> controller (default is mlc)",
+ .usage = "<device_id> (mlc|slc)",
+ },
+ COMMAND_REGISTRATION_DONE
+};
+static const struct command_registration lpc3180_command_handler[] = {
+ {
+ .name = "lpc3180",
+ .mode = COMMAND_ANY,
+ .help = "LPC3180 NAND flash controller commands",
+ .chain = lpc3180_exec_command_handlers,
+ },
+ COMMAND_REGISTRATION_DONE
+};
+
static int lpc3180_register_commands(struct command_context *cmd_ctx)
{
- struct command *lpc3180_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "lpc3180", NULL, COMMAND_ANY, "commands specific to the LPC3180 NAND flash controllers");
-
- COMMAND_REGISTER(cmd_ctx, lpc3180_cmd, "select", handle_lpc3180_select_command, COMMAND_EXEC, "select <'mlc'|'slc'> controller (default is mlc)");
-
- return ERROR_OK;
+ return register_commands(cmd_ctx, NULL, lpc3180_command_handler);
}
struct nand_flash_controller lpc3180_nand_controller = {