summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlaranjeiro2008-09-08 12:36:32 +0000
committerlaranjeiro2008-09-08 12:36:32 +0000
commit005d62d08255c2922b646dfa10e69f22b987cf6e (patch)
treeb6aa45739e96475c95053146a6f9547d3804edb2
parentba9d8b1c139ac16c93e2fecdf0ab3d050e373ca6 (diff)
- hal/timer: Removed the dbg_assert on the date provided cause of Maximus use.
- hal/leon: Moved the dbg_assert on the date to not exceed the 24 bits of the timer. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@2886 017c9cb6-072f-447c-8318-d5b54f68fe89
-rw-r--r--cesar/hal/leon/src/timer.c9
-rw-r--r--cesar/hal/timer/src/timer.c2
-rw-r--r--cesar/hal/timer/timer.h3
3 files changed, 8 insertions, 6 deletions
diff --git a/cesar/hal/leon/src/timer.c b/cesar/hal/leon/src/timer.c
index c1f8dc4446..13770dd4bb 100644
--- a/cesar/hal/leon/src/timer.c
+++ b/cesar/hal/leon/src/timer.c
@@ -38,6 +38,9 @@
#define LEON_TIMER_RELOAD (LEON_TIMER_BASE + 4)
#define LEON_TIMER_CONFIG (LEON_TIMER_BASE + 8)
+#define LEON_TIMER_REGISTER_SIZE 24 // 24 bits
+#define LEON_TIMER_MAX_TIME (((1 << TIMER_REGISTER_SIZE) - 1) / 3)
+
static leon_timer_t leon_timer_global;
static volatile u32 *leon_timer_value = (u32 *) LEON_TIMER_VALUE;
static volatile u32 *leon_timer_reload = (u32 *) LEON_TIMER_RELOAD;
@@ -129,12 +132,16 @@ leon_timer_uninit (leon_timer_t *ctx)
void
leon_timer_program (leon_timer_t *ctx, u32 date)
{
+ u32 leon_date;
dbg_assert (ctx);
dbg_assert (date);
+ leon_date = date - phy_date (ctx->phy);
+ dbg_assert (leon_date < TIMER_MAX_TIME);
+
/** Reconfigure the timer. */
*leon_timer_config = 0x0;
- *leon_timer_reload = date - phy_date (ctx->phy);
+ *leon_timer_reload = leon_date;
/** reload and enable the timer. */
*leon_timer_config = 0x5;
diff --git a/cesar/hal/timer/src/timer.c b/cesar/hal/timer/src/timer.c
index 1ffdc66577..790d0958fe 100644
--- a/cesar/hal/timer/src/timer.c
+++ b/cesar/hal/timer/src/timer.c
@@ -109,8 +109,6 @@ hal_timer_instance_program (hal_timer_t *ctx,
dbg_assert (instance);
dbg_assert (ctx->phy);
dbg_assert (date > phy_date(ctx->phy));
- // The real timer as 24 bits register.
- dbg_assert (date < TIMER_MAX_TIME );
// initialise the node.
heap_node_init (&instance->node);
diff --git a/cesar/hal/timer/timer.h b/cesar/hal/timer/timer.h
index a9d0a0a4c1..e513c405a5 100644
--- a/cesar/hal/timer/timer.h
+++ b/cesar/hal/timer/timer.h
@@ -17,9 +17,6 @@
#include "hal/phy/phy.h"
#include "lib/heap.h"
-#define TIMER_REGISTER_SIZE 24 // 24 bits
-#define TIMER_MAX_TIME (((1 << TIMER_REGISTER_SIZE) - 1) / 3)
-
/** Call back declaration. */
typedef void (*hal_timer_instance_cb_t) (void *user_data);