Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
udelay.c
Package: linux-2.4.20.tar.gz [view]
Upload User: jlfgdled
Upload Date: 2013-04-10
Package Size: 33168k
Code Size: 1k
Category:
Linux-Unix program
Development Platform:
Unix_Linux
- #include <linux/config.h>
- #include <linux/sched.h> /* for udelay's use of smp_processor_id */
- #include <asm/param.h>
- #include <asm/smp.h>
- #include <linux/delay.h>
- /*
- * Copyright (C) 1993, 2000 Linus Torvalds
- *
- * Delay routines, using a pre-computed "loops_per_jiffy" value.
- */
- /*
- * Use only for very small delays (< 1 msec).
- *
- * The active part of our cycle counter is only 32-bits wide, and
- * we're treating the difference between two marks as signed. On
- * a 1GHz box, that's about 2 seconds.
- */
- void __delay(int loops)
- {
- int tmp;
- __asm__ __volatile__(
- " rpcc %0n"
- " addl %1,%0,%1n"
- "1: rpcc %0n"
- " subl %1,%0,%0n"
- " bgt %0,1b"
- : "=&r" (tmp), "=r" (loops) : "1"(loops));
- }
- void __udelay(unsigned long usecs, unsigned long lpj)
- {
- usecs *= (((unsigned long)HZ << 32) / 1000000) * lpj;
- __delay((long)usecs >> 32);
- }
- void udelay(unsigned long usecs)
- {
- #ifdef CONFIG_SMP
- __udelay(usecs, cpu_data[smp_processor_id()].loops_per_jiffy);
- #else
- __udelay(usecs, loops_per_jiffy);
- #endif
- }