1 | /*-------------------------------------------------------------------------+ |
---|
2 | | bsp.h v1.1 - PC386 BSP - 1997/08/07 |
---|
3 | +--------------------------------------------------------------------------+ |
---|
4 | | This include file contains definitions related to the PC386 BSP. |
---|
5 | +--------------------------------------------------------------------------+ |
---|
6 | | (C) Copyright 1997 - |
---|
7 | | - NavIST Group - Real-Time Distributed Systems and Industrial Automation |
---|
8 | | |
---|
9 | | http://pandora.ist.utl.pt |
---|
10 | | |
---|
11 | | Instituto Superior Tecnico * Lisboa * PORTUGAL |
---|
12 | +--------------------------------------------------------------------------+ |
---|
13 | | Modified by Eric Valette the 20/05/98 in order to add definitions used |
---|
14 | | to enhance video putchar capabilities. |
---|
15 | | |
---|
16 | | Copyright (C) 1998 valette@crf.canon.fr |
---|
17 | | |
---|
18 | | Canon Centre Recherche France. |
---|
19 | | |
---|
20 | +--------------------------------------------------------------------------+ |
---|
21 | | Disclaimer: |
---|
22 | | |
---|
23 | | This file is provided "AS IS" without warranty of any kind, either |
---|
24 | | expressed or implied. |
---|
25 | +--------------------------------------------------------------------------+ |
---|
26 | | This code is based on: |
---|
27 | | bsp.h,v 1.5 1995/12/19 20:07:30 joel Exp - go32 BSP |
---|
28 | | With the following copyright notice: |
---|
29 | | ************************************************************************** |
---|
30 | | * COPYRIGHT (c) 1989-1998. |
---|
31 | | * On-Line Applications Research Corporation (OAR). |
---|
32 | | * Copyright assigned to U.S. Government, 1994. |
---|
33 | | * |
---|
34 | | * The license and distribution terms for this file may be |
---|
35 | | * found in found in the file LICENSE in this distribution or at |
---|
36 | | * http://www.OARcorp.com/rtems/license.html. |
---|
37 | | ************************************************************************** |
---|
38 | | |
---|
39 | | $Id$ |
---|
40 | +--------------------------------------------------------------------------*/ |
---|
41 | |
---|
42 | |
---|
43 | #ifndef __BSP_H_ |
---|
44 | #define __BSP_H_ |
---|
45 | |
---|
46 | #ifdef __cplusplus |
---|
47 | extern "C" { |
---|
48 | #endif |
---|
49 | |
---|
50 | #include <rtems.h> |
---|
51 | #include <iosupp.h> |
---|
52 | #include <console.h> |
---|
53 | #include <clockdrv.h> |
---|
54 | #include <libcpu/cpu.h> |
---|
55 | #include <bspIo.h> |
---|
56 | |
---|
57 | /* |
---|
58 | * Network driver configuration |
---|
59 | */ |
---|
60 | |
---|
61 | struct rtems_bsdnet_ifconfig; |
---|
62 | extern int rtems_wd_driver_attach (struct rtems_bsdnet_ifconfig *config); |
---|
63 | extern int rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config); |
---|
64 | |
---|
65 | #if 0 |
---|
66 | #define RTEMS_BSP_NETWORK_DRIVER_NAME "wd1" |
---|
67 | #define RTEMS_BSP_NETWORK_DRIVER_ATTACH rtems_wd_driver_attach |
---|
68 | #endif |
---|
69 | |
---|
70 | #if 1 |
---|
71 | #define RTEMS_BSP_NETWORK_DRIVER_NAME "dc1" |
---|
72 | #define RTEMS_BSP_NETWORK_DRIVER_ATTACH rtems_dec21140_driver_attach |
---|
73 | #endif |
---|
74 | |
---|
75 | |
---|
76 | /*-------------------------------------------------------------------------+ |
---|
77 | | Constants |
---|
78 | +--------------------------------------------------------------------------*/ |
---|
79 | #define BSP_LIBIO_MAX_FDS 20 /* Number of libio files we want. */ |
---|
80 | |
---|
81 | /*-------------------------------------------------------------------------+ |
---|
82 | | Video (console) related constants. |
---|
83 | +--------------------------------------------------------------------------*/ |
---|
84 | |
---|
85 | #include <crt.h> |
---|
86 | |
---|
87 | /*-------------------------------------------------------------------------+ |
---|
88 | | Constants relating to the 8254 (or 8253) programmable interval timers. |
---|
89 | +--------------------------------------------------------------------------*/ |
---|
90 | #define IO_TIMER1 0x40 |
---|
91 | /* Port address of the control port and timer channels */ |
---|
92 | #define TIMER_CNTR0 (IO_TIMER1 + 0) /* timer 0 counter port */ |
---|
93 | #define TIMER_CNTR1 (IO_TIMER1 + 1) /* timer 1 counter port */ |
---|
94 | #define TIMER_CNTR2 (IO_TIMER1 + 2) /* timer 2 counter port */ |
---|
95 | #define TIMER_MODE (IO_TIMER1 + 3) /* timer mode port */ |
---|
96 | #define TIMER_SEL0 0x00 /* select counter 0 */ |
---|
97 | #define TIMER_SEL1 0x40 /* select counter 1 */ |
---|
98 | #define TIMER_SEL2 0x80 /* select counter 2 */ |
---|
99 | #define TIMER_INTTC 0x00 /* mode 0, intr on terminal cnt */ |
---|
100 | #define TIMER_ONESHOT 0x02 /* mode 1, one shot */ |
---|
101 | #define TIMER_RATEGEN 0x04 /* mode 2, rate generator */ |
---|
102 | #define TIMER_SQWAVE 0x06 /* mode 3, square wave */ |
---|
103 | #define TIMER_SWSTROBE 0x08 /* mode 4, s/w triggered strobe */ |
---|
104 | #define TIMER_HWSTROBE 0x0a /* mode 5, h/w triggered strobe */ |
---|
105 | #define TIMER_LATCH 0x00 /* latch counter for reading */ |
---|
106 | #define TIMER_LSB 0x10 /* r/w counter LSB */ |
---|
107 | #define TIMER_MSB 0x20 /* r/w counter MSB */ |
---|
108 | #define TIMER_16BIT 0x30 /* r/w counter 16 bits, LSB first */ |
---|
109 | #define TIMER_BCD 0x01 /* count in BCD */ |
---|
110 | |
---|
111 | #define TIMER_TICK 1193182 /* The internal tick rate in ticks per second */ |
---|
112 | |
---|
113 | /*-------------------------------------------------------------------------+ |
---|
114 | | Define the time limits for RTEMS Test Suite test durations. Long test and |
---|
115 | | short test duration limits are provided. These values are in seconds and |
---|
116 | | need to be converted to ticks for the application. |
---|
117 | +--------------------------------------------------------------------------*/ |
---|
118 | #define MAX_LONG_TEST_DURATION 300 /* 5 minutes = 300 seconds */ |
---|
119 | #define MAX_SHORT_TEST_DURATION 3 /* 3 seconds */ |
---|
120 | |
---|
121 | /*-------------------------------------------------------------------------+ |
---|
122 | | Macros |
---|
123 | +--------------------------------------------------------------------------*/ |
---|
124 | /*-------------------------------------------------------------------------+ |
---|
125 | | Define the interrupt mechanism for Time Test 27. |
---|
126 | | NOTE: Use a software interrupt for the i386 family. |
---|
127 | +--------------------------------------------------------------------------*/ |
---|
128 | #define MUST_WAIT_FOR_INTERRUPT 0 |
---|
129 | #define Install_tm27_vector(handler) \ |
---|
130 | { \ |
---|
131 | rtems_isr_entry dummy; \ |
---|
132 | rtems_interrupt_catch(handler, 0x90, &dummy); \ |
---|
133 | } |
---|
134 | #define Cause_tm27_intr() asm volatile("int $0x90" : :); |
---|
135 | #define Clear_tm27_intr() |
---|
136 | #define Lower_tm27_intr() |
---|
137 | |
---|
138 | /*-------------------------------------------------------------------------+ |
---|
139 | | Simple spin delay in microsecond units for device drivers. |
---|
140 | | This is very dependent on the clock speed of the target. |
---|
141 | +--------------------------------------------------------------------------*/ |
---|
142 | #define delay(_microseconds) \ |
---|
143 | { \ |
---|
144 | rtems_unsigned32 _cnt = _microseconds; \ |
---|
145 | asm volatile ("0: nop; mov %0,%0; loop 0b" : "=c"(_cnt) : "0"(_cnt)); \ |
---|
146 | } |
---|
147 | |
---|
148 | /*-------------------------------------------------------------------------+ |
---|
149 | | Convert microseconds to ticks and ticks to microseconds. |
---|
150 | +--------------------------------------------------------------------------*/ |
---|
151 | #define US_TO_TICK(us) (((us)*105+44)/88) |
---|
152 | #define TICK_TO_US(tk) (((tk)*88+52)/105) |
---|
153 | |
---|
154 | /*-------------------------------------------------------------------------+ |
---|
155 | | External Variables. |
---|
156 | +--------------------------------------------------------------------------*/ |
---|
157 | #define IDT_SIZE 256 |
---|
158 | #define GDT_SIZE 3 |
---|
159 | |
---|
160 | extern interrupt_gate_descriptor Interrupt_descriptor_table[IDT_SIZE]; |
---|
161 | extern segment_descriptors Global_descriptor_table [GDT_SIZE]; |
---|
162 | |
---|
163 | extern rtems_configuration_table BSP_Configuration; |
---|
164 | /* User provided BSP configuration table. */ |
---|
165 | extern rtems_unsigned32 rtemsFreeMemStart; |
---|
166 | /* Address of start of free memory - should be used when creating new |
---|
167 | partitions or regions and updated afterwards. */ |
---|
168 | |
---|
169 | /*-------------------------------------------------------------------------+ |
---|
170 | | Function Prototypes. |
---|
171 | +--------------------------------------------------------------------------*/ |
---|
172 | void _IBMPC_initVideo(void); /* from 'outch.c' */ |
---|
173 | void _IBMPC_outch (char); /* from 'outch.c' */ |
---|
174 | rtems_boolean _IBMPC_chrdy (char *); /* from 'inch.c' */ |
---|
175 | char _IBMPC_inch (void); /* from 'inch.c' */ |
---|
176 | char _IBMPC_inch_sleep (void); /* from 'inch.c' */ |
---|
177 | |
---|
178 | void printk(char *fmt, ...); /* from 'printk.c' */ |
---|
179 | |
---|
180 | void rtemsReboot(void); /* from 'exit.c' */ |
---|
181 | |
---|
182 | /* Definitions for BSPConsolePort */ |
---|
183 | #define BSP_CONSOLE_PORT_CONSOLE (-1) |
---|
184 | #define BSP_CONSOLE_PORT_COM1 (BSP_UART_COM1) |
---|
185 | #define BSP_CONSOLE_PORT_COM2 (BSP_UART_COM2) |
---|
186 | |
---|
187 | /* GDB stub stuff */ |
---|
188 | void i386_stub_glue_init(int uart); |
---|
189 | void i386_stub_glue_init_breakin(void); |
---|
190 | void set_debug_traps(void); |
---|
191 | void breakpoint(void); |
---|
192 | |
---|
193 | #ifdef __cplusplus |
---|
194 | } |
---|
195 | #endif |
---|
196 | |
---|
197 | #endif /* __BSP_H_ */ |
---|
198 | /* end of include file */ |
---|
199 | |
---|
200 | |
---|
201 | |
---|
202 | |
---|
203 | |
---|
204 | |
---|