summaryrefslogtreecommitdiff
path: root/src/jtag/interface.h
diff options
context:
space:
mode:
authorØyvind Harboe <oyvind.harboe@zylin.com>2011-04-13 21:51:42 +0200
committerØyvind Harboe <oyvind.harboe@zylin.com>2011-04-19 12:43:16 +0200
commite984dc1f162ab2bd94629c32d640d804b0295553 (patch)
tree6466a60faec99169df7eab2bcc1b0acd38646041 /src/jtag/interface.h
parentb69119668ed8d9633280f8b596fe9af60f51644b (diff)
downloadopenocd+libswd-e984dc1f162ab2bd94629c32d640d804b0295553.tar.gz
openocd+libswd-e984dc1f162ab2bd94629c32d640d804b0295553.tar.bz2
openocd+libswd-e984dc1f162ab2bd94629c32d640d804b0295553.tar.xz
openocd+libswd-e984dc1f162ab2bd94629c32d640d804b0295553.zip
jtag: clarify jtag->init() and jtag->quit() definitions
only set jtag global pointer if jtag->init() succeeds. Less code, more clear what the rules are. Fix nit that error value from init() was not propagated unmodified. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Diffstat (limited to 'src/jtag/interface.h')
-rw-r--r--src/jtag/interface.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/jtag/interface.h b/src/jtag/interface.h
index 958af8f5..1059436e 100644
--- a/src/jtag/interface.h
+++ b/src/jtag/interface.h
@@ -231,8 +231,14 @@ struct jtag_interface {
const struct command_registration *commands;
/**
- * Interface driver must initalize any resources and connect to a
+ * Interface driver must initialize any resources and connect to a
* JTAG device.
+ *
+ * quit() is invoked if and only if init() succeeds. quit() is always
+ * invoked if init() succeeds. Same as malloc() + free(). Always
+ * invoke free() if malloc() succeeds and do not invoke free()
+ * otherwise.
+ *
* @returns ERROR_OK on success, or an error code on failure.
*/
int (*init)(void);
@@ -240,6 +246,7 @@ struct jtag_interface {
/**
* Interface driver must tear down all resources and disconnect from
* the JTAG device.
+ *
* @returns ERROR_OK on success, or an error code on failure.
*/
int (*quit)(void);