This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / include / asm-h8300 / h8max / machine-depend.h
1 /* H8MAX board depend header */
2
3 /* TIMER rate define */
4 #ifdef H8300_TIMER_DEFINE
5 #define H8300_TIMER_COUNT_DATA 25000*10/8192
6 #define H8300_TIMER_FREQ 25000*1000/8192
7 #endif
8
9 /* H8MAX RTL8019AS Config */
10 #ifdef H8300_NE_DEFINE
11
12 #define NE2000_ADDR             0x800600
13 #define NE2000_IRQ              4
14 #define NE2000_IRQ_VECTOR       (12 + NE2000_IRQ)
15 #define NE2000_BYTE             volatile unsigned short
16
17 /* sorry quick hack */
18 #if defined(outb)
19 # undef outb
20 #endif
21 #define outb(d,a)               h8max_outb((d),(a) - NE2000_ADDR)
22 #if defined(inb)
23 # undef inb
24 #endif
25 #define inb(a)                  h8max_inb((a) - NE2000_ADDR)
26 #if defined(outb_p)
27 # undef outb_p
28 #endif
29 #define outb_p(d,a)             h8max_outb((d),(a) - NE2000_ADDR)
30 #if defined(inb_p)
31 # undef inb_p
32 #endif
33 #define inb_p(a)                h8max_inb((a) - NE2000_ADDR)
34 #if defined(outsw)
35 # undef outsw
36 #endif
37 #define outsw(a,p,l)            h8max_outsw((a) - NE2000_ADDR,(unsigned short *)p,l)
38 #if defined(insw)
39 # undef insw
40 #endif
41 #define insw(a,p,l)             h8max_insw((a) - NE2000_ADDR,(unsigned short *)p,l)
42 #if defined(outsb)
43 # undef outsb
44 #endif
45 #define outsb(a,p,l)            h8max_outsb((a) - NE2000_ADDR,(unsigned char *)p,l)
46 #if defined(insb)
47 # undef insb
48 #endif
49 #define insb(a,p,l)             h8max_insb((a) - NE2000_ADDR,(unsigned char *)p,l)
50
51 #define H8300_INIT_NE()                  \
52 do {                                     \
53         wordlength = 2;                  \
54         h8max_outb(0x49, ioaddr + EN0_DCFG); \
55         SA_prom[14] = SA_prom[15] = 0x57;\
56 } while(0)
57
58 static inline void h8max_outb(unsigned char d,unsigned char a)
59 {
60         *(unsigned short *)(NE2000_ADDR + (a << 1)) = d;
61 }
62
63 static inline unsigned char h8max_inb(unsigned char a)
64 {
65         return *(unsigned char *)(NE2000_ADDR + (a << 1) +1);
66 }
67
68 static inline void h8max_outsw(unsigned char a,unsigned short *p,unsigned long l)
69 {
70         unsigned short d;
71         for (; l != 0; --l, p++) {
72                 d = (((*p) >> 8) & 0xff) | ((*p) << 8);
73                 *(unsigned short *)(NE2000_ADDR + (a << 1)) = d;
74         }
75 }
76
77 static inline void h8max_insw(unsigned char a,unsigned short *p,unsigned long l)
78 {
79         unsigned short d;
80         for (; l != 0; --l, p++) {
81                 d = *(unsigned short *)(NE2000_ADDR + (a << 1));
82                 *p = (d << 8)|((d >> 8) & 0xff);
83         }
84 }
85
86 static inline void h8max_outsb(unsigned char a,unsigned char *p,unsigned long l)
87 {
88         for (; l != 0; --l, p++) {
89                 *(unsigned short *)(NE2000_ADDR + (a << 1)) = *p;
90         }
91 }
92
93 static inline void h8max_insb(unsigned char a,unsigned char *p,unsigned long l)
94 {
95         for (; l != 0; --l, p++) {
96                 *p = *((unsigned char *)(NE2000_ADDR + (a << 1))+1);
97         }
98 }
99
100 #endif