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_API_H
18#define _L4UTIL_PORT_IO_API_H
19
20#include <l4/sys/compiler.h>
21#include <l4/sys/types.h>
22
23#include <x86/l4/util/port_io.h>
24
26
38L4_INLINE int
40 unsigned port_start, unsigned log2size);
41
43
44
45/*****************************************************************************
46 *** Implementation
47 *****************************************************************************/
48
49#include <l4/sys/utcb.h>
50#include <l4/sys/ipc.h>
51
52
53L4_INLINE int
55 unsigned port_start, unsigned log2size)
56{
57 l4_fpage_t iofp;
58 l4_msgtag_t tag;
59 long err;
60
61 iofp = l4_iofpage(port_start, log2size);
62 l4_utcb_mr()->mr[0] = iofp.raw;
63 l4_utcb_br()->bdr = 0;
65 l4_utcb_br()->br[1] = iofp.raw;
66 tag = l4_ipc_call(sigma0id, l4_utcb(),
69
70 if ((err = l4_ipc_error(tag, l4_utcb())))
71 return err;
72
73 return l4_msgtag_items(tag) > 0 ? 0 : -L4_ENOENT;
74}
75
76#endif
77
L4 compiler related defines.
unsigned long l4_cap_idx_t
Capability selector type.
Definition types.h:335
@ L4_ENOENT
No such entity.
Definition err.h:34
l4_fpage_t l4_iofpage(unsigned long port, unsigned int order) L4_NOTHROW
Create an IO-port flexpage.
Definition __l4_fpage.h:690
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:565
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:629
@ L4_ITEM_MAP
Identify a message item as map item.
Definition consts.h:218
unsigned l4_msgtag_items(l4_msgtag_t t) L4_NOTHROW
Get the number of typed items.
Definition types.h:430
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:404
@ L4_PROTO_IO_PAGE_FAULT
I/O page fault message.
Definition types.h:50
#define L4_IPC_NEVER
never timeout
Definition __timeout.h:76
l4_msg_regs_t * l4_utcb_mr(void) L4_NOTHROW L4_PURE
Get the message-register block of a UTCB.
Definition utcb.h:358
l4_utcb_t * l4_utcb(void) L4_NOTHROW L4_PURE
Get the UTCB address.
Definition utcb.h:346
l4_buf_regs_t * l4_utcb_br(void) L4_NOTHROW L4_PURE
Get the buffer-register block of a UTCB.
Definition utcb.h:361
#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
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:54
Common L4 ABI Data Types.
l4_umword_t br[L4_UTCB_GENERIC_BUFFERS_SIZE]
Buffer registers.
Definition utcb.h:88
l4_umword_t bdr
Buffer descriptor.
Definition utcb.h:85
Message tag data structure.
Definition types.h:153
L4 flexpage type.
Definition __l4_fpage.h:76
l4_umword_t raw
Raw value.
Definition __l4_fpage.h:78
l4_umword_t mr[L4_UTCB_GENERIC_DATA_SIZE]
Message registers.
Definition utcb.h:69
x86 port I/O