1 | /* |
---|
2 | * This include file definitions related to an Intel i386ex board. |
---|
3 | * |
---|
4 | * COPYRIGHT (c) 1989-1999. |
---|
5 | * On-Line Applications Research Corporation (OAR). |
---|
6 | * |
---|
7 | * The license and distribution terms for this file may be |
---|
8 | * found in the file LICENSE in this distribution or at |
---|
9 | * http://www.rtems.com/license/LICENSE. |
---|
10 | * |
---|
11 | * $Id$ |
---|
12 | */ |
---|
13 | |
---|
14 | #ifndef _BSP_H |
---|
15 | #define _BSP_H |
---|
16 | |
---|
17 | #ifdef __cplusplus |
---|
18 | extern "C" { |
---|
19 | #endif |
---|
20 | |
---|
21 | #include <bspopts.h> |
---|
22 | |
---|
23 | #include <rtems.h> |
---|
24 | #include <rtems/iosupp.h> |
---|
25 | #include <rtems/console.h> |
---|
26 | #include <rtems/clockdrv.h> |
---|
27 | #include <rtems/bspIo.h> |
---|
28 | #include <libcpu/cpu.h> |
---|
29 | #include <bsp/irq.h> |
---|
30 | |
---|
31 | /* |
---|
32 | * Network driver configuration |
---|
33 | */ |
---|
34 | |
---|
35 | struct rtems_bsdnet_ifconfig; |
---|
36 | extern int rtems_ne_driver_attach (struct rtems_bsdnet_ifconfig *config); |
---|
37 | |
---|
38 | extern void Wait_X_ms (unsigned); |
---|
39 | |
---|
40 | #define RTEMS_BSP_NETWORK_DRIVER_NAME "ne1" |
---|
41 | #define RTEMS_BSP_NETWORK_DRIVER_ATTACH rtems_ne_driver_attach |
---|
42 | |
---|
43 | #define NE2000_BYTE_TRANSFERS |
---|
44 | |
---|
45 | /* |
---|
46 | * Constants relating to the 8254 (or 8253) programmable interval timers. |
---|
47 | */ |
---|
48 | |
---|
49 | #define TIMER_CONFIG 0xF834 |
---|
50 | #define IO_TIMER1 0xF040 |
---|
51 | |
---|
52 | /* Port address of the control port and timer channels */ |
---|
53 | |
---|
54 | #define TIMER_CNTR0 (IO_TIMER1 + 0) /* timer 0 counter port */ |
---|
55 | #define TIMER_CNTR1 (IO_TIMER1 + 1) /* timer 1 counter port */ |
---|
56 | #define TIMER_CNTR2 (IO_TIMER1 + 2) /* timer 2 counter port */ |
---|
57 | #define TIMER_MODE (IO_TIMER1 + 3) /* timer mode port */ |
---|
58 | #define TIMER_SEL0 0x00 /* select counter 0 */ |
---|
59 | #define TIMER_SEL1 0x40 /* select counter 1 */ |
---|
60 | #define TIMER_SEL2 0x80 /* select counter 2 */ |
---|
61 | #define TIMER_INTTC 0x00 /* mode 0, intr on terminal cnt */ |
---|
62 | #define TIMER_ONESHOT 0x02 /* mode 1, one shot */ |
---|
63 | #define TIMER_RATEGEN 0x04 /* mode 2, rate generator */ |
---|
64 | #define TIMER_SQWAVE 0x06 /* mode 3, square wave */ |
---|
65 | #define TIMER_SWSTROBE 0x08 /* mode 4, s/w triggered strobe */ |
---|
66 | #define TIMER_HWSTROBE 0x0a /* mode 5, h/w triggered strobe */ |
---|
67 | #define TIMER_LATCH 0x00 /* latch counter for reading */ |
---|
68 | #define TIMER_LSB 0x10 /* r/w counter LSB */ |
---|
69 | #define TIMER_MSB 0x20 /* r/w counter MSB */ |
---|
70 | #define TIMER_16BIT 0x30 /* r/w counter 16 bits, LSB first */ |
---|
71 | #define TIMER_BCD 0x01 /* count in BCD */ |
---|
72 | |
---|
73 | /* |
---|
74 | * Simple spin delay in microsecond units for device drivers. |
---|
75 | * This is very dependent on the clock speed of the target. |
---|
76 | */ |
---|
77 | |
---|
78 | #define rtems_bsp_delay( _microseconds ) \ |
---|
79 | { \ |
---|
80 | uint32_t _counter; \ |
---|
81 | \ |
---|
82 | _counter = (_microseconds); \ |
---|
83 | \ |
---|
84 | asm volatile ( "0: nop;" \ |
---|
85 | " mov %0,%0 ;" \ |
---|
86 | " loop 0b" : "=c" (_counter) \ |
---|
87 | : "0" (_counter) \ |
---|
88 | ); \ |
---|
89 | \ |
---|
90 | } |
---|
91 | |
---|
92 | /* Constants */ |
---|
93 | |
---|
94 | #define RAM_START 0 |
---|
95 | |
---|
96 | /* replaced the earlier EI kludge of 0xfffff */ |
---|
97 | |
---|
98 | #define RAM_END 0x200000 |
---|
99 | |
---|
100 | /* I/O addressing */ |
---|
101 | |
---|
102 | /* |
---|
103 | *#define Is_tx_ready( _status ) ( (_status) & 0x20 ) |
---|
104 | */ |
---|
105 | /* dec 20. try the TE instead of TBE as the check */ |
---|
106 | |
---|
107 | #define Is_tx_ready( _status ) ( (_status) & 0x40 ) |
---|
108 | |
---|
109 | #define Is_rx_ready( _status ) ( (_status) & 0x01 ) |
---|
110 | |
---|
111 | /* Structures */ |
---|
112 | |
---|
113 | #ifdef F386_INIT |
---|
114 | #undef BSP_EXTERN |
---|
115 | #define BSP_EXTERN |
---|
116 | #else |
---|
117 | #undef BSP_EXTERN |
---|
118 | #define BSP_EXTERN extern |
---|
119 | #endif |
---|
120 | |
---|
121 | /* |
---|
122 | * Device Driver Table Entries |
---|
123 | */ |
---|
124 | |
---|
125 | /* |
---|
126 | * NOTE: Use the standard Console driver entry |
---|
127 | */ |
---|
128 | |
---|
129 | /* |
---|
130 | * NOTE: Use the standard Clock driver entry |
---|
131 | */ |
---|
132 | |
---|
133 | /* miscellaneous stuff assumed to exist */ |
---|
134 | |
---|
135 | #define IDT_SIZE 256 |
---|
136 | #define GDT_SIZE 3 |
---|
137 | |
---|
138 | extern interrupt_gate_descriptor Interrupt_descriptor_table[IDT_SIZE]; |
---|
139 | extern segment_descriptors Global_descriptor_table [GDT_SIZE]; |
---|
140 | |
---|
141 | BSP_EXTERN unsigned short Idt[3]; /* Interrupt Descriptor Table Address */ |
---|
142 | BSP_EXTERN unsigned short Gdt[3]; /* Global Descriptor Table Address */ |
---|
143 | BSP_EXTERN unsigned int Idt_base; |
---|
144 | BSP_EXTERN unsigned int Gdt_base; |
---|
145 | |
---|
146 | /* routines */ |
---|
147 | |
---|
148 | #ifdef __cplusplus |
---|
149 | } |
---|
150 | #endif |
---|
151 | |
---|
152 | #endif |
---|