OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [arch/] [sh/] [lib/] [delay.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/*
2
 *      Precise Delay Loops for SuperH
3
 *
4
 *      Copyright (C) 1999 Niibe Yutaka & Kaz Kojima
5
 */
6
 
7
#include <linux/sched.h>
8
#include <linux/delay.h>
9
 
10
void __delay(unsigned long loops)
11
{
12
        __asm__ __volatile__(
13
                "tst    %0, %0\n\t"
14
                "1:\t"
15
                "bf/s   1b\n\t"
16
                " dt    %0"
17
                : "=r" (loops)
18
                : "0" (loops)
19
                : "t");
20
}
21
 
22
inline void __const_udelay(unsigned long xloops)
23
{
24
        __asm__("dmulu.l        %0, %2\n\t"
25
                "sts    mach, %0"
26
                : "=r" (xloops)
27
                : "0" (xloops), "r" (current_cpu_data.loops_per_jiffy)
28
                : "macl", "mach");
29
        __delay(xloops * HZ);
30
}
31
 
32
void __udelay(unsigned long usecs)
33
{
34
        __const_udelay(usecs * 0x000010c6);  /* 2**32 / 1000000 */
35
}
36
 
37
void __ndelay(unsigned long nsecs)
38
{
39
        __const_udelay(nsecs * 5);  /* 2**32 / 1000000000 (rounded up) */
40
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.