Show
Ignore:
Timestamp:
04/09/08 22:55:17 (9 months ago)
Author:
aturner
Message:

writing to the ioport is complex enough it prolly doesn't belong full bore in
the header. refs #41

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • features/performance/src/sleep.c

    r1970 r1972  
    6464} 
    6565 
     66void  
     67ioport_sleep(const struct timespec nap)  
     68{ 
     69    struct timeval nap_for; 
     70    u_int32_t usec; 
     71    time_t i; 
     72     
     73    TIMESPEC_TO_TIMEVAL(&nap_for, &nap); 
     74     
     75    /*  
     76     * process the seconds, we do this in a loop so we don't have to  
     77     * use slower 64bit integers or worry about integer overflows. 
     78     */ 
     79    for (i = 0; i < nap_for.tv_sec; i ++) { 
     80        usec = SEC_TO_MICROSEC(nap_for.tv_sec); 
     81        while (usec > 0) { 
     82            usec --; 
     83            outb(ioport_sleep_value, 0x80); 
     84        } 
     85    } 
     86     
     87    /* process the usec */ 
     88    usec = nap.tv_nsec / 1000; 
     89    usec --; /* fudge factor for all the above */ 
     90    while (usec > 0) { 
     91        usec --; 
     92        outb(ioport_sleep_value, 0x80); 
     93    } 
     94}