udelay.c 247 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#include <hw/sysctl.h>

#include "udelay.h"

void udelay(int usec)
{
    int limit;
    
    limit = usec*125;
    CSR_TIMER0_CONTROL = 0;
    CSR_TIMER0_COUNTER = 0;
    CSR_TIMER0_CONTROL = TIMER_ENABLE;
    while(CSR_TIMER0_COUNTER < limit);
}