L4Re Operating System Framework
Interface and Usage Documentation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 * License: see LICENSE.spdx (in this directory or the directories above)
15 */
16
17#ifndef _L4UTIL_PORT_IO_H
18#define _L4UTIL_PORT_IO_H
19
25/* L4 includes */
26#include <l4/sys/l4int.h>
27#include <l4/sys/compiler.h>
28
29/*****************************************************************************
30 *** Prototypes
31 *****************************************************************************/
32
46
55
64
72L4_INLINE void
74
82L4_INLINE void
84
92L4_INLINE void
94
101L4_INLINE void
103
111L4_INLINE void
113
120L4_INLINE void
122
130L4_INLINE void
132
141L4_INLINE void
143
151L4_INLINE void
153
157L4_INLINE void
158l4util_iodelay(void);
159
163
164
165/*****************************************************************************
166 *** Implementation
167 *****************************************************************************/
168
171{
172 l4_uint8_t value;
173 asm volatile ("inb %w1, %b0" : "=a" (value) : "Nd" (port));
174 return value;
175}
176
179{
180 l4_uint16_t value;
181 asm volatile ("inw %w1, %w0" : "=a" (value) : "Nd" (port));
182 return value;
183}
184
187{
188 l4_uint32_t value;
189 asm volatile ("inl %w1, %0" : "=a" (value) : "Nd" (port));
190 return value;
191}
192
193L4_INLINE void
195{
196 l4_umword_t dummy1, dummy2;
197 asm volatile ("rep insb" : "=D"(dummy1), "=c"(dummy2)
198 : "d" (port), "D" (addr), "c"(count)
199 : "memory");
200}
201
202L4_INLINE void
204{
205 l4_umword_t dummy1, dummy2;
206 asm volatile ("rep insw" : "=D"(dummy1), "=c"(dummy2)
207 : "d" (port), "D" (addr), "c"(count)
208 : "memory");
209}
210
211L4_INLINE void
213{
214 l4_umword_t dummy1, dummy2;
215 asm volatile ("rep insl" : "=D"(dummy1), "=c"(dummy2)
216 : "d" (port), "D" (addr), "c"(count)
217 : "memory");
218}
219
220L4_INLINE void
222{
223 asm volatile ("outb %b0, %w1" : : "a" (value), "Nd" (port));
224}
225
226L4_INLINE void
228{
229 asm volatile ("outw %w0, %w1" : : "a" (value), "Nd" (port));
230}
231
232L4_INLINE void
234{
235 asm volatile ("outl %0, %w1" : : "a" (value), "Nd" (port));
236}
237
238L4_INLINE void
240{
241 l4_umword_t dummy1, dummy2;
242 asm volatile ("rep outsb" : "=S"(dummy1), "=c"(dummy2)
243 : "d" (port), "S" (addr), "c"(count)
244 : "memory");
245}
246
247L4_INLINE void
249{
250 l4_umword_t dummy1, dummy2;
251 asm volatile ("rep outsw" : "=S"(dummy1), "=c"(dummy2)
252 : "d" (port), "S" (addr), "c"(count)
253 : "memory");
254}
255
256L4_INLINE void
258{
259 l4_umword_t dummy1, dummy2;
260 asm volatile ("rep outsl" : "=S"(dummy1), "=c"(dummy2)
261 : "d" (port), "S" (addr), "c"(count)
262 : "memory");
263}
264
265L4_INLINE void
267{
268 asm volatile ("outb %al,$0x80");
269}
270
271#endif
L4 compiler related defines.
unsigned long l4_umword_t
Unsigned machine word.
Definition l4int.h:40
unsigned char l4_uint8_t
Unsigned 8bit value.
Definition l4int.h:25
unsigned int l4_uint32_t
Unsigned 32bit value.
Definition l4int.h:29
unsigned short int l4_uint16_t
Unsigned 16bit value.
Definition l4int.h:27
#define __END_DECLS
End section with C types and functions.
Definition compiler.h:167
#define L4_INLINE
L4 Inline function attribute.
Definition compiler.h:51
#define __BEGIN_DECLS
Start section with C types and functions.
Definition compiler.h:164
l4_uint16_t l4util_in16(l4_uint16_t port)
Read 16-bit-value from I/O port.
Definition port_io.h:178
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:257
void l4util_out32(l4_uint32_t value, l4_uint16_t port)
Write 32-bit-value to I/O port.
Definition port_io.h:233
void l4util_out8(l4_uint8_t value, l4_uint16_t port)
Write byte to I/O port.
Definition port_io.h:221
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:239
void l4util_out16(l4_uint16_t value, l4_uint16_t port)
Write 16-bit-value to I/O port.
Definition port_io.h:227
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:194
l4_uint8_t l4util_in8(l4_uint16_t port)
Read byte from I/O port.
Definition port_io.h:170
l4_uint32_t l4util_in32(l4_uint16_t port)
Read 32-bit-value from I/O port.
Definition port_io.h:186
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:248
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:212
void l4util_iodelay(void)
delay I/O port access by writing to port 0x80
Definition port_io.h:266
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:203