L4Re - L4 Runtime Environment
vbus_interfaces.h
1 /*
2  * (c) 2014 Sarah Hoffmann <sarah.hoffmann@kernkonzept.com>
3  *
4  * This file is part of TUD:OS and distributed under the terms of the
5  * GNU General Public License 2.
6  * Please see the COPYING-GPL-2 file for details.
7  */
8 #pragma once
9 
10 #include <l4/sys/types.h>
11 
26 enum l4vbus_iface_type_t {
27  L4VBUS_INTERFACE_ICU = 0,
28  L4VBUS_INTERFACE_GPIO,
29  L4VBUS_INTERFACE_PCI,
30  L4VBUS_INTERFACE_PCIDEV,
31  L4VBUS_INTERFACE_PM,
32  L4VBUS_INTERFACE_BUS,
33  L4VBUS_INTERFACE_GENERIC = 0x20
34 };
35 
36 
37 enum {
45  L4VBUS_IFACE_SHIFT = 26
46 };
47 
59 L4_INLINE unsigned l4vbus_subinterface(unsigned opcode)
60 {
61  return opcode >> L4VBUS_IFACE_SHIFT;
62 }
63 
75 L4_INLINE unsigned l4vbus_interface_opcode(unsigned opcode)
76 {
77  return opcode & ((1 << L4VBUS_IFACE_SHIFT) - 1);
78 }
79 
88 L4_INLINE int l4vbus_subinterface_supported(l4_uint32_t dev_type,
89  l4vbus_iface_type_t iface_type)
90 {
91  if (iface_type == L4VBUS_INTERFACE_GENERIC)
92  return 1;
93 
94  return (dev_type & (1 << iface_type)) ? 1 : 0;
95 }
Common L4 ABI Data Types.
unsigned int l4_uint32_t
Unsigned 32bit value.
Definition: l4int.h:40