summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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,