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
110L4_INLINE void
112
119L4_INLINE void
121
129L4_INLINE void
131
139L4_INLINE void
141
149L4_INLINE void
151
155L4_INLINE void
156l4util_iodelay(void);
157
161
162
163/*****************************************************************************
164 *** Implementation
165 *****************************************************************************/
166
169{
170 l4_uint8_t value;
171 asm volatile ("inb %w1, %b0" : "=a" (value) : "Nd" (port));
172 return value;
173}
174
177{
178 l4_uint16_t value;
179 asm volatile ("inw %w1, %w0" : "=a" (value) : "Nd" (port));
180 return value;
181}
182
185{
186 l4_uint32_t value;
187 asm volatile ("inl %w1, %0" : "=a" (value) : "Nd" (port));
188 return value;
189}
190
191L4_INLINE void
193{
194 l4_umword_t dummy1, dummy2;
195 asm volatile ("rep insb" : "=D"(dummy1), "=c"(dummy2)
196 : "d" (port), "D" (addr), "c"(count)
197 : "memory");
198}
199
200L4_INLINE void
202{
203 l4_umword_t dummy1, dummy2;
204 asm volatile ("rep insw" : "=D"(dummy1), "=c"(dummy2)
205 : "d" (port), "D" (addr), "c"(count)
206 : "memory");
207}
208
209L4_INLINE void
211{
212 l4_umword_t dummy1, dummy2;
213 asm volatile ("rep insl" : "=D"(dummy1), "=c"(dummy2)
214 : "d" (port), "D" (addr), "c"(count)
215 : "memory");
216}
217
218L4_INLINE void
220{
221 asm volatile ("outb %b0, %w1" : : "a" (value), "Nd" (port));
222}
223
224L4_INLINE void
226{
227 asm volatile ("outw %w0, %w1" : : "a" (value), "Nd" (port));
228}
229
230L4_INLINE void
232{
233 asm volatile ("outl %0, %w1" : : "a" (value), "Nd" (port));
234}
235
236L4_INLINE void
238{
239 l4_umword_t dummy1, dummy2;
240 asm volatile ("rep outsb" : "=S"(dummy1), "=c"(dummy2)
241 : "d" (port), "S" (addr), "c"(count)
242 : "memory");
243}
244
245L4_INLINE void
247{
248 l4_umword_t dummy1, dummy2;
249 asm volatile ("rep outsw" : "=S"(dummy1), "=c"(dummy2)
250 : "d" (port), "S" (addr), "c"(count)
251 : "memory");
252}
253
254L4_INLINE void
256{
257 l4_umword_t dummy1, dummy2;
258 asm volatile ("rep outsl" : "=S"(dummy1), "=c"(dummy2)
259 : "d" (port), "S" (addr), "c"(count)
260 : "memory");
261}
262
263L4_INLINE void
265{
266 asm volatile ("outb %al,$0x80");
267}
268
269#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:176
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:255
void l4util_out32(l4_uint32_t value, l4_uint16_t port)
Write 32-bit-value to I/O port.
Definition port_io.h:231
void l4util_out8(l4_uint8_t value, l4_uint16_t port)
Write byte to I/O port.
Definition port_io.h:219
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:237
void l4util_out16(l4_uint16_t value, l4_uint16_t port)
Write 16-bit-value to I/O port.
Definition port_io.h:225
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:192
l4_uint8_t l4util_in8(l4_uint16_t port)
Read byte from I/O port.
Definition port_io.h:168
l4_uint32_t l4util_in32(l4_uint16_t port)
Read 32-bit-value from I/O port.
Definition port_io.h:184
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:246
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:210
void l4util_iodelay(void)
delay I/O port access by writing to port 0x80
Definition port_io.h:264
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:201