Commit aabb31d5 authored by zwelch's avatar zwelch
Browse files

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
parent ae52de5a
......@@ -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;
......
......@@ -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,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment