14 #define PORT2ADDR(port) _port2addr(port)
16 static inline void *_port2addr(
unsigned long port)
21 static inline void *_port2addr_ne(
unsigned long port)
26 static inline void delay(
void)
28 __asm__ __volatile__ (
"push r0; \n\t pop r0;" : : :
"memory");
35 #define PORT2ADDR_NE(port) _port2addr_ne(port)
37 static inline unsigned char _ne_inb(
void *portp)
39 return *(
volatile unsigned char *)(portp+1);
42 static inline unsigned short _ne_inw(
void *portp)
46 tmp = *(
unsigned short *)(portp) & 0xff;
47 tmp |= *(
unsigned short *)(portp+2) << 8;
51 static inline void _ne_insb(
void *portp,
void *
addr,
unsigned long count)
55 *buf++ = *(
volatile unsigned char *)(portp+1);
58 static inline void _ne_outb(
unsigned char b,
void *portp)
60 *(
volatile unsigned char *)(portp+1) =
b;
63 static inline void _ne_outw(
unsigned short w,
void *portp)
65 *(
volatile unsigned short *)portp = (w >> 8);
66 *(
volatile unsigned short *)(portp+2) = (w & 0xff);
69 unsigned char _inb(
unsigned long port)
71 if (port >= 0x300 && port < 0x320)
74 return *(
volatile unsigned char *)
PORT2ADDR(port);
77 unsigned short _inw(
unsigned long port)
79 if (port >= 0x300 && port < 0x320)
82 return *(
volatile unsigned short *)
PORT2ADDR(port);
85 unsigned long _inl(
unsigned long port)
87 return *(
volatile unsigned long *)
PORT2ADDR(port);
90 unsigned char _inb_p(
unsigned long port)
92 unsigned char v =
_inb(port);
97 unsigned short _inw_p(
unsigned long port)
99 unsigned short v =
_inw(port);
106 unsigned long v =
_inl(port);
111 void _outb(
unsigned char b,
unsigned long port)
113 if (port >= 0x300 && port < 0x320)
116 *(
volatile unsigned char *)
PORT2ADDR(port) =
b;
119 void _outw(
unsigned short w,
unsigned long port)
121 if (port >= 0x300 && port < 0x320)
124 *(
volatile unsigned short *)
PORT2ADDR(port) =
w;
127 void _outl(
unsigned long l,
unsigned long port)
129 *(
volatile unsigned long *)
PORT2ADDR(port) =
l;
132 void _outb_p(
unsigned char b,
unsigned long port)
138 void _outw_p(
unsigned short w,
unsigned long port)
150 void _insb(
unsigned int port,
void *addr,
unsigned long count)
152 if (port >= 0x300 && port < 0x320)
155 unsigned char *buf =
addr;
158 *buf++ = *(
volatile unsigned char *)portp;
162 void _insw(
unsigned int port,
void *addr,
unsigned long count)
164 unsigned short *buf =
addr;
165 unsigned short *portp;
167 if (port >= 0x300 && port < 0x320) {
170 *buf++ = _ne_inw(portp);
174 *buf++ = *(
volatile unsigned short *)portp;
178 void _insl(
unsigned int port,
void *addr,
unsigned long count)
180 unsigned long *buf =
addr;
181 unsigned long *portp;
185 *buf++ = *(
volatile unsigned long *)portp;
188 void _outsb(
unsigned int port,
const void *addr,
unsigned long count)
190 const unsigned char *buf =
addr;
191 unsigned char *portp;
193 if (port >= 0x300 && port < 0x320) {
196 _ne_outb(*buf++, portp);
200 *(
volatile unsigned char *)portp = *buf++;
204 void _outsw(
unsigned int port,
const void *addr,
unsigned long count)
206 const unsigned short *buf =
addr;
207 unsigned short *portp;
209 if (port >= 0x300 && port < 0x320) {
212 _ne_outw(*buf++, portp);
216 *(
volatile unsigned short *)portp = *buf++;
220 void _outsl(
unsigned int port,
const void *addr,
unsigned long count)
222 const unsigned long *buf =
addr;
223 unsigned char *portp;
227 *(
volatile unsigned long *)portp = *buf++;