target_t *all_targets = NULL;
struct target_event_callback *target_event_callbacks = NULL;
-target_timer_callback_t *target_timer_callbacks = NULL;
+struct target_timer_callback *target_timer_callbacks = NULL;
const Jim_Nvp nvp_assert[] = {
{ .name = "assert", NVP_ASSERT },
int target_register_timer_callback(int (*callback)(void *priv), int time_ms, int periodic, void *priv)
{
- target_timer_callback_t **callbacks_p = &target_timer_callbacks;
+ struct target_timer_callback **callbacks_p = &target_timer_callbacks;
struct timeval now;
if (callback == NULL)
callbacks_p = &((*callbacks_p)->next);
}
- (*callbacks_p) = malloc(sizeof(target_timer_callback_t));
+ (*callbacks_p) = malloc(sizeof(struct target_timer_callback));
(*callbacks_p)->callback = callback;
(*callbacks_p)->periodic = periodic;
(*callbacks_p)->time_ms = time_ms;
int target_unregister_timer_callback(int (*callback)(void *priv), void *priv)
{
- target_timer_callback_t **p = &target_timer_callbacks;
- target_timer_callback_t *c = target_timer_callbacks;
+ struct target_timer_callback **p = &target_timer_callbacks;
+ struct target_timer_callback *c = target_timer_callbacks;
if (callback == NULL)
{
while (c)
{
- target_timer_callback_t *next = c->next;
+ struct target_timer_callback *next = c->next;
if ((c->callback == callback) && (c->priv == priv))
{
*p = next;
}
static int target_timer_callback_periodic_restart(
- target_timer_callback_t *cb, struct timeval *now)
+ struct target_timer_callback *cb, struct timeval *now)
{
int time_ms = cb->time_ms;
cb->when.tv_usec = now->tv_usec + (time_ms % 1000) * 1000;
return ERROR_OK;
}
-static int target_call_timer_callback(target_timer_callback_t *cb,
+static int target_call_timer_callback(struct target_timer_callback *cb,
struct timeval *now)
{
cb->callback(cb->priv);
struct timeval now;
gettimeofday(&now, NULL);
- target_timer_callback_t *callback = target_timer_callbacks;
+ struct target_timer_callback *callback = target_timer_callbacks;
while (callback)
{
// cleaning up may unregister and free this callback
- target_timer_callback_t *next_callback = callback->next;
+ struct target_timer_callback *next_callback = callback->next;
bool call_it = callback->callback &&
((!checktime && callback->periodic) ||
struct target_event_callback *next;
};
-typedef struct target_timer_callback_s
+struct target_timer_callback
{
int (*callback)(void *priv);
int time_ms;
int periodic;
struct timeval when;
void *priv;
- struct target_timer_callback_s *next;
-} target_timer_callback_t;
+ struct target_timer_callback *next;
+};
int target_register_commands(struct command_context_s *cmd_ctx);
int target_register_user_commands(struct command_context_s *cmd_ctx);
extern target_t *all_targets;
extern struct target_event_callback *target_event_callbacks;
-extern target_timer_callback_t *target_timer_callbacks;
+extern struct target_timer_callback *target_timer_callbacks;
uint32_t target_buffer_get_u32(target_t *target, const uint8_t *buffer);
uint16_t target_buffer_get_u16(target_t *target, const uint8_t *buffer);