summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-03-31 19:34:01 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-03-31 19:34:01 +0000
commit86d3e744641ef670f4376e47589afac37d9a87ab (patch)
treefb843d57156c52e40150e8775a58a0d8f9a593c9
parent408e1d86a035d9f3694e0c9c5b86a30c85fd0249 (diff)
downloadopenocd+libswd-86d3e744641ef670f4376e47589afac37d9a87ab.tar.gz
openocd+libswd-86d3e744641ef670f4376e47589afac37d9a87ab.tar.bz2
openocd+libswd-86d3e744641ef670f4376e47589afac37d9a87ab.tar.xz
openocd+libswd-86d3e744641ef670f4376e47589afac37d9a87ab.zip
target_call_timer_callbacks_now() now invokes periodic callbacks immediately
git-svn-id: svn://svn.berlios.de/openocd/trunk@529 b42882b7-edfa-0310-969c-e2dbd0fdcd60
-rw-r--r--src/target/target.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/target/target.c b/src/target/target.c
index de786958..8f785dd3 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -575,7 +575,7 @@ int target_call_event_callbacks(target_t *target, enum target_event event)
return ERROR_OK;
}
-int target_call_timer_callbacks()
+static int target_call_timer_callbacks_check_time(int checktime)
{
target_timer_callback_t *callback = target_timer_callbacks;
target_timer_callback_t *next_callback;
@@ -587,8 +587,9 @@ int target_call_timer_callbacks()
{
next_callback = callback->next;
- if (((now.tv_sec >= callback->when.tv_sec) && (now.tv_usec >= callback->when.tv_usec))
- || (now.tv_sec > callback->when.tv_sec))
+ if ((!checktime&&callback->periodic)||
+ (((now.tv_sec >= callback->when.tv_sec) && (now.tv_usec >= callback->when.tv_usec))
+ || (now.tv_sec > callback->when.tv_sec)))
{
callback->callback(callback->priv);
if (callback->periodic)
@@ -613,13 +614,15 @@ int target_call_timer_callbacks()
return ERROR_OK;
}
+int target_call_timer_callbacks()
+{
+ return target_call_timer_callbacks_check_time(1);
+}
+
+/* invoke periodic callbacks immediately */
int target_call_timer_callbacks_now()
{
- /* TODO: this should invoke the timer callbacks now. This is used to ensure that
- * any outstanding polls, etc. are in fact invoked before a synchronous command
- * completes.
- */
- return target_call_timer_callbacks();
+ return target_call_timer_callbacks(0);
}