annotate libdha/sysdep/AsmMacros_x86.h @ 4164:2e3262002acb

Improved readability and new stuffs
author nick
date Tue, 15 Jan 2002 08:33:09 +0000
parents
children 05ac3586db02
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4164
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
1 /*
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
2 This file is based on:
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
3 $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/AsmMacros.h,v 1.1 2001/11/16 21:13:34 tsi Exp $
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
4 Modified for readability by Nick Kurshev
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
5 */
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
6
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
7 #ifndef __ASM_MACROS_X86_H
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
8 #define __ASM_MACROS_X86_H
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
9
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
10 #if defined (WINNT)
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
11 #error This stuff is not ported on your system
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
12 #else
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
13
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
14 static __inline__ void outb(short port,char val)
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
15 {
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
16 __asm__ __volatile__("outb %0,%1" : :"a" (val), "d" (port));
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
17 }
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
18
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
19 static __inline__ void outw(short port,short val)
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
20 {
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
21 __asm__ __volatile__("outw %0,%1" : :"a" (val), "d" (port));
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
22 }
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
23
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
24 static __inline__ void outl(short port,unsigned int val)
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
25 {
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
26 __asm__ __volatile__("outl %0,%1" : :"a" (val), "d" (port));
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
27 }
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
28
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
29 static __inline__ unsigned int inb(short port)
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
30 {
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
31 unsigned char ret;
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
32 __asm__ __volatile__("inb %1,%0" :
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
33 "=a" (ret) :
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
34 "d" (port));
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
35 return ret;
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
36 }
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
37
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
38 static __inline__ unsigned int inw(short port)
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
39 {
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
40 unsigned short ret;
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
41 __asm__ __volatile__("inw %1,%0" :
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
42 "=a" (ret) :
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
43 "d" (port));
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
44 return ret;
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
45 }
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
46
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
47 static __inline__ unsigned int inl(short port)
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
48 {
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
49 unsigned int ret;
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
50 __asm__ __volatile__("inl %1,%0" :
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
51 "=a" (ret) :
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
52 "d" (port));
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
53 return ret;
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
54 }
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
55
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
56 static __inline__ void intr_disable()
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
57 {
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
58 __asm__ __volatile__("cli");
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
59 }
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
60
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
61 static __inline__ void intr_enable()
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
62 {
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
63 __asm__ __volatile__("sti");
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
64 }
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
65
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
66 #endif
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
67
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
68 #endif