summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-06-09 08:41:29 +0000
committerzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-06-09 08:41:29 +0000
commitaabb31d5710038b682c06945de4c94b3c612d936 (patch)
treee3eaf9be35c7f6a68458e87677b79df73382cb05
parentae52de5ad54f85208a17da0653ec378c2f4de98d (diff)
downloadopenocd_libswd-aabb31d5710038b682c06945de4c94b3c612d936.tar.gz
openocd_libswd-aabb31d5710038b682c06945de4c94b3c612d936.tar.bz2
openocd_libswd-aabb31d5710038b682c06945de4c94b3c612d936.tar.xz
openocd_libswd-aabb31d5710038b682c06945de4c94b3c612d936.zip
Add jtag_event_handler_t:
- Define the function signature used by the JTAG event callback mechanism. - Provide Doxygen block for new type, including TODO for its return value. git-svn-id: svn://svn.berlios.de/openocd/trunk@2168 b42882b7-edfa-0310-969c-e2dbd0fdcd60
-rw-r--r--src/jtag/core.c4
-rw-r--r--src/jtag/jtag.h19
2 files changed, 18 insertions, 5 deletions
diff --git a/src/jtag/core.c b/src/jtag/core.c
index d45fd67e..54ee757c 100644
--- a/src/jtag/core.c
+++ b/src/jtag/core.c
@@ -201,7 +201,7 @@ const char *jtag_tap_name(const jtag_tap_t *tap)
}
-int jtag_register_event_callback(int (*callback)(enum jtag_event event, void *priv), void *priv)
+int jtag_register_event_callback(jtag_event_handler_t callback, void *priv)
{
jtag_event_callback_t **callbacks_p = &jtag_event_callbacks;
@@ -225,7 +225,7 @@ int jtag_register_event_callback(int (*callback)(enum jtag_event event, void *pr
return ERROR_OK;
}
-int jtag_unregister_event_callback(int (*callback)(enum jtag_event event, void *priv))
+int jtag_unregister_event_callback(jtag_event_handler_t callback)
{
jtag_event_callback_t **callbacks_p = &jtag_event_callbacks;
diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h
index f0196690..f7b215b3 100644
--- a/src/jtag/jtag.h
+++ b/src/jtag/jtag.h
@@ -248,9 +248,22 @@ int jtag_get_trst(void);
/// @returns The current state of SRST.
int jtag_get_srst(void);
+/**
+ * Defines the function signature requide for JTAG event callback
+ * functions, which are added with jtag_register_event_callback()
+ * and removed jtag_unregister_event_callback().
+ * @param event The event to handle.
+ * @param prive A pointer to data that was passed to
+ * jtag_register_event_callback().
+ * @returns Must return ERROR_OK on success, or an error code on failure.
+ *
+ * @todo Change to return void or define a use for its return code.
+ */
+typedef int (*jtag_event_handler_t)(enum jtag_event event, void* priv);
+
typedef struct jtag_event_callback_s
{
- int (*callback)(enum jtag_event event, void* priv);
+ jtag_event_handler_t callback;
void* priv;
struct jtag_event_callback_s* next;
} jtag_event_callback_t;
@@ -609,8 +622,8 @@ extern void jtag_check_value_mask(scan_field_t *field, u8 *value, u8 *mask);
extern void jtag_sleep(u32 us);
extern int jtag_call_event_callbacks(enum jtag_event event);
-extern int jtag_register_event_callback(int (* callback)(enum jtag_event event, void* priv), void* priv);
-extern int jtag_unregister_event_callback(int (*callback)(enum jtag_event event, void *priv));
+extern int jtag_register_event_callback(jtag_event_handler_t f, void *x);
+extern int jtag_unregister_event_callback(jtag_event_handler_t f);
/*
* The JTAG subsystem defines a number of error codes,