aboutsummaryrefslogtreecommitdiff
path: root/module/timer
diff options
context:
space:
mode:
authorElieva Pignat <Elieva.Pignat@arm.com>2018-06-14 17:47:16 +0100
committerdavidcunado-arm <david.cunado@arm.com>2018-07-25 11:35:23 +0100
commit8533a3eeb7e927d4e3819b0a372e3023dd786957 (patch)
treea8a596a96e3e3ff0a12e29ad42bd64f0c5e13ab4 /module/timer
parent9be0a173bade11b78fad74fd8181623eeeb096ce (diff)
timer: add a minimum timestamp for the alarms
When running on FVP, alarms set within a very short time period can be missed. This patch defines a minimum timestamp workaround. Change-Id: Icb7ca816d94c5b3467633e9931d7205d569b1f2a Signed-off-by: Elieva Pignat <Elieva.Pignat@arm.com>
Diffstat (limited to 'module/timer')
-rw-r--r--module/timer/src/mod_timer.c43
1 files changed, 1 insertions, 42 deletions
diff --git a/module/timer/src/mod_timer.c b/module/timer/src/mod_timer.c
index a80e4901..9da41fbc 100644
--- a/module/timer/src/mod_timer.c
+++ b/module/timer/src/mod_timer.c
@@ -146,28 +146,11 @@ static int _remaining(const struct dev_ctx *ctx,
static void _configure_timer_with_next_alarm(struct dev_ctx *ctx)
{
struct alarm_ctx *alarm_head;
- uint64_t counter = 0;
- int status;
assert(ctx != NULL);
alarm_head = (struct alarm_ctx *)fwk_list_head(&ctx->alarms_active);
if (alarm_head != NULL) {
- /*
- * If an alarm's period is very small, the timer device could be
- * configured to interrupt on a timestamp that is "in the past" by the
- * time interrupts are enabled. In this case, the interrupt will not be
- * generated due to a model bug. This code can be deleted once this bug
- * has been fixed.
- *
- * If this alarm occurs very soon, process it immediately to avoid
- * potentially missing the interrupt and waiting forever.
- */
- status = ctx->driver->get_counter(ctx->driver_dev_id, &counter);
- if ((status == FWK_SUCCESS) &&
- (counter + 2000 >= alarm_head->timestamp))
- timer_isr((uintptr_t)ctx);
-
/* Configure timer device */
ctx->driver->set_timer(ctx->driver_dev_id, alarm_head->timestamp);
ctx->driver->enable(ctx->driver_dev_id);
@@ -486,10 +469,8 @@ static void timer_isr(uintptr_t ctx_ptr)
{
int status;
struct alarm_ctx *alarm;
- struct alarm_ctx *alarm_head;
struct dev_ctx *ctx = (struct dev_ctx *)ctx_ptr;
uint64_t timestamp = 0;
- uint64_t counter = 0;
struct fwk_event event;
assert(ctx != NULL);
@@ -498,7 +479,6 @@ static void timer_isr(uintptr_t ctx_ptr)
ctx->driver->disable(ctx->driver_dev_id);
fwk_interrupt_clear_pending(ctx->config->timer_irq);
-process_alarm:
alarm = (struct alarm_ctx *)fwk_list_pop_head(&ctx->alarms_active);
if (alarm == NULL) {
@@ -535,28 +515,7 @@ process_alarm:
"back into queue.\n");
}
- alarm_head = FWK_LIST_GET(fwk_list_head(&ctx->alarms_active),
- struct alarm_ctx,
- node);
- if (alarm_head != NULL) {
- /*
- * If successive alarm item timestamps are very close together, the
- * timer device could be configured to interrupt on a timestamp that is
- * "in the past". In this case, the interrupt will not be generated due
- * to a model bug. This code can be deleted once this bug has been
- * fixed.
- *
- * If the next alarm occurs very soon, process it immidiately to avoid
- * potentially missing the interrupt and waiting forever.
- */
- status = ctx->driver->get_counter(ctx->driver_dev_id, &counter);
- if ((status == FWK_SUCCESS) &&
- (counter + 2000 >= alarm_head->timestamp))
- goto process_alarm;
-
- ctx->driver->set_timer(ctx->driver_dev_id, alarm_head->timestamp);
- ctx->driver->enable(ctx->driver_dev_id);
- }
+ _configure_timer_with_next_alarm(ctx);
}
/*