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
44
enum
l4_vhw_entry_type
{
45
L4_TYPE_VHW_NONE
,
46
L4_TYPE_VHW_FRAMEBUFFER
,
47
L4_TYPE_VHW_INPUT
,
48
L4_TYPE_VHW_NET
,
49
};
50
55
struct
l4_vhw_entry
{
56
enum
l4_vhw_entry_type
type
;
57
l4_uint32_t
provider_pid
;
59
l4_addr_t
mem_start
;
60
l4_addr_t
mem_size
;
62
l4_uint32_t
irq_no
;
63
l4_uint32_t
fd
;
64
};
65
70
struct
l4_vhw_descriptor
{
71
l4_uint32_t
magic
;
72
l4_uint8_t
version
;
73
l4_uint8_t
count
;
74
l4_uint8_t
pad1
;
75
l4_uint8_t
pad2
;
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
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
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_addr_t
unsigned long l4_addr_t
Address type.
Definition
l4int.h:45
l4_uint8_t
unsigned char l4_uint8_t
Unsigned 8bit value.
Definition
l4int.h:36
l4_uint32_t
unsigned int l4_uint32_t
Unsigned 32bit value.
Definition
l4int.h:40
l4_vhw_entry_type
l4_vhw_entry_type
Type of device.
Definition
vhw.h:44
L4_TYPE_VHW_NONE
@ L4_TYPE_VHW_NONE
None entry.
Definition
vhw.h:45
L4_TYPE_VHW_FRAMEBUFFER
@ L4_TYPE_VHW_FRAMEBUFFER
Framebuffer device.
Definition
vhw.h:46
L4_TYPE_VHW_INPUT
@ L4_TYPE_VHW_INPUT
Input device.
Definition
vhw.h:47
L4_TYPE_VHW_NET
@ L4_TYPE_VHW_NET
Network device.
Definition
vhw.h:48
L4_NOTHROW
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
Definition
compiler.h:188
types.h
Common L4 ABI Data Types.
l4_kernel_info_t
L4 Kernel Interface Page.
Definition
__kip-32bit.h:39
l4_vhw_descriptor
Virtual hardware devices description.
Definition
vhw.h:70
l4_vhw_descriptor::pad2
l4_uint8_t pad2
padding
Definition
vhw.h:75
l4_vhw_descriptor::version
l4_uint8_t version
Version of the descriptor.
Definition
vhw.h:72
l4_vhw_descriptor::count
l4_uint8_t count
Number of entries.
Definition
vhw.h:73
l4_vhw_descriptor::descs
struct l4_vhw_entry descs[]
Array of device descriptions.
Definition
vhw.h:77
l4_vhw_descriptor::pad1
l4_uint8_t pad1
padding
Definition
vhw.h:74
l4_vhw_descriptor::magic
l4_uint32_t magic
Magic.
Definition
vhw.h:71
l4_vhw_entry
Description of a device.
Definition
vhw.h:55
l4_vhw_entry::mem_size
l4_addr_t mem_size
Size of memory region.
Definition
vhw.h:60
l4_vhw_entry::fd
l4_uint32_t fd
File descriptor.
Definition
vhw.h:63
l4_vhw_entry::provider_pid
l4_uint32_t provider_pid
Host PID of the VHW provider.
Definition
vhw.h:57
l4_vhw_entry::irq_no
l4_uint32_t irq_no
IRQ number.
Definition
vhw.h:62
l4_vhw_entry::mem_start
l4_addr_t mem_start
Start of memory region.
Definition
vhw.h:59
l4_vhw_entry::type
enum l4_vhw_entry_type type
Type of virtual hardware.
Definition
vhw.h:56
kip.h
Kernel Info Page access functions.
l4
sys
vhw.h
Generated on Sat Aug 24 2024 16:07:22 for L4Re Operating System Framework by
1.9.8