OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [include/] [asm-or32/] [io.h] - Rev 1774

Go to most recent revision | Compare with Previous | Blame | View Log

#ifndef _OR32_IO_H
#define _OR32_IO_H
 
#include <asm/page.h>
#include <linux/config.h>
 
 
/*
 * Change virtual addresses to physical addresses and vv.
 */
 
static inline unsigned long virt_to_phys(volatile void * address)
{
	return __pa(address);
}
 
static inline void * phys_to_virt(unsigned long address)
{
	return __va(address);
}
 
extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags);
 
extern inline void * ioremap (unsigned long offset, unsigned long size)
{
	return __ioremap(offset, size, 0);
}
 
#define page_to_phys(page)	((page - mem_map) << PAGE_SHIFT)
 
/*
 * IO bus memory addresses are also 1:1 with the physical address
 */
#define virt_to_bus virt_to_phys
#define bus_to_virt phys_to_virt
 
/*
 * readX/writeX() are used to access memory mapped devices. On some
 * architectures the memory mapped IO stuff needs to be accessed
 * differently. On the or32 architecture, we just read/write the
 * memory location directly.
 */
#define readb(addr) (*(volatile unsigned char *) (addr))
#define readw(addr) (*(volatile unsigned short *) (addr))
#define readl(addr) (*(volatile unsigned int *) (addr))
 
#define writeb(b,addr) ((*(volatile unsigned char *) (addr)) = (b))
#define writew(b,addr) ((*(volatile unsigned short *) (addr)) = (b))
#define writel(b,addr) ((*(volatile unsigned int *) (addr)) = (b))
 
#define memset_io(a,b,c)	memset((void *)(a),(b),(c))
#define memcpy_fromio(a,b,c)	memcpy((a),(void *)(b),(c))
#define memcpy_toio(a,b,c)	memcpy((void *)(a),(b),(c))
 
/*
 * Again, or32 does not require mem IO specific function.
 */
 
#define eth_io_copy_and_sum(a,b,c,d)	eth_copy_and_sum((a),(void *)(b),(c),(d))
 
#define IO_BASE			0x0
#define IO_SPACE_LIMIT 		0xffffffff
 
#define inb(port)		(*(volatile unsigned char *) (port+IO_BASE))
#define outb(value,port)	((*(volatile unsigned char *) (port+IO_BASE)) = (value))	
 
/*
 * __PHX__ TODO
 */
#define outw(x,y)
#define outl(x,y)
#define insb(x,y,z)
#define insw(x,y,z)
#define insl(x,y,z)
#define outsb(x,y,z)
#define outsw(x,y,z)
#define outsl(x,y,z)
 
#endif
 

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.