]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/libvbus/include/vbus.h
update
[l4.git] / l4 / pkg / libvbus / include / vbus.h
1 /*
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)
6  *
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.
10  */
11 #pragma once
12
13 #include <l4/sys/compiler.h>
14 #include <l4/vbus/vbus_types.h>
15 #include <l4/sys/types.h>
16
17 enum {
18   L4VBUS_NULL = 0,
19   L4VBUS_ROOT_BUS = 0,
20 };
21
22 __BEGIN_DECLS
23
24 /**
25  * \brief Find a device by the HID ACPI conforming or L4Io static name.
26  *
27  * \param  vbus         Capability of the system bus
28  * \param  parent       Handle to the parent to start the search
29  * \retval child        Handle to the found device
30  * \param  hid          HID name of the device
31  * \param  depth        Depth to look for
32  * \retval devinfo      Device information structure (might be NULL)
33  *
34  * \return 0 on succes, else failure
35  */
36 int L4_CV
37 l4vbus_get_device_by_hid(l4_cap_idx_t vbus, l4vbus_device_handle_t parent,
38                          l4vbus_device_handle_t *child, char const *hid,
39                          int depth, l4vbus_device_t *devinfo);
40
41 /**
42  * \brief Find next child following \a child.
43  *
44  * \param  vbus         Capability of the system bus
45  * \param  parent       Handle to the parent device (use 0 for the system bus)
46  * \param  child        Handle to the child device (use 0 to get the first
47  *                      child)
48  * \param  depth        Depth to look for
49  * \retval devinfo      device information (might be NULL)
50  *
51  * \return 0 on succes, else failure
52  */
53 int L4_CV
54 l4vbus_get_next_device(l4_cap_idx_t vbus, l4vbus_device_handle_t parent,
55                        l4vbus_device_handle_t *child, int depth,
56                        l4vbus_device_t *devinfo);
57
58 /**
59  * \brief Iterate over the resources of a device
60  *
61  * \param  vbus         Capability of the system bus
62  * \param  dev          Handle of the device
63  * \retval res_idx      Index of the resource, the number of resources is
64  *                      available in the devinfo from get device functions.
65  * \retval res          Descriptor of the resource
66  *
67  * \return 0 on succes, else failure
68  */
69 int L4_CV
70 l4vbus_get_resource(l4_cap_idx_t vbus, l4vbus_device_handle_t dev,
71                     int res_idx, l4vbus_resource_t *res);
72
73 /**
74  * \brief Request a resource of a specific type
75  *
76  * \param  vbus         Capability of the system bus
77  * \param  res          Descriptor of the resource
78  * \param  flags        Optional flags
79  *
80  * \return 0 on succes, else failure
81  *
82  * If any resource is found that contains the requested
83  * type and addresses this resource is returned.
84  *
85  * Flags are only relevant to control the memory caching.
86  * If io-memory is requested.
87  *
88  * \return 0 on succes, else failure
89  */
90 int L4_CV
91 l4vbus_request_resource(l4_cap_idx_t vbus, l4vbus_resource_t *res,
92                         int flags);
93
94 /**
95  * \brief Release a previously requested resource
96  *
97  * \param  vbus         Capability of the system bus.
98  * \param  res          Descriptor of the resource.
99  *
100  * \return 0 on succes, else failure
101  */
102 int L4_CV
103 l4vbus_release_resource(l4_cap_idx_t vbus, l4vbus_resource_t *res);
104
105 /**
106  * \brief Get capability of ICU.
107  *
108  * \param  vbus         Capability of the system bus.
109  * \param  icu          ICU device handle.
110  * \param  cap          Capability slot for the capability.
111  *
112  * \return 0 on succes, else failure
113  */
114 int L4_CV
115 l4vbus_vicu_get_cap(l4_cap_idx_t vbus, l4vbus_device_handle_t icu,
116                     l4_cap_idx_t cap);
117
118 __END_DECLS