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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [asm-ppc/] [io.h] - Blame information for rev 1633

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

Line No. Rev Author Line
1 1633 jcastillo
#ifndef _PPC_IO_H
2
#define _PPC_IO_H
3
 
4
/* Define the particulars of outb/outw/outl "instructions" */
5
 
6
#define SLOW_DOWN_IO
7
 
8
#ifndef PCI_DRAM_OFFSET
9
#define PCI_DRAM_OFFSET  0x80000000
10
#endif
11
#ifndef KERNELBASE
12
#define KERNELBASE 0x90000000
13
#endif
14
 
15
/*
16
 * The PCI bus is inherently Little-Endian.  The PowerPC is being
17
 * run Big-Endian.  Thus all values which cross the [PCI] barrier
18
 * must be endian-adjusted.  Also, the local DRAM has a different
19
 * address from the PCI point of view, thus buffer addresses also
20
 * have to be modified [mapped] appropriately.
21
 */
22
extern inline unsigned long virt_to_bus(volatile void * address)
23
{
24
        if (address == (void *)0) return 0;
25
        return ((unsigned long)((long)address - KERNELBASE + PCI_DRAM_OFFSET));
26
}
27
 
28
extern inline void * bus_to_virt(unsigned long address)
29
{
30
        if (address == 0) return 0;
31
        return ((void *)(address - PCI_DRAM_OFFSET + KERNELBASE));
32
}
33
/* #define virt_to_bus(a) ((unsigned long)(((char *)a==(char *) 0) ? ((char *)0) \
34
                        : ((char *)((long)a - KERNELBASE + PCI_DRAM_OFFSET))))
35
#define bus_to_virt(a) ((void *) (((char *)a==(char *)0) ? ((char *)0) \
36
                        : ((char *)((long)a - PCI_DRAM_OFFSET + KERNELBASE))))
37
*/
38
 
39
#define readb(addr) (*(volatile unsigned char *) (addr))
40
#define readw(addr) (*(volatile unsigned short *) (addr))
41
#define readl(addr) (*(volatile unsigned int *) (addr))
42
 
43
#define writeb(b,addr) ((*(volatile unsigned char *) (addr)) = (b))
44
#define writew(b,addr) ((*(volatile unsigned short *) (addr)) = (b))
45
#define writel(b,addr) ((*(volatile unsigned int *) (addr)) = (b))
46
 
47
/*
48
 * Change virtual addresses to physical addresses and vv.
49
 * These are trivial on the 1:1 Linux/i386 mapping (but if we ever
50
 * make the kernel segment mapped at 0, we need to do translation
51
 * on the i386 as well)
52
 */
53
extern inline unsigned long virt_to_phys(volatile void * address)
54
{
55
        return (unsigned long) address;
56
}
57
 
58
extern inline void * phys_to_virt(unsigned long address)
59
{
60
        return (void *) address;
61
}
62
 
63
/* from arch/ppc/kernel/port_io.c
64
 *               -- Cort
65
 */
66
unsigned char inb(int port);
67
unsigned short inw(int port);
68
unsigned long inl(int port);
69
unsigned char outb(unsigned char val,int port);
70
unsigned short outw(unsigned short val,int port);
71
unsigned long outl(unsigned long val,int port);
72
void outsl(int port, long *ptr, int len);
73
 
74
static inline unsigned char  inb_p(int port) {return (inb(port)); }
75
static inline unsigned short inw_p(int port) {return (inw(port)); }
76
static inline unsigned long  inl_p(int port) {return (inl(port)); }
77
 
78
 
79
 
80
static inline unsigned char  outb_p(unsigned char val,int port) { return (outb(val,port)); }
81
static inline unsigned short outw_p(unsigned short val,int port) { return (outw(val,port)); }
82
static inline unsigned long  outl_p(unsigned long val,int port) { return (outl(val,port)); }
83
 
84
 
85
 
86
#endif

powered by: WebSVN 2.1.0

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