Subversion Repositories shark

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 pj 1
/* Project:     OSLib
2
 * Description: The OS Construction Kit
3
 * Date:                1.6.2000
4
 * Idea by:             Luca Abeni & Gerardo Lamastra
5
 *
6
 * OSLib is an SO project aimed at developing a common, easy-to-use
7
 * low-level infrastructure for developing OS kernels and Embedded
8
 * Applications; it partially derives from the HARTIK project but it
9
 * currently is independently developed.
10
 *
11
 * OSLib is distributed under GPL License, and some of its code has
12
 * been derived from the Linux kernel source; also some important
13
 * ideas come from studying the DJGPP go32 extender.
14
 *
15
 * We acknowledge the Linux Community, Free Software Foundation,
16
 * D.J. Delorie and all the other developers who believe in the
17
 * freedom of software and ideas.
18
 *
19
 * For legalese, check out the included GPL license.
20
 */
21
 
22
/*      The hw I/O instructions
23
        Never include this file!!! Include hw-instr.h instead!!!        */
24
#ifndef __LL_I386_HW_IO_H__
25
#define __LL_I386_HW_IO_H__
26
 
27
#include <ll/i386/defs.h>
28
BEGIN_DEF
29
 
30
 
31
/*
32
    The code for inp, outp, inpw, outpw, inpd & outpd is from
33
    standard GNU C distribution!
34
    The full source code for the GNU-C distribution is available
35
    from www.delorie.com
36
 
37
    The following code is ...
38
    copyright (C) 1995 DJ Delorie, see COPYING.DJ for details
39
*/
40
 
41
INLINE_OP unsigned char inp(unsigned short _port)
42
{
43
    unsigned char rv;
44
    __asm__ __volatile__ ("inb %1, %0"
45
          : "=a" (rv)
46
          : "d" (_port));
47
    return(rv);
48
}
49
 
50
INLINE_OP unsigned short inpw (unsigned short _port)
51
{
52
    unsigned short rv;
53
    __asm__ __volatile__ ("inw %1, %0"
54
          : "=a" (rv)
55
          : "d" (_port));
56
    return(rv);
57
}
58
 
59
INLINE_OP unsigned long inpd(unsigned short _port)
60
{
61
    unsigned long rv;
62
    __asm__ __volatile__ ("inl %1, %0"
63
          : "=a" (rv)
64
          : "d" (_port));
65
    return(rv);
66
}
67
 
68
INLINE_OP void outp(unsigned short _port, unsigned char _data)
69
{
70
    __asm__ __volatile__ ("outb %1, %0"
71
          :
72
          : "d" (_port),
73
            "a" (_data));
74
}
75
 
76
INLINE_OP void outpw(unsigned short _port, unsigned short _data)
77
{
78
    __asm__ __volatile__ ("outw %1, %0"
79
          :
80
          : "d" (_port),
81
            "a" (_data));
82
}
83
 
84
INLINE_OP void outpd(unsigned short _port, unsigned long _data)
85
{
86
    __asm__ __volatile__ ("outl %1, %0"
87
          :
88
          : "d" (_port),
89
            "a" (_data));
90
}
91
 
92
END_DEF
93
 
94
#endif