L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
port_io.h
Go to the documentation of this file.
1/*****************************************************************************/
9/*****************************************************************************/
10
11/*
12 * (c) 2003-2009 Author(s)
13 * economic rights: Technische Universität Dresden (Germany)
14 * This file is part of TUD:OS and distributed under the terms of the
15 * GNU Lesser General Public License 2.1.
16 * Please see the COPYING-LGPL-2.1 file for details.
17 */
18
19#ifndef _L4UTIL_PORT_IO_H
20#define _L4UTIL_PORT_IO_H
21
27/* L4 includes */
28#include <l4/sys/l4int.h>
29#include <l4/sys/compiler.h>
30
31/*****************************************************************************
32 *** Prototypes
33 *****************************************************************************/
34
48
57
66
74L4_INLINE void
76
84L4_INLINE void
86
94L4_INLINE void
96
103L4_INLINE void
105
113L4_INLINE void
115
122L4_INLINE void
124
132L4_INLINE void
134
143L4_INLINE void
145
153L4_INLINE void
155
159L4_INLINE void
160l4util_iodelay(void);
161
165
166
167/*****************************************************************************
168 *** Implementation
169 *****************************************************************************/
170
173{
174 l4_uint8_t value;
175 asm volatile ("inb %w1, %b0" : "=a" (value) : "Nd" (port));
176 return value;
177}
178
181{
182 l4_uint16_t value;
183 asm volatile ("inw %w1, %w0" : "=a" (value) : "Nd" (port));
184 return value;
185}
186
189{
190 l4_uint32_t value;
191 asm volatile ("inl %w1, %0" : "=a" (value) : "Nd" (port));
192 return value;
193}
194
195L4_INLINE void
197{
198 l4_umword_t dummy1, dummy2;
199 asm volatile ("rep insb" : "=D"(dummy1), "=c"(dummy2)
200 : "d" (port), "D" (addr), "c"(count)
201 : "memory");
202}
203
204L4_INLINE void
206{
207 l4_umword_t dummy1, dummy2;
208 asm volatile ("rep insw" : "=D"(dummy1), "=c"(dummy2)
209 : "d" (port), "D" (addr), "c"(count)
210 : "memory");
211}
212
213L4_INLINE void
215{
216 l4_umword_t dummy1, dummy2;
217 asm volatile ("rep insl" : "=D"(dummy1), "=c"(dummy2)
218 : "d" (port), "D" (addr), "c"(count)
219 : "memory");
220}
221
222L4_INLINE void
224{
225 asm volatile ("outb %b0, %w1" : : "a" (value), "Nd" (port));
226}
227
228L4_INLINE void
230{
231 asm volatile ("outw %w0, %w1" : : "a" (value), "Nd" (port));
232}
233
234L4_INLINE void
236{
237 asm volatile ("outl %0, %w1" : : "a" (value), "Nd" (port));
238}
239
240L4_INLINE void
242{
243 l4_umword_t dummy1, dummy2;
244 asm volatile ("rep outsb" : "=S"(dummy1), "=c"(dummy2)
245 : "d" (port), "S" (addr), "c"(count)
246 : "memory");
247}
248
249L4_INLINE void
251{
252 l4_umword_t dummy1, dummy2;
253 asm volatile ("rep outsw" : "=S"(dummy1), "=c"(dummy2)
254 : "d" (port), "S" (addr), "c"(count)
255 : "memory");
256}
257
258L4_INLINE void
260{
261 l4_umword_t dummy1, dummy2;
262 asm volatile ("rep outsl" : "=S"(dummy1), "=c"(dummy2)
263 : "d" (port), "S" (addr), "c"(count)
264 : "memory");
265}
266
267L4_INLINE void
269{
270 asm volatile ("outb %al,$0x80");
271}
272
273#endif
L4 compiler related defines.
unsigned long l4_umword_t
Unsigned machine word.
Definition l4int.h:51
unsigned char l4_uint8_t
Unsigned 8bit value.
Definition l4int.h:36
unsigned int l4_uint32_t
Unsigned 32bit value.
Definition l4int.h:40
unsigned short int l4_uint16_t
Unsigned 16bit value.
Definition l4int.h:38
#define L4_INLINE
L4 Inline function attribute.
Definition compiler.h:62
#define EXTERN_C_BEGIN
Start section with C types and functions.
Definition compiler.h:192
#define EXTERN_C_END
End section with C types and functions.
Definition compiler.h:193
l4_uint16_t l4util_in16(l4_uint16_t port)
Read 16-bit-value from I/O port.
Definition port_io.h:180
void l4util_outs32(l4_uint16_t port, l4_umword_t addr, l4_umword_t count)
Write block of 32-bit-values to I/O port.
Definition port_io.h:259
void l4util_out32(l4_uint32_t value, l4_uint16_t port)
Write 32-bit-value to I/O port.
Definition port_io.h:235
void l4util_out8(l4_uint8_t value, l4_uint16_t port)
Write byte to I/O port.
Definition port_io.h:223
void l4util_outs8(l4_uint16_t port, l4_umword_t addr, l4_umword_t count)
Write a block of bytes to I/O port.
Definition port_io.h:241
void l4util_out16(l4_uint16_t value, l4_uint16_t port)
Write 16-bit-value to I/O port.
Definition port_io.h:229
void l4util_ins8(l4_uint16_t port, l4_umword_t addr, l4_umword_t count)
Read a block of 8-bit-values from I/O ports.
Definition port_io.h:196
l4_uint8_t l4util_in8(l4_uint16_t port)
Read byte from I/O port.
Definition port_io.h:172
l4_uint32_t l4util_in32(l4_uint16_t port)
Read 32-bit-value from I/O port.
Definition port_io.h:188
void l4util_outs16(l4_uint16_t port, l4_umword_t addr, l4_umword_t count)
Write a block of 16-bit-values to I/O port.
Definition port_io.h:250
void l4util_ins32(l4_uint16_t port, l4_umword_t addr, l4_umword_t count)
Read a block of 32-bit-values from I/O ports.
Definition port_io.h:214
void l4util_iodelay(void)
delay I/O port access by writing to port 0x80
Definition port_io.h:268
void l4util_ins16(l4_uint16_t port, l4_umword_t addr, l4_umword_t count)
Read a block of 16-bit-values from I/O ports.
Definition port_io.h:205