2 * (c) 2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
3 * Alexander Warg <warg@os.inf.tu-dresden.de>,
4 * Torsten Frenzel <frenzel@os.inf.tu-dresden.de>
5 * economic rights: Technische Universität Dresden (Germany)
7 * This file is part of TUD:OS and distributed under the terms of the
8 * GNU General Public License 2.
9 * Please see the COPYING-GPL-2 file for details.
13 #include <l4/sys/compiler.h>
14 #include <l4/vbus/vbus_types.h>
15 #include <l4/sys/types.h>
23 * \defgroup l4vbus_module L4 V-BUS functions
30 * \brief Find a device by the HID ACPI conforming or L4Io static name.
32 * \param vbus Capability of the system bus
33 * \param parent Handle to the parent to start the search
34 * \retval child Handle to the found device
35 * \param hid HID name of the device
36 * \param depth Depth to look for
37 * \retval devinfo Device information structure (might be NULL)
39 * \return 0 on success, else failure
42 l4vbus_get_device_by_hid(l4_cap_idx_t vbus, l4vbus_device_handle_t parent,
43 l4vbus_device_handle_t *child, char const *hid,
44 int depth, l4vbus_device_t *devinfo);
47 * \brief Find next child following \a child.
49 * \param vbus Capability of the system bus
50 * \param parent Handle to the parent device (use 0 for the system bus)
51 * \param child Handle to the child device (use 0 to get the first
53 * \param depth Depth to look for
54 * \retval devinfo device information (might be NULL)
56 * \return 0 on success, else failure
59 l4vbus_get_next_device(l4_cap_idx_t vbus, l4vbus_device_handle_t parent,
60 l4vbus_device_handle_t *child, int depth,
61 l4vbus_device_t *devinfo);
64 * \brief Iterate over the resources of a device
66 * \param vbus Capability of the system bus
67 * \param dev Handle of the device
68 * \retval res_idx Index of the resource, the number of resources is
69 * available in the devinfo from get device functions.
70 * \retval res Descriptor of the resource
72 * \return 0 on success, else failure
75 l4vbus_get_resource(l4_cap_idx_t vbus, l4vbus_device_handle_t dev,
76 int res_idx, l4vbus_resource_t *res);
80 * \brief Check if the given device has a compatibility ID (CID) or HID that
83 * \param vbus V-BUS capability
84 * \param dev device handle for which the CID shall be tested
85 * \param cid the compatibility ID to test
86 * \return 1 when the given ID (\a cid) matches the given device (\a dev),
87 * 0 when the given ID does not match,
91 l4vbus_is_compatible(l4_cap_idx_t vbus, l4vbus_device_handle_t dev,
95 * \brief Get the HID (hardware identifier) if a device
97 * \param vbus Capability of the system bus
98 * \param dev Handle of the device
99 * \param hid Pointer to a buffer for the HID string
100 * \param max_len The size of the buffer (\a hid)
102 * \return the length of the HID string on success, else failure
105 l4vbus_get_hid(l4_cap_idx_t vbus, l4vbus_device_handle_t dev, char *hid,
106 unsigned long max_len);
109 * \brief Request a resource of a specific type
111 * \param vbus Capability of the system bus
112 * \param res Descriptor of the resource
113 * \param flags Optional flags
115 * \return 0 on success, else failure
117 * If any resource is found that contains the requested
118 * type and addresses this resource is returned.
120 * Flags are only relevant to control the memory caching.
121 * If io-memory is requested.
123 * \return 0 on success, else failure
126 l4vbus_request_resource(l4_cap_idx_t vbus, l4vbus_resource_t *res,
130 * \brief Release a previously requested resource
132 * \param vbus Capability of the system bus.
133 * \param res Descriptor of the resource.
135 * \return 0 on success, else failure
138 l4vbus_release_resource(l4_cap_idx_t vbus, l4vbus_resource_t *res);
141 * \brief Get capability of ICU.
143 * \param vbus Capability of the system bus.
144 * \param icu ICU device handle.
145 * \param cap Capability slot for the capability.
147 * \return 0 on success, else failure
150 l4vbus_vicu_get_cap(l4_cap_idx_t vbus, l4vbus_device_handle_t icu,