Subversion Repositories freemyipod

Rev

Rev 14 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 14 Rev 85
Line 23... Line 23...
23
 
23
 
24
#ifndef __TIMER_H__
24
#ifndef __TIMER_H__
25
#define __TIMER_H__
25
#define __TIMER_H__
26
 
26
 
27
#include "global.h"
27
#include "global.h"
28
#include "s5l8701.h"
-
 
29
 
28
 
30
 
29
 
31
#define TIME_AFTER(a,b)         ((long)(b) - (long)(a) < 0)
30
#define TIME_AFTER(a,b)         ((long)(b) - (long)(a) < 0)
32
#define TIME_BEFORE(a,b)        TIME_AFTER(b,a)
31
#define TIME_BEFORE(a,b)        TIME_AFTER(b,a)
33
#define TIMEOUT_EXPIRED(a,b)    TIME_AFTER(USEC_TIMER,a + b)
32
#define TIMEOUT_EXPIRED(a,b)    TIME_AFTER(USEC_TIMER,a + b)
34
 
33
 
35
 
34
 
-
 
35
uint32_t read_usec_timer();
-
 
36
#define USEC_TIMER (read_usec_timer())
-
 
37
 
-
 
38
 
36
static inline void udelay(long duration)  /* in usec steps */
39
static inline void udelay(long duration)  /* in usec steps */
37
{
40
{
38
    long timestamp = USEC_TIMER;
41
    long timestamp = USEC_TIMER;
39
    while (!TIMEOUT_EXPIRED(timestamp, duration));
42
    while (!TIMEOUT_EXPIRED(timestamp, duration));
40
}
43
}