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

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [asm-m68knommu/] [delay.h] - Blame information for rev 1782

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
extern unsigned long loops_per_sec;
5
#include <linux/kernel.h>
6
#include <linux/config.h>
7
 
8
/*
9
 * Copyright (C) 1994 Hamish Macdonald
10
 *
11
 * Delay routines, using a pre-computed "loops_per_second" value.
12
 */
13
 
14
 
15
extern __inline__ void __delay(unsigned long loops)
16
{
17
        __asm__ __volatile__ ("1: subql #1,%0; jcc 1b"
18
                : "=d" (loops) : "0" (loops));
19
}
20
 
21
/*
22
 * Use only for very small delays ( < 1 msec).  Should probably use a
23
 * lookup table, really, as the multiplications take much too long with
24
 * short delays.  This is a "reasonable" implementation, though (and the
25
 * first constant multiplications gets optimized away if the delay is
26
 * a constant)
27
 */
28
extern __inline__ void udelay(unsigned long usecs)
29
{
30
#ifdef CONFIG_M68332
31
        usecs *= 0x000010c6;
32
       __asm__ __volatile__ ("mulul %1,%0:%2"
33
                    : "=d" (usecs)
34
                  : "d" (usecs),
35
                   "d" (loops_per_sec));
36
        __delay(usecs);
37
 
38
#endif
39
#if defined(CONFIG_M68328) || defined(CONFIG_M68EZ328) || defined(CONFIG_COLDFIRE)
40
        /* Sigh */
41
        __delay(usecs);
42
#endif
43
}
44
 
45
#define muldiv(a, b, c)    (((a)*(b))/(c))
46
 
47
/*
48
extern __inline__ unsigned long muldiv(unsigned long a, unsigned long b, unsigned long c)
49
{
50
        unsigned long tmp;
51
 
52
        __asm__ ("mulul %2,%0:%1; divul %3,%0:%1"
53
                : "=d" (tmp), "=d" (a)
54
                : "d" (b), "d" (c), "1" (a));
55
        return a;
56
}
57
*/
58
 
59
#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.