POK(kernelpart)
ioports.h
Go to the documentation of this file.
1 /*
2  * POK header
3  *
4  * The following file is a part of the POK project. Any modification should
5  * made according to the POK licence. You CANNOT use this file or a part of
6  * this file is this part of a file for your own project
7  *
8  * For more information on the POK licence, please see our LICENCE FILE
9  *
10  * Please follow the coding guidelines described in doc/CODING_GUIDELINES
11  *
12  * Copyright (c) 2007-2009 POK team
13  *
14  * Created by julien on Thu Jan 15 23:34:13 2009
15  */
16 
17 
18 #ifndef __POK_IOPORTS_H__
19 #define __POK_IOPORTS_H__
20 
21 # include <core/syscall.h>
22 
23 #define outb(port, data) \
24  asm volatile ("outb %b0,%w1" \
25  : \
26  :"a" (data),"d" (port))
27 
28 #define inb(port) \
29 ({ \
30  unsigned char res; \
31  asm volatile ("inb %w1,%0" \
32  :"=a" (res) \
33  :"d" (port)); \
34  res; \
35 })
36 
37 #define outl(port, data) \
38  asm volatile ("outl %0,%w1" \
39  : \
40  :"a" (data),"d" (port))
41 
42 #define inl(port) \
43 ({ \
44  unsigned int res; \
45  asm volatile ("inl %w1,%0" \
46  :"=a" (res) \
47  :"d" (port)); \
48  res; \
49 })
50 
51 #endif /* __POK_IOPORTS_H__ */