linux-old/include/asm-cris/delay.h
<<
>>
Prefs
   1#ifndef _CRIS_DELAY_H
   2#define _CRIS_DELAY_H
   3
   4/*
   5 * Copyright (C) 1998, 1999, 2000, 2001 Axis Communications AB
   6 *
   7 * Delay routines, using a pre-computed "loops_per_second" value.
   8 */
   9
  10#include <linux/config.h>
  11#include <linux/linkage.h>
  12
  13#ifdef CONFIG_SMP
  14#include <asm/smp.h>
  15#endif 
  16
  17extern void __do_delay(void);   /* Special register call calling convention */
  18
  19extern __inline__ void __delay(int loops)
  20{
  21        __asm__ __volatile__ (
  22                              "move.d %0,$r9\n\t"
  23                              "beq 2f\n\t"
  24                              "subq 1,$r9\n\t"
  25                              "1:\n\t"
  26                              "bne 1b\n\t"
  27                              "subq 1,$r9\n"
  28                              "2:"
  29                              : : "g" (loops) : "r9");
  30}
  31
  32
  33/* Use only for very small delays ( < 1 msec).  */
  34
  35extern unsigned long loops_per_usec; /* arch/cris/mm/init.c */
  36
  37extern __inline__ void udelay(unsigned long usecs)
  38{
  39        __delay(usecs * loops_per_usec);
  40}
  41
  42/* ETRAX 100 is really too slow to sleep for nanosecs. */
  43/* Divide with 1024 to avoid a real division that would take >1 us... */
  44extern __inline__ void ndelay(unsigned long nsecs)
  45{
  46        __delay(1 + nsecs * loops_per_usec / 1024);
  47}
  48
  49#endif /* defined(_CRIS_DELAY_H) */
  50
  51
  52
  53
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.