summaryrefslogtreecommitdiff
path: root/src/flash/faux.c
diff options
context:
space:
mode:
authorZachary T Welch <zw@superlucidity.net>2009-11-21 19:27:20 -0800
committerZachary T Welch <zw@superlucidity.net>2009-11-25 10:29:05 -0800
commita93b404161dc42f8dee805c8f95bc4974aded9cb (patch)
tree5dcb1dc0658288fd0385f77bc46a221fbdc06c6f /src/flash/faux.c
parentd89c6310146d9e5fd1a4ab364f09c0f841da5c73 (diff)
downloadopenocd+libswd-a93b404161dc42f8dee805c8f95bc4974aded9cb.tar.gz
openocd+libswd-a93b404161dc42f8dee805c8f95bc4974aded9cb.tar.bz2
openocd+libswd-a93b404161dc42f8dee805c8f95bc4974aded9cb.tar.xz
openocd+libswd-a93b404161dc42f8dee805c8f95bc4974aded9cb.zip
improve command handling examples
Removes hello and foo commands from top-level registration. Instead, the dummy interface driver and faux flash driver have been augmented to register these commands as sub-commands.
Diffstat (limited to 'src/flash/faux.c')
-rw-r--r--src/flash/faux.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/flash/faux.c b/src/flash/faux.c
index adfc7bd3..caec2c79 100644
--- a/src/flash/faux.c
+++ b/src/flash/faux.c
@@ -23,6 +23,7 @@
#include "flash.h"
#include "image.h"
+#include "../hello.h"
struct faux_flash_bank
@@ -123,8 +124,19 @@ static int faux_probe(struct flash_bank *bank)
return ERROR_OK;
}
+static const struct command_registration faux_command_handlers[] = {
+ {
+ .name = "faux",
+ .mode = COMMAND_ANY,
+ .help = "faux flash command group",
+ .chain = hello_command_handlers,
+ },
+ COMMAND_REGISTRATION_DONE
+};
+
struct flash_driver faux_flash = {
.name = "faux",
+ .commands = faux_command_handlers,
.flash_bank_command = &faux_flash_bank_command,
.erase = &faux_erase,
.protect = &faux_protect,