1 | /* |
---|
2 | ///////////////////////////////////////////////////////////////////////////// |
---|
3 | // $Header$ |
---|
4 | // |
---|
5 | // Copyright (c) 2000 - Rosimildo da Silva. All Rights Reserved. |
---|
6 | // |
---|
7 | // MODULE DESCRIPTION: |
---|
8 | // |
---|
9 | // IO Functions for the PC platform equivalent to DOS/Linux. They make |
---|
10 | // eaiser the porting of code from these platforms. |
---|
11 | // |
---|
12 | // by: Rosimildo da Silva: rdasilva@connecttel.com |
---|
13 | // |
---|
14 | // MODIFICATION/HISTORY: |
---|
15 | // $Log$ |
---|
16 | // Revision 1.2 2004/04/15 13:26:12 ralf |
---|
17 | // Remove stray white spaces. |
---|
18 | // |
---|
19 | // Revision 1.1 2000/08/30 08:18:56 joel |
---|
20 | // 2000-08-26 Rosimildo da Silva <rdasilva@connecttel.com> |
---|
21 | // |
---|
22 | // * shared/comm: Added "/dev/ttyS1" & "/dev/ttyS2" support for |
---|
23 | // the i386 BSPs. |
---|
24 | // * shared/comm/gdb_glue.c: New file. |
---|
25 | // * shared/comm/i386_io.c: New file. |
---|
26 | // * shared/comm/tty_drv.c: New file. |
---|
27 | // * shared/comm/tty_drv.h: New file. |
---|
28 | // * shared/comm/Makefile.am: Account for new files. |
---|
29 | // * shared/comm/uart.c: Adds support for sending characters to |
---|
30 | // another "line discipline." |
---|
31 | // |
---|
32 | // |
---|
33 | ///////////////////////////////////////////////////////////////////////////// |
---|
34 | */ |
---|
35 | |
---|
36 | #ifndef i386_io_h__ |
---|
37 | #define i386_io_h__ |
---|
38 | |
---|
39 | #define rtems_inb(port) \ |
---|
40 | ({ \ |
---|
41 | register int _inb_result; \ |
---|
42 | \ |
---|
43 | asm volatile ("xorl %%eax,%%eax; inb %%dx,%%al" : \ |
---|
44 | "=a" (_inb_result) : "d" (port)); \ |
---|
45 | _inb_result; \ |
---|
46 | }) |
---|
47 | |
---|
48 | #define rtems_inw(port) \ |
---|
49 | ({ \ |
---|
50 | register int _inbw_result; \ |
---|
51 | \ |
---|
52 | asm volatile ("xorl %%eax,%%eax; inw %%dx,%%ax" : \ |
---|
53 | "=a" (_inbw_result) : "d" (port)); \ |
---|
54 | _inbw_result; \ |
---|
55 | }) |
---|
56 | |
---|
57 | #define rtems_outb(port, data) \ |
---|
58 | asm volatile ("outb %%al,%%dx" : : "a" (data), "d" (port)) |
---|
59 | |
---|
60 | #define rtems_outw(port, data) \ |
---|
61 | asm volatile ("outw %%ax,%%dx" : : "a" (data), "d" (port)) |
---|
62 | |
---|
63 | #define outp(port, val) rtems_outb(port,val) |
---|
64 | #define inp(port) rtems_inb(port) |
---|
65 | |
---|
66 | #define outb(val, port) rtems_outb(port,val) |
---|
67 | #define inb(port) rtems_inb(port) |
---|
68 | |
---|
69 | #define outb_p(val, port) rtems_outb(port,val) |
---|
70 | #define inb_p(port) rtems_inb(port) |
---|
71 | |
---|
72 | #define outportb(port,val) rtems_outb(port,val) |
---|
73 | #define inportb(port) rtems_inb(port) |
---|
74 | |
---|
75 | #define outw(val, port) rtems_outw(port,val) |
---|
76 | #define inw(port) rtems_inw(port) |
---|
77 | |
---|
78 | #define cli() __asm__ __volatile__("cli") |
---|
79 | #define sti() __asm__ __volatile__("sti"); |
---|
80 | |
---|
81 | #endif /* i386_io_h__ */ |
---|