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
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
137 l4io_request_ioport(unsigned portnum, unsigned len);
138 
148 L4_CV long L4_EXPORT
149 l4io_release_ioport(unsigned portnum, unsigned len);
150 
151 
152 /* -------------- Device handling --------------------- */
153 
159 L4_INLINE
160 l4io_device_handle_t l4io_get_root_device(void);
161 
171 L4_CV int L4_EXPORT
172 l4io_iterate_devices(l4io_device_handle_t *devhandle,
173  l4io_device_t *dev, l4io_resource_handle_t *reshandle);
174 
186 L4_CV int L4_EXPORT
187 l4io_lookup_device(const char *devname,
188  l4io_device_handle_t *dev_handle,
189  l4io_device_t *dev, l4io_resource_handle_t *res_handle);
190 
205 L4_CV int L4_EXPORT
206 l4io_lookup_resource(l4io_device_handle_t devhandle,
207  enum l4io_resource_types_t type,
208  l4io_resource_handle_t *reshandle,
209  l4io_resource_t *res);
210 
211 
212 /* --------------- Convenience functions ----------------- */
213 
226 L4_CV l4_addr_t L4_EXPORT
227 l4io_request_resource_iomem(l4io_device_handle_t devhandle,
228  l4io_resource_handle_t *reshandle);
229 
236 L4_CV void L4_EXPORT
237 l4io_request_all_ioports(void (*res_cb)(l4vbus_resource_t const *res));
238 
247 L4_CV int L4_EXPORT
249  l4vbus_paddr_t start, l4vbus_paddr_t end);
250 
251 /* ------------------------------------------------------- */
252 /* Implementations */
253 
254 L4_INLINE
255 l4io_device_handle_t l4io_get_root_device(void)
256 { return 0; }
257 
#define EXTERN_C_BEGIN
Start section with C types and functions.
Definition: compiler.h:190
#define EXTERN_C_END
End section with C types and functions.
Definition: compiler.h:191
long l4io_request_ioport(unsigned portnum, unsigned len)
Request an IO port region.
long l4io_release_iomem(l4_addr_t virt, unsigned long size)
Release an IO memory region.
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_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_release_ioport(unsigned portnum, unsigned len)
Release an IO port 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.
int l4io_has_resource(enum l4io_resource_types_t type, l4vbus_paddr_t start, l4vbus_paddr_t end)
Check if a resource is available.
l4_addr_t l4io_request_resource_iomem(l4io_device_handle_t devhandle, l4io_resource_handle_t *reshandle)
Request IO memory.
l4io_resource_types_t
Resource types.
Definition: types.h:50
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.
unsigned long l4_addr_t
Address type.
Definition: l4int.h:45
unsigned long l4_cap_idx_t
L4 Capability selector Type.
Definition: types.h:342
#define L4_CV
Define calling convention.
Definition: linkage.h:44
l4io_device_handle_t l4io_get_root_device(void)
Get root device handle of the device bus.
Definition: io.h:255
void l4io_request_all_ioports(void(*res_cb)(l4vbus_resource_t const *res))
Request all available IO-port resources.
l4_cap_idx_t l4io_request_icu(void)
Request the ICU object of the client.
int l4io_iterate_devices(l4io_device_handle_t *devhandle, l4io_device_t *dev, l4io_resource_handle_t *reshandle)
Iterate over the device bus.
Common L4 ABI Data Types.
Detailed information about a vbus device.
Definition: vbus_types.h:69
Description of a single vbus resource.
Definition: vbus_types.h:23