Last change
on this file was
c5c522c,
checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago
|
initial commit, transferred from cleaned syn3 svn tree
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | /*----------------------------------------------------------------------------- |
---|
2 | * port.h (by damianf@wpi.edu) |
---|
3 | * Low level I/O functions taken from led-stat.txt |
---|
4 | * |
---|
5 | * Jan 22 95 |
---|
6 | * |
---|
7 | * DOS part (tested only with DOS version of GCC, DJGPP) |
---|
8 | * by M.Prinke <m.prinke@trashcan.mcnet.de> 3/97 |
---|
9 | */ |
---|
10 | |
---|
11 | /* #define DOS */ |
---|
12 | |
---|
13 | #ifndef PORT_H |
---|
14 | #define PORT_H |
---|
15 | #endif |
---|
16 | |
---|
17 | #ifndef DOS |
---|
18 | static inline int port_in( int port ) |
---|
19 | { |
---|
20 | unsigned char value; |
---|
21 | __asm__ volatile ("inb %1,%0" |
---|
22 | : "=a" (value) |
---|
23 | : "d" ((unsigned short)port)); |
---|
24 | return value; |
---|
25 | } |
---|
26 | |
---|
27 | static inline void port_out( unsigned short int port, unsigned char val ) |
---|
28 | { |
---|
29 | __asm__ volatile ( |
---|
30 | "outb %0,%1\n" |
---|
31 | : |
---|
32 | : "a" (val), "d" (port) |
---|
33 | ); |
---|
34 | } |
---|
35 | #else |
---|
36 | #include <pc.h> |
---|
37 | |
---|
38 | static inline int port_in( int port ) |
---|
39 | { |
---|
40 | unsigned char value; |
---|
41 | value = inportb((unsigned short) port); |
---|
42 | return (int)value; |
---|
43 | } |
---|
44 | |
---|
45 | static inline void port_out( unsigned int port, unsigned char val ) |
---|
46 | { |
---|
47 | outportb((unsigned short) port, val); |
---|
48 | } |
---|
49 | #endif |
---|
50 | |
---|
51 | /**** END OF FILE ****/ |
---|
Note: See
TracBrowser
for help on using the repository browser.