summaryrefslogtreecommitdiff
path: root/cesar
diff options
context:
space:
mode:
authorlaranjeiro2010-05-21 16:07:08 +0000
committerlaranjeiro2010-05-21 16:07:08 +0000
commit3c9e1c47fd7029e08716667a91818cd4eb061796 (patch)
tree3b939d8be4f7b245c361c33db7cf42ab531b802d /cesar
parentaead90963b756abdfe3016534d8daf8ee7f37c4b (diff)
cesar/hal/timer: program the it to the next tick
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@7128 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar')
-rw-r--r--cesar/hal/leon/src/timer.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/cesar/hal/leon/src/timer.c b/cesar/hal/leon/src/timer.c
index 30479560e5..826a33f18f 100644
--- a/cesar/hal/leon/src/timer.c
+++ b/cesar/hal/leon/src/timer.c
@@ -142,26 +142,18 @@ leon_timer_program (leon_timer_t *ctx, u32 date)
dbg_assert (ctx->status == LEON_TIMER_STATUS_STOP);
leon_date = PHY_DATE_TO_LEON_DATE (date - phy_date ());
- if (!(leon_date & ~LEON_TIMER_REGISTER_MASK))
+ if ((leon_date & ~LEON_TIMER_REGISTER_MASK))
{
- /** Reconfigure the timer. */
- *leon_timer_config = LEON_TIMER_CONFIG_DISABLE;
- *leon_timer_reload = leon_date;
- /** reload and enable the timer. */
- *leon_timer_config = LEON_TIMER_CONFIG_LOAD | LEON_TIMER_CONFIG_ENABLE;
-
- ctx->status = LEON_TIMER_STATUS_RUNNING;
- }
- else
- {
- /* Date is already in the past, call directly the callback. */
- // call back the callback function.
- dbg_assert (ctx->cb);
- cyg_scheduler_lock ();
- ctx->status = LEON_TIMER_STATUS_STOP;
- (ctx->cb) (ctx->user_data);
- cyg_scheduler_unlock ();
+ /* Date is in the past, configure the timer to execute ISR
+ * next tick. */
+ leon_date = 1;
}
+ /** Reconfigure the timer. */
+ *leon_timer_config = LEON_TIMER_CONFIG_DISABLE;
+ *leon_timer_reload = leon_date;
+ /** reload and enable the timer. */
+ *leon_timer_config = LEON_TIMER_CONFIG_LOAD | LEON_TIMER_CONFIG_ENABLE;
+ ctx->status = LEON_TIMER_STATUS_RUNNING;
}
/**