1 /*****************************************************************************/
4 * \brief Descriptors for virtual hardware (under UX).
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)
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.
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.
25 /*****************************************************************************/
29 #include <l4/sys/types.h>
30 #include <l4/sys/kip.h>
33 * \defgroup l4_kip_vhw_api Fiasco-UX Virtual devices
35 * \brief Virtual hardware devices, provided by Fiasco-UX.
37 * <c>\#include <l4/sys/vhw.h></c>
41 * \brief Type of device.
42 * \ingroup l4_kip_vhw_api
44 enum l4_vhw_entry_type {
45 L4_TYPE_VHW_NONE, /**< None entry. */
46 L4_TYPE_VHW_FRAMEBUFFER, /**< Framebuffer device. */
47 L4_TYPE_VHW_INPUT, /**< Input device. */
48 L4_TYPE_VHW_NET, /**< Network device. */
52 * \brief Description of a device.
53 * \ingroup l4_kip_vhw_api
56 enum l4_vhw_entry_type type; /**< Type of virtual hardware. */
57 l4_uint32_t provider_pid; /**< Host PID of the VHW provider. */
59 l4_addr_t mem_start; /**< Start of memory region. */
60 l4_addr_t mem_size; /**< Size of memory region. */
62 l4_uint32_t irq_no; /**< IRQ number. */
63 l4_uint32_t fd; /**< File descriptor. */
67 * \brief Virtual hardware devices description.
68 * \ingroup l4_kip_vhw_api
70 struct l4_vhw_descriptor {
71 l4_uint32_t magic; /**< Magic. */
72 l4_uint8_t version; /**< Version of the descriptor. */
73 l4_uint8_t count; /**< Number of entries. */
74 l4_uint8_t pad1; /**< padding \internal. */
75 l4_uint8_t pad2; /**< padding \internal. */
77 struct l4_vhw_entry descs[]; /**< Array of device descriptions. */
81 L4_VHW_MAGIC = 0x56687765,
84 static inline struct l4_vhw_descriptor *
85 l4_vhw_get(l4_kernel_info_t *kip) L4_NOTHROW
87 struct l4_vhw_descriptor *v
88 = (struct l4_vhw_descriptor *)(((unsigned long)kip) + kip->vhw_offset);
90 if (v->magic == L4_VHW_MAGIC)
96 static inline struct l4_vhw_entry *
97 l4_vhw_get_entry(struct l4_vhw_descriptor *v, int entry) L4_NOTHROW
99 return v->descs + entry;
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
106 struct l4_vhw_entry *e = v->descs;
108 for (i = 0; i < v->count; i++, e++)
115 #endif /* ! _L4_SYS_VHW_H */