Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4345 → Rev 4344

/branches/dynload/uspace/lib/libc/arch/ia32/include/ddi.h
33,72 → 33,45
#ifndef LIBC_ia32_DDI_H_
#define LIBC_ia32_DDI_H_
 
#include <sys/types.h>
#include <libarch/types.h>
 
#define IO_SPACE_BOUNDARY ((void *) (64 * 1024))
 
static inline uint8_t pio_read_8(ioport8_t *port)
static inline void outb(int16_t port, uint8_t b)
{
uint8_t val;
asm volatile (
"inb %w[port], %b[val]\n"
: [val] "=a" (val)
: [port] "d" (port)
);
return val;
asm volatile ("outb %0, %1\n" :: "a" (b), "d" (port));
}
 
static inline uint16_t pio_read_16(ioport16_t *port)
static inline void outw(int16_t port, int16_t w)
{
uint16_t val;
asm volatile (
"inw %w[port], %w[val]\n"
: [val] "=a" (val)
: [port] "d" (port)
);
return val;
asm volatile ("outw %0, %1\n" :: "a" (w), "d" (port));
}
 
static inline uint32_t pio_read_32(ioport32_t *port)
static inline void outl(int16_t port, uint32_t l)
{
uint32_t val;
asm volatile (
"inl %w[port], %[val]\n"
: [val] "=a" (val)
: [port] "d" (port)
);
return val;
asm volatile ("outl %0, %1\n" :: "a" (l), "d" (port));
}
 
static inline void pio_write_8(ioport8_t *port, uint8_t val)
static inline uint8_t inb(int16_t port)
{
asm volatile (
"outb %b[val], %w[port]\n"
:: [val] "a" (val), [port] "d" (port)
);
uint8_t val;
 
asm volatile ("inb %1, %0 \n" : "=a" (val) : "d"(port));
return val;
}
 
static inline void pio_write_16(ioport16_t *port, uint16_t val)
static inline int16_t inw(int16_t port)
{
asm volatile (
"outw %w[val], %w[port]\n"
:: [val] "a" (val), [port] "d" (port)
);
int16_t val;
 
asm volatile ("inw %1, %0 \n" : "=a" (val) : "d"(port));
return val;
}
 
static inline void pio_write_32(ioport32_t *port, uint32_t val)
static inline uint32_t inl(int16_t port)
{
asm volatile (
"outl %[val], %w[port]\n"
:: [val] "a" (val), [port] "d" (port)
);
uint32_t val;
 
asm volatile ("inl %1, %0 \n" : "=a" (val) : "d"(port));
return val;
}
 
#endif
/branches/dynload/uspace/lib/libc/arch/sparc64/include/ddi.h
File deleted
/branches/dynload/uspace/lib/libc/arch/ia64/include/ddi.h
1,5 → 1,5
/*
* Copyright (c) 2005 Jakub Vana
* Copyright (c) 2005 Jakub Jermar, Jakub Vana
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
26,7 → 26,7
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup libcia64
/** @addtogroup ia64
* @{
*/
/** @file
35,80 → 35,63
#ifndef LIBC_ia64_DDI_H_
#define LIBC_ia64_DDI_H_
 
#include <sys/types.h>
#include <libarch/types.h>
 
#define IO_SPACE_BOUNDARY (64 * 1024)
typedef uint64_t ioport_t;
 
uint64_t get_ia64_iospace_address(void);
 
extern uint64_t ia64_iospace_address;
 
#define IA64_IOSPACE_ADDRESS \
(ia64_iospace_address ? \
ia64_iospace_address : \
(ia64_iospace_address = get_ia64_iospace_address()))
#define IA64_IOSPACE_ADDRESS (ia64_iospace_address?ia64_iospace_address:(ia64_iospace_address=get_ia64_iospace_address()))
 
static inline void pio_write_8(ioport8_t *port, uint8_t v)
static inline void outb(ioport_t port,uint8_t v)
{
uintptr_t prt = (uintptr_t) port;
*((uint8_t *)(IA64_IOSPACE_ADDRESS + ( (port & 0xfff) | ( (port >> 2) << 12 )))) = v;
 
*((uint8_t *)(IA64_IOSPACE_ADDRESS +
((prt & 0xfff) | ((prt >> 2) << 12)))) = v;
 
asm volatile ("mf\n" ::: "memory");
}
 
static inline void pio_write_16(ioport16_t *port, uint16_t v)
static inline void outw(ioport_t port,uint16_t v)
{
uintptr_t prt = (uintptr_t) port;
*((uint16_t *)(IA64_IOSPACE_ADDRESS + ( (port & 0xfff) | ( (port >> 2) << 12 )))) = v;
 
*((uint16_t *)(IA64_IOSPACE_ADDRESS +
((prt & 0xfff) | ((prt >> 2) << 12)))) = v;
 
asm volatile ("mf\n" ::: "memory");
}
 
static inline void pio_write_32(ioport32_t *port, uint32_t v)
static inline void outl(ioport_t port,uint32_t v)
{
uintptr_t prt = (uintptr_t) port;
*((uint32_t *)(IA64_IOSPACE_ADDRESS + ( (port & 0xfff) | ( (port >> 2) << 12 )))) = v;
 
*((uint32_t *)(IA64_IOSPACE_ADDRESS +
((prt & 0xfff) | ((prt >> 2) << 12)))) = v;
 
asm volatile ("mf\n" ::: "memory");
}
 
static inline uint8_t pio_read_8(ioport8_t *port)
 
 
static inline uint8_t inb(ioport_t port)
{
uintptr_t prt = (uintptr_t) port;
 
asm volatile ("mf\n" ::: "memory");
 
return *((uint8_t *)(IA64_IOSPACE_ADDRESS +
((prt & 0xfff) | ((prt >> 2) << 12))));
return *((uint8_t *)(IA64_IOSPACE_ADDRESS + ( (port & 0xfff) | ( (port >> 2) << 12 ))));
}
 
static inline uint16_t pio_read_16(ioport16_t *port)
static inline uint16_t inw(ioport_t port)
{
uintptr_t prt = (uintptr_t) port;
 
asm volatile ("mf\n" ::: "memory");
 
return *((uint16_t *)(IA64_IOSPACE_ADDRESS +
((prt & 0xfff) | ((prt >> 2) << 12))));
return *((uint16_t *)(IA64_IOSPACE_ADDRESS + ( (port & 0xffE) | ( (port >> 2) << 12 ))));
}
 
static inline uint32_t pio_read_32(ioport32_t *port)
static inline uint32_t inl(ioport_t port)
{
uintptr_t prt = (uintptr_t) port;
 
asm volatile ("mf\n" ::: "memory");
 
return *((uint32_t *)(IA64_IOSPACE_ADDRESS +
((prt & 0xfff) | ((prt >> 2) << 12))));
return *((uint32_t *)(IA64_IOSPACE_ADDRESS + ( (port & 0xfff) | ( (port >> 2) << 12 ))));
}
 
 
 
 
#endif
 
/** @}
/branches/dynload/uspace/lib/libc/arch/arm32/include/ddi.h
File deleted
/branches/dynload/uspace/lib/libc/arch/ppc32/include/ddi.h
File deleted
/branches/dynload/uspace/lib/libc/arch/mips32/include/ddi.h
File deleted