Loading...
Searching...
No Matches
vbus_interfaces.h
Go to the documentation of this file.
/*
* (c) 2014 Sarah Hoffmann <sarah.hoffmann@kernkonzept.com>
*
* License: see LICENSE.spdx (in this directory or the directories above)
*/
#pragma once
#include <l4/sys/types.h>
typedef enum l4vbus_iface_type_t
{
L4VBUS_INTERFACE_ICU = 0,
L4VBUS_INTERFACE_GPIO,
L4VBUS_INTERFACE_PCI,
L4VBUS_INTERFACE_PCIDEV,
L4VBUS_INTERFACE_PM,
L4VBUS_INTERFACE_BUS,
L4VBUS_INTERFACE_GENERIC = 0x20
} l4vbus_iface_type_t;
enum {
L4VBUS_IFACE_SHIFT = 26
};
L4_INLINE unsigned l4vbus_subinterface(unsigned opcode)
{
return opcode >> L4VBUS_IFACE_SHIFT;
}
L4_INLINE unsigned l4vbus_interface_opcode(unsigned opcode)
{
return opcode & ((1 << L4VBUS_IFACE_SHIFT) - 1);
}
L4_INLINE int l4vbus_subinterface_supported(l4_uint32_t dev_type,
l4vbus_iface_type_t iface_type)
{
if (iface_type == L4VBUS_INTERFACE_GENERIC)
return 1;
return (dev_type & (1 << iface_type)) ? 1 : 0;
}
l4_uint32_t
unsigned int l4_uint32_t
Unsigned 32bit value.
Definition l4int.h:29
L4_INLINE
#define L4_INLINE
L4 Inline function attribute.
Definition compiler.h:51
types.h
Common L4 ABI Data Types.
l4vbus_iface_type_t
l4vbus_iface_type_t
Different sub-interfaces a vbus device may support.
Definition vbus_interfaces.h:30
L4VBUS_INTERFACE_BUS
@ L4VBUS_INTERFACE_BUS
VBus.
Definition vbus_interfaces.h:42
L4VBUS_INTERFACE_GENERIC
@ L4VBUS_INTERFACE_GENERIC
No specific sub interface.
Definition vbus_interfaces.h:44
L4VBUS_INTERFACE_GPIO
@ L4VBUS_INTERFACE_GPIO
GPIO.
Definition vbus_interfaces.h:34
L4VBUS_INTERFACE_ICU
@ L4VBUS_INTERFACE_ICU
Interrupt Controller.
Definition vbus_interfaces.h:32
L4VBUS_INTERFACE_PCI
@ L4VBUS_INTERFACE_PCI
PCI.
Definition vbus_interfaces.h:36
L4VBUS_INTERFACE_PCIDEV
@ L4VBUS_INTERFACE_PCIDEV
PCI Device.
Definition vbus_interfaces.h:38
L4VBUS_INTERFACE_PM
@ L4VBUS_INTERFACE_PM
Power Management.
Definition vbus_interfaces.h:40
L4VBUS_IFACE_SHIFT
@ L4VBUS_IFACE_SHIFT
Sub-interface ID shift.
Definition vbus_interfaces.h:56
l4vbus_subinterface_supported
int l4vbus_subinterface_supported(l4_uint32_t dev_type, l4vbus_iface_type_t iface_type)
Check if a vbus device supports a given sub-interface.
Definition vbus_interfaces.h:99
l4vbus_interface_opcode
unsigned l4vbus_interface_opcode(unsigned opcode)
Return the function opcode within the sub-interface of the vbus command.
Definition vbus_interfaces.h:86
l4vbus_subinterface
unsigned l4vbus_subinterface(unsigned opcode)
Return the ID of the vbus sub-interface.
Definition vbus_interfaces.h:70