L4Re - L4 Runtime Environment
io.h
Go to the documentation of this file.
1 
4 /*
5  * (c) 2008-2010 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
6  * Alexander Warg <warg@os.inf.tu-dresden.de>
7  * economic rights: Technische Universit├Ąt Dresden (Germany)
8  * This file is part of TUD:OS and distributed under the terms of the
9  * GNU Lesser General Public License 2.1.
10  * Please see the COPYING-LGPL-2.1 file for details.
11  */
12 
13 
14 #pragma once
15 
16 #include <l4/sys/types.h>
17 #include <l4/sys/linkage.h>
18 #include <l4/io/types.h>
19 
21 
38 L4_CV long L4_EXPORT
39 l4io_request_irq(int irqnum, l4_cap_idx_t irqcap);
40 
47 L4_CV l4_cap_idx_t L4_EXPORT
48 l4io_request_icu(void);
49 
61 L4_CV long L4_EXPORT
62 l4io_release_irq(int irqnum, l4_cap_idx_t irq_cap);
63 
88 L4_CV long L4_EXPORT
89 l4io_request_iomem(l4_addr_t phys, unsigned long size, int flags,
90  l4_addr_t *virt);
91 
113 L4_CV long L4_EXPORT
115  unsigned long size, int flags);
116 
124 L4_CV long L4_EXPORT
125 l4io_release_iomem(l4_addr_t virt, unsigned long size);
126 
136 L4_CV long L4_EXPORT
138  l4_addr_t *rstart, l4_addr_t *rsize);
139 
149 L4_CV long L4_EXPORT
150 l4io_request_ioport(unsigned portnum, unsigned len);
151 
161 L4_CV long L4_EXPORT
162 l4io_release_ioport(unsigned portnum, unsigned len);
163 
164 
165 /* -------------- Device handling --------------------- */
166 
172 L4_INLINE
173 l4io_device_handle_t l4io_get_root_device(void);
174 
184 L4_CV int L4_EXPORT
185 l4io_iterate_devices(l4io_device_handle_t *devhandle,
186  l4io_device_t *dev, l4io_resource_handle_t *reshandle);
187 
199 L4_CV int L4_EXPORT
200 l4io_lookup_device(const char *devname,
201  l4io_device_handle_t *dev_handle,
202  l4io_device_t *dev, l4io_resource_handle_t *res_handle);
203 
218 L4_CV int L4_EXPORT
219 l4io_lookup_resource(l4io_device_handle_t devhandle,
220  enum l4io_resource_types_t type,
221  l4io_resource_handle_t *reshandle,
222  l4io_resource_t *res);
223 
224 
225 /* --------------- Convenience functions ----------------- */
226 
239 L4_CV l4_addr_t L4_EXPORT
240 l4io_request_resource_iomem(l4io_device_handle_t devhandle,
241  l4io_resource_handle_t *reshandle);
242 
249 L4_CV void L4_EXPORT
250 l4io_request_all_ioports(void (*res_cb)(l4vbus_resource_t const *res));
251 
260 L4_CV int L4_EXPORT
262  l4vbus_paddr_t start, l4vbus_paddr_t end);
263 
264 /* ------------------------------------------------------- */
265 /* Implementations */
266 
267 L4_INLINE
268 l4io_device_handle_t l4io_get_root_device(void)
269 { return 0; }
270 
int l4io_lookup_resource(l4io_device_handle_t devhandle, enum l4io_resource_types_t type, l4io_resource_handle_t *reshandle, l4io_resource_t *res)
Request a specific resource from a device description.
long l4io_request_iomem_region(l4_addr_t phys, l4_addr_t virt, unsigned long size, int flags)
Request an IO memory region and map it to a specified region.
int l4io_iterate_devices(l4io_device_handle_t *devhandle, l4io_device_t *dev, l4io_resource_handle_t *reshandle)
Iterate over the device bus.
long l4io_release_iomem(l4_addr_t virt, unsigned long size)
Release an IO memory region.
l4_addr_t l4io_request_resource_iomem(l4io_device_handle_t devhandle, l4io_resource_handle_t *reshandle)
Request IO memory.
Common L4 ABI Data Types.
#define EXTERN_C_END
End section with C types and functions.
Definition: compiler.h:187
l4_cap_idx_t l4io_request_icu(void)
Request the ICU object of the client.
long l4io_release_ioport(unsigned portnum, unsigned len)
Release an IO port region.
unsigned long l4_cap_idx_t
L4 Capability selector Type.
Definition: types.h:341
l4io_device_handle_t l4io_get_root_device(void)
Get root device handle of the device bus.
Definition: io.h:268
void l4io_request_all_ioports(void(*res_cb)(l4vbus_resource_t const *res))
Request all available IO-port resources.
Description of a single vbus resource.
Definition: vbus_types.h:23
int l4io_has_resource(enum l4io_resource_types_t type, l4vbus_paddr_t start, l4vbus_paddr_t end)
Check if a resource is available.
#define EXTERN_C_BEGIN
Start section with C types and functions.
Definition: compiler.h:186
Detailed information about a vbus device.
Definition: vbus_types.h:56
#define L4_CV
Define calling convention.
Definition: linkage.h:44
long l4io_request_iomem(l4_addr_t phys, unsigned long size, int flags, l4_addr_t *virt)
Request an IO memory region.
int l4io_lookup_device(const char *devname, l4io_device_handle_t *dev_handle, l4io_device_t *dev, l4io_resource_handle_t *res_handle)
Find a device by name.
l4io_resource_types_t
Resource types.
Definition: types.h:50
unsigned long l4_addr_t
Address type.
Definition: l4int.h:45
long l4io_search_iomem_region(l4_addr_t phys, l4_addr_t size, l4_addr_t *rstart, l4_addr_t *rsize)
Search for a IO memory region.
long l4io_request_ioport(unsigned portnum, unsigned len)
Request an IO port region.