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_API_H
20#define _L4UTIL_PORT_IO_API_H
21
22#include <l4/sys/compiler.h>
23#include <l4/sys/types.h>
24
25#include <x86/l4/util/port_io.h>
26
28
40L4_INLINE int
42 unsigned port_start, unsigned log2size);
43
45
46
47/*****************************************************************************
48 *** Implementation
49 *****************************************************************************/
50
51#include <l4/sys/utcb.h>
52#include <l4/sys/ipc.h>
53
54
55L4_INLINE int
57 unsigned port_start, unsigned log2size)
58{
59 l4_fpage_t iofp;
60 l4_msgtag_t tag;
61 long err;
62
63 iofp = l4_iofpage(port_start, log2size);
64 l4_utcb_mr()->mr[0] = iofp.raw;
65 l4_utcb_br()->bdr = 0;
67 l4_utcb_br()->br[1] = iofp.raw;
68 tag = l4_ipc_call(sigma0id, l4_utcb(),
71
72 if ((err = l4_ipc_error(tag, l4_utcb())))
73 return err;
74
75 return l4_msgtag_items(tag) > 0 ? 0 : -L4_ENOENT;
76}
77
78#endif
79
L4 compiler related defines.
unsigned long l4_cap_idx_t
Capability selector type.
Definition types.h:358
@ L4_ENOENT
No such entity.
Definition err.h:45
l4_fpage_t l4_iofpage(unsigned long port, unsigned int size) L4_NOTHROW
Create an IO-port flex page.
Definition __l4_fpage.h:674
l4_msgtag_t l4_ipc_call(l4_cap_idx_t object, l4_utcb_t *utcb, l4_msgtag_t tag, l4_timeout_t timeout) L4_NOTHROW
Object call (usual invocation).
Definition ipc.h:550
l4_umword_t l4_ipc_error(l4_msgtag_t tag, l4_utcb_t *utcb) L4_NOTHROW
Get the IPC error code for an IPC operation.
Definition ipc.h:619
@ L4_ITEM_MAP
Identify a message item as map item.
Definition consts.h:226
unsigned l4_msgtag_items(l4_msgtag_t t) L4_NOTHROW
Get the number of typed items.
Definition types.h:447
l4_msgtag_t l4_msgtag(long label, unsigned words, unsigned items, unsigned flags) L4_NOTHROW
Create a message tag from the specified values.
Definition types.h:427
@ L4_PROTO_IO_PAGE_FAULT
I/O page fault message.
Definition types.h:61
#define L4_IPC_NEVER
never timeout
Definition __timeout.h:82
l4_msg_regs_t * l4_utcb_mr(void) L4_NOTHROW L4_PURE
Get the message-register block of a UTCB.
Definition utcb.h:352
l4_utcb_t * l4_utcb(void) L4_NOTHROW L4_PURE
Get the UTCB address.
Definition utcb.h:340
l4_buf_regs_t * l4_utcb_br(void) L4_NOTHROW L4_PURE
Get the buffer-register block of a UTCB.
Definition utcb.h:355
#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
Common L4 ABI Data Types.
l4_umword_t br[L4_UTCB_GENERIC_BUFFERS_SIZE]
Buffer registers.
Definition utcb.h:99
l4_umword_t bdr
Buffer descriptor.
Definition utcb.h:96
Message tag data structure.
Definition types.h:163
L4 flexpage type.
Definition __l4_fpage.h:85
l4_umword_t raw
Raw value.
Definition __l4_fpage.h:87
l4_umword_t mr[L4_UTCB_GENERIC_DATA_SIZE]
Message registers.
Definition utcb.h:80
x86 port I/O
int l4util_ioport_map(l4_cap_idx_t sigma0id, unsigned port_start, unsigned log2size)
Map a range of I/O ports.
Definition port_io.h:56