- Main Page
- Related Pages
- Data Structures
- Files

- File List
- Globals

# arch/avr32/delay.c

Go to the documentation of this file.

    00001
    00045 #include <delay.h>
    00046 #include <types.h>
    00047 #include <util.h>
    00048
    00049 #include <arch/sysreg.h>
    00050 #include <chip/clk.h>
    00051
    00064 void udelay(unsigned long us)
    00065 {
    00066         uint32_t count, count_end;
    00067
    00068         count = sysreg_read(COUNT);
    00069         count_end = count + div_ceil(get_cpu_clock_rate(), 1000000) * us;
    00070
    00071         while ((int32_t)(count_end - count) > 0)
    00072                 count = sysreg_read(COUNT);
    00073 }