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