Commit 6f9c296b authored by Alessandro Rubini's avatar Alessandro Rubini

timer: fix prototpyes

We don't want "timer_delay(howlong)" because people won't know the
unit while looking at the header.

Also, this removes an unused prototype and adds void when void is due
in timer code.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent d983ca82
...@@ -28,19 +28,19 @@ void timer_init(uint32_t enable) ...@@ -28,19 +28,19 @@ void timer_init(uint32_t enable)
syscon->TCR &= ~SYSC_TCR_ENABLE; syscon->TCR &= ~SYSC_TCR_ENABLE;
} }
uint32_t timer_get_tics() uint32_t timer_get_tics(void)
{ {
return syscon->TVR; return syscon->TVR;
} }
void timer_delay(uint32_t how_long) void timer_delay(uint32_t tics)
{ {
uint32_t t_start; uint32_t t_start;
// timer_init(1); // timer_init(1);
do { do {
t_start = timer_get_tics(); t_start = timer_get_tics();
} while (t_start > UINT32_MAX - how_long); //in case of overflow } while (t_start > UINT32_MAX - tics); //in case of overflow
while (t_start + how_long > timer_get_tics()) ; while (t_start + tics > timer_get_tics()) ;
} }
...@@ -2,19 +2,19 @@ ...@@ -2,19 +2,19 @@
#include "syscon.h" #include "syscon.h"
uint32_t timer_get_tics() uint32_t timer_get_tics(void)
{ {
return *(volatile uint32_t *) (BASE_TIMER); return *(volatile uint32_t *) (BASE_TIMER);
} }
void timer_delay(uint32_t how_long) void timer_delay(uint32_t tics)
{ {
uint32_t t_start; uint32_t t_start;
t_start = timer_get_tics(); t_start = timer_get_tics();
if(t_start + how_long < t_start) if(t_start + tics < t_start)
while(t_start + how_long < timer_get_tics()); while(t_start + tics < timer_get_tics());
while(t_start + how_long > timer_get_tics()); while(t_start + tics > timer_get_tics());
} }
...@@ -8,9 +8,8 @@ ...@@ -8,9 +8,8 @@
#define TICS_PER_SECOND 100000 #define TICS_PER_SECOND 100000
uint32_t timer_get_tics(); uint32_t timer_get_tics(void);
void timer_delay(uint32_t how_long); void timer_delay(uint32_t tics);
int timer_expired(uint32_t t_start, uint32_t how_long);
#else /* CONFIG_WR_NODE */ #else /* CONFIG_WR_NODE */
...@@ -46,8 +45,8 @@ extern struct s_i2c_if i2c_if[2]; ...@@ -46,8 +45,8 @@ extern struct s_i2c_if i2c_if[2];
#define TICS_PER_SECOND 1000 #define TICS_PER_SECOND 1000
void timer_init(uint32_t enable); void timer_init(uint32_t enable);
uint32_t timer_get_tics(); uint32_t timer_get_tics(void);
void timer_delay(uint32_t how_long); void timer_delay(uint32_t tics);
/* usleep.c */ /* usleep.c */
extern void usleep_init(void); extern void usleep_init(void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment