micro_delay in sysutil, used in ti1225, dp8390, fxp and

orinoco now. Uses a combination of tickdelay (where possible) and
calibrated busywait (where necessary).
This commit is contained in:
Ben Gras
2007-07-31 15:01:49 +00:00
parent 2dc2db4ba1
commit 03446f5554
8 changed files with 105 additions and 49 deletions
+3 -9
View File
@@ -112,13 +112,9 @@ typedef int irq_hook_t;
#define structof(type, field, ptr) \
((type *) (((char *) (ptr)) - offsetof(type, field)))
#define MICROS_TO_TICKS(m) (((m)*HZ/1000000)+1)
static timer_t *fxp_timers= NULL;
static clock_t fxp_next_timeout= 0;
static void micro_delay(unsigned long usecs);
/* ignore interrupt for the moment */
#define interrupt(x) 0
@@ -295,6 +291,9 @@ int main(int argc, char *argv[])
fxp_init_buf(fp);
#endif
if((r=micro_delay_calibrate()) != OK)
panic("FXP","rmicro_delay_calibrate failed", r);
/* Try to notify inet that we are present (again) */
r= ds_retrieve_u32("inet", &tasknr);
if (r == OK)
@@ -2875,11 +2874,6 @@ PRIVATE void fxp_expire_timers()
}
}
static void micro_delay(unsigned long usecs)
{
tickdelay(MICROS_TO_TICKS(usecs));
}
static u8_t do_inb(port_t port)
{
int r;