L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
vhw.h
Go to the documentation of this file.
1/*****************************************************************************/
7/*
8 * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
9 * Alexander Warg <warg@os.inf.tu-dresden.de>
10 * economic rights: Technische Universität Dresden (Germany)
11 *
12 * This file is part of TUD:OS and distributed under the terms of the
13 * GNU General Public License 2.
14 * Please see the COPYING-GPL-2 file for details.
15 *
16 * As a special exception, you may use this file as part of a free software
17 * library without restriction. Specifically, if other files instantiate
18 * templates or use macros or inline functions from this file, or you compile
19 * this file and link it with other files to produce an executable, this
20 * file does not by itself cause the resulting executable to be covered by
21 * the GNU General Public License. This exception does not however
22 * invalidate any other reasons why the executable file might be covered by
23 * the GNU General Public License.
24 */
25/*****************************************************************************/
26#ifndef _L4_SYS_VHW_H
27#define _L4_SYS_VHW_H
28
29#include <l4/sys/types.h>
30#include <l4/sys/kip.h>
31
50
65
79
80enum {
81 L4_VHW_MAGIC = 0x56687765,
82};
83
84static inline struct l4_vhw_descriptor *
85l4_vhw_get(l4_kernel_info_t const *kip) L4_NOTHROW
86{
87 struct l4_vhw_descriptor *v
88 = (struct l4_vhw_descriptor *)(((unsigned long)kip) + kip->vhw_offset);
89
90 if (v->magic == L4_VHW_MAGIC)
91 return v;
92
93 return NULL;
94}
95
96static inline struct l4_vhw_entry *
97l4_vhw_get_entry(struct l4_vhw_descriptor *v, int entry) L4_NOTHROW
98{
99 return v->descs + entry;
100}
101
102static inline struct l4_vhw_entry *
103l4_vhw_get_entry_type(struct l4_vhw_descriptor *v, enum l4_vhw_entry_type t) L4_NOTHROW
104{
105 int i;
106 struct l4_vhw_entry *e = v->descs;
107
108 for (i = 0; i < v->count; i++, e++)
109 if (e->type == t)
110 return e;
111
112 return NULL;
113}
114
115#endif /* ! _L4_SYS_VHW_H */
unsigned long l4_addr_t
Address type.
Definition l4int.h:45
unsigned char l4_uint8_t
Unsigned 8bit value.
Definition l4int.h:36
unsigned int l4_uint32_t
Unsigned 32bit value.
Definition l4int.h:40
l4_vhw_entry_type
Type of device.
Definition vhw.h:44
@ L4_TYPE_VHW_NONE
None entry.
Definition vhw.h:45
@ L4_TYPE_VHW_FRAMEBUFFER
Framebuffer device.
Definition vhw.h:46
@ L4_TYPE_VHW_INPUT
Input device.
Definition vhw.h:47
@ L4_TYPE_VHW_NET
Network device.
Definition vhw.h:48
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
Definition compiler.h:188
Common L4 ABI Data Types.
L4 Kernel Interface Page.
Definition __kip-32bit.h:39
Virtual hardware devices description.
Definition vhw.h:70
l4_uint8_t pad2
padding
Definition vhw.h:75
l4_uint8_t version
Version of the descriptor.
Definition vhw.h:72
l4_uint8_t count
Number of entries.
Definition vhw.h:73
struct l4_vhw_entry descs[]
Array of device descriptions.
Definition vhw.h:77
l4_uint8_t pad1
padding
Definition vhw.h:74
l4_uint32_t magic
Magic.
Definition vhw.h:71
Description of a device.
Definition vhw.h:55
l4_addr_t mem_size
Size of memory region.
Definition vhw.h:60
l4_uint32_t fd
File descriptor.
Definition vhw.h:63
l4_uint32_t provider_pid
Host PID of the VHW provider.
Definition vhw.h:57
l4_uint32_t irq_no
IRQ number.
Definition vhw.h:62
l4_addr_t mem_start
Start of memory region.
Definition vhw.h:59
enum l4_vhw_entry_type type
Type of virtual hardware.
Definition vhw.h:56
Kernel Info Page access functions.