• Alessandro Rubini's avatar
    userspace/libwr: change the udelay function · 4bebb908
    Alessandro Rubini authored
    To delay for less than 1ms (was: 10ms) we must busy-loop, because the
    kernel is jiffy-based. No way out of it.
    
    The implementation, however, was based on gettimeofday(), which means
    we couldn't really strace the hal process, as it appeared to
    only call gettimeofday all the time.
    
    This code uses a local software loop, after a calibration step of
    around 20ms (depends on CPU speed). Moreover, by calling usleep() for
    longer-than-1ms delays it doesn't use 100% cpu power during the
    initial led blinking.
    
    Now strace on the process shows what it really is doing (besides
    user-spac-only i2c accesses).
    Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
    4bebb908
util.c 1.4 KB