}
-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;
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;
/// @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;
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,