9606abc146
A long long time ago, in a galaxy^W^W^W we used DDE kit to ease the porting of purely C based drivers. By now it became clear, that we do not gain that much by following this approach. DDE kit contains much generic functionality, which is not used or rather not needed by most ported drivers. Hence, we implement a slim C wrapper on top of Genode's C++ APIs, that is especially tailored to the driver. In addition to removing the dependency on DDE kit, the iPXE driver now uses the server framework and the newly introduced signal based IRQ handling. Issue #1456.
81 lines
1.3 KiB
C
81 lines
1.3 KiB
C
#ifndef __ENV_DDE_KIT_H__
|
|
#define __ENV_DDE_KIT_H__
|
|
|
|
/* bits/io.h */
|
|
|
|
#include <dde_support.h>
|
|
|
|
static inline uint8_t inb(volatile uint8_t *io_addr)
|
|
{
|
|
return dde_inb((dde_addr_t) io_addr);
|
|
}
|
|
|
|
static inline uint16_t inw(volatile uint16_t *io_addr)
|
|
{
|
|
return dde_inw((dde_addr_t) io_addr);
|
|
}
|
|
|
|
static inline uint32_t inl(volatile uint32_t *io_addr)
|
|
{
|
|
return dde_inl((dde_addr_t) io_addr);
|
|
}
|
|
|
|
static inline void outb(uint8_t data, volatile uint8_t *io_addr)
|
|
{
|
|
dde_outb((dde_addr_t) io_addr, data);
|
|
}
|
|
|
|
static inline void outw(uint16_t data, volatile uint16_t *io_addr)
|
|
{
|
|
dde_outw((dde_addr_t) io_addr, data);
|
|
}
|
|
|
|
static inline void outl(uint32_t data, volatile uint32_t *io_addr)
|
|
{
|
|
dde_outl((dde_addr_t) io_addr, data);
|
|
}
|
|
|
|
|
|
static inline uint8_t readb(volatile uint8_t *io_addr)
|
|
{
|
|
return *io_addr;
|
|
}
|
|
|
|
|
|
static inline uint16_t readw(volatile uint16_t *io_addr)
|
|
{
|
|
return *io_addr;
|
|
}
|
|
|
|
|
|
static inline uint32_t readl(volatile uint32_t *io_addr)
|
|
{
|
|
return *io_addr;
|
|
}
|
|
|
|
|
|
static inline void writeb(uint8_t data, volatile uint8_t *io_addr)
|
|
{
|
|
*io_addr = data;
|
|
}
|
|
|
|
|
|
static inline void writew(uint16_t data, volatile uint16_t *io_addr)
|
|
{
|
|
*io_addr = data;
|
|
}
|
|
|
|
|
|
static inline void writel(uint32_t data, volatile uint32_t *io_addr)
|
|
{
|
|
*io_addr = data;
|
|
}
|
|
|
|
|
|
static inline void mb(void)
|
|
{
|
|
asm volatile ("lock; addl $0, 0(%%esp)" : : : "memory");
|
|
}
|
|
|
|
#endif /* __ENV_DDE_KIT_H__ */
|