L4Re - L4 Runtime Environment
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 
49 };
50 
55 struct l4_vhw_entry {
64 };
65 
77  struct l4_vhw_entry descs[];
78 };
79 
80 enum {
81  L4_VHW_MAGIC = 0x56687765,
82 };
83 
84 static inline struct l4_vhw_descriptor *
85 l4_vhw_get(l4_kernel_info_t *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 
96 static inline struct l4_vhw_entry *
97 l4_vhw_get_entry(struct l4_vhw_descriptor *v, int entry) L4_NOTHROW
98 {
99  return v->descs + entry;
100 }
101 
102 static inline struct l4_vhw_entry *
103 l4_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 */
l4_uint8_t pad1
padding
Definition: vhw.h:74
Input device.
Definition: vhw.h:47
Network device.
Definition: vhw.h:48
l4_uint32_t magic
Magic.
Definition: vhw.h:71
enum l4_vhw_entry_type type
Type of virtual hardware.
Definition: vhw.h:56
Common L4 ABI Data Types.
Framebuffer device.
Definition: vhw.h:46
l4_addr_t mem_start
Start of memory region.
Definition: vhw.h:59
l4_uint8_t count
Number of entries.
Definition: vhw.h:73
Description of a device.
Definition: vhw.h:55
L4 Kernel Interface Page.
Definition: __kip-32bit.h:38
Virtual hardware devices description.
Definition: vhw.h:70
Kernel Info Page access functions.
None entry.
Definition: vhw.h:45
l4_uint8_t pad2
padding
Definition: vhw.h:75
l4_uint8_t version
Version of the descriptor.
Definition: vhw.h:72
struct l4_vhw_entry descs[]
Array of device descriptions.
Definition: vhw.h:77
l4_uint32_t fd
File descriptor.
Definition: vhw.h:63
unsigned char l4_uint8_t
Unsigned 8bit value.
Definition: l4int.h:36
l4_uint32_t irq_no
IRQ number.
Definition: vhw.h:62
unsigned long l4_addr_t
Address type.
Definition: l4int.h:45
l4_addr_t mem_size
Size of memory region.
Definition: vhw.h:60
l4_uint32_t provider_pid
Host PID of the VHW provider.
Definition: vhw.h:57
unsigned int l4_uint32_t
Unsigned 32bit value.
Definition: l4int.h:40
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
Definition: compiler.h:185
l4_vhw_entry_type
Type of device.
Definition: vhw.h:44