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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [asm-m68k/] [delay.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1633 jcastillo
#ifndef _M68K_DELAY_H
2
#define _M68K_DELAY_H
3
 
4
/*
5
 * Copyright (C) 1994 Hamish Macdonald
6
 *
7
 * Delay routines, using a pre-computed "loops_per_second" value.
8
 */
9
 
10
extern __inline__ void __delay(int loops)
11
{
12
        __asm__ __volatile__ ("\n\tmovel %0,%/d0\n1:\tsubql #1,%/d0\n\t"
13
                              "bpls 1b\n"
14
                : /* no outputs */
15
                : "g" (loops)
16
                : "d0");
17
}
18
 
19
/*
20
 * Use only for very small delays ( < 1 msec).  Should probably use a
21
 * lookup table, really, as the multiplications take much too long with
22
 * short delays.  This is a "reasonable" implementation, though (and the
23
 * first constant multiplications gets optimized away if the delay is
24
 * a constant)
25
 */
26
extern __inline__ void udelay(unsigned long usecs)
27
{
28
        usecs *= 0x000010c6;            /* 2**32 / 1000000 */
29
 
30
        __asm__ __volatile__ ("mulul %1,%0:%2"
31
             : "=d" (usecs)
32
             : "d" (usecs),
33
               "d" (loops_per_sec));
34
        __delay(usecs);
35
}
36
 
37
extern __inline__ unsigned long muldiv(unsigned long a, unsigned long b, unsigned long c)
38
{
39
        __asm__ ("mulul %1,%/d0:%0\n\tdivul %2,%/d0:%0"
40
                 :"=d" (a)
41
                 :"d" (b),
42
                 "d" (c),
43
                 "0" (a)
44
                 :"d0");
45
        return a;
46
}
47
 
48
#endif /* defined(_M68K_DELAY_H) */

powered by: WebSVN 2.1.0

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