1 |
30 |
unneback |
/*-------------------------------------------------------------------------+
|
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-1999.
|
31 |
|
|
| * On-Line Applications Research Corporation (OAR).
|
32 |
|
|
| *
|
33 |
|
|
| * The license and distribution terms for this file may be
|
34 |
|
|
| * found in found in the file LICENSE in this distribution or at
|
35 |
|
|
| * http://www.OARcorp.com/rtems/license.html.
|
36 |
|
|
| **************************************************************************
|
37 |
|
|
|
|
38 |
|
|
| $Id: bsp.h,v 1.2 2001-09-27 11:59:48 chris Exp $
|
39 |
|
|
+--------------------------------------------------------------------------*/
|
40 |
|
|
|
41 |
|
|
|
42 |
|
|
#ifndef __BSP_H_
|
43 |
|
|
#define __BSP_H_
|
44 |
|
|
|
45 |
|
|
#ifdef __cplusplus
|
46 |
|
|
extern "C" {
|
47 |
|
|
#endif
|
48 |
|
|
|
49 |
|
|
#include <rtems.h>
|
50 |
|
|
#include <iosupp.h>
|
51 |
|
|
#include <console.h>
|
52 |
|
|
#include <clockdrv.h>
|
53 |
|
|
#include <libcpu/cpu.h>
|
54 |
|
|
#include <bspIo.h>
|
55 |
|
|
|
56 |
|
|
/*
|
57 |
|
|
* confdefs.h overrides for this BSP:
|
58 |
|
|
* - number of termios serial ports
|
59 |
|
|
* - Interrupt stack space is not minimum if defined.
|
60 |
|
|
*/
|
61 |
|
|
|
62 |
|
|
#define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 1
|
63 |
|
|
#define CONFIGURE_INTERRUPT_STACK_MEMORY (4 * 1024)
|
64 |
|
|
|
65 |
|
|
/*
|
66 |
|
|
* Network driver configuration
|
67 |
|
|
*/
|
68 |
|
|
|
69 |
|
|
struct rtems_bsdnet_ifconfig;
|
70 |
|
|
extern int rtems_wd_driver_attach (struct rtems_bsdnet_ifconfig *config);
|
71 |
|
|
extern int rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config);
|
72 |
|
|
|
73 |
|
|
#if 0
|
74 |
|
|
#define RTEMS_BSP_NETWORK_DRIVER_NAME "wd1"
|
75 |
|
|
#define RTEMS_BSP_NETWORK_DRIVER_ATTACH rtems_wd_driver_attach
|
76 |
|
|
#endif
|
77 |
|
|
|
78 |
|
|
#if 1
|
79 |
|
|
#define RTEMS_BSP_NETWORK_DRIVER_NAME "dc1"
|
80 |
|
|
#define RTEMS_BSP_NETWORK_DRIVER_ATTACH rtems_dec21140_driver_attach
|
81 |
|
|
#endif
|
82 |
|
|
|
83 |
|
|
|
84 |
|
|
/*-------------------------------------------------------------------------+
|
85 |
|
|
| Constants
|
86 |
|
|
+--------------------------------------------------------------------------*/
|
87 |
|
|
#define BSP_LIBIO_MAX_FDS 20 /* Number of libio files we want. */
|
88 |
|
|
|
89 |
|
|
/*-------------------------------------------------------------------------+
|
90 |
|
|
| Video (console) related constants.
|
91 |
|
|
+--------------------------------------------------------------------------*/
|
92 |
|
|
|
93 |
|
|
#include <crt.h>
|
94 |
|
|
|
95 |
|
|
/*-------------------------------------------------------------------------+
|
96 |
|
|
| Constants relating to the 8254 (or 8253) programmable interval timers.
|
97 |
|
|
+--------------------------------------------------------------------------*/
|
98 |
|
|
#define IO_TIMER1 0x40
|
99 |
|
|
/* Port address of the control port and timer channels */
|
100 |
|
|
#define TIMER_CNTR0 (IO_TIMER1 + 0) /* timer 0 counter port */
|
101 |
|
|
#define TIMER_CNTR1 (IO_TIMER1 + 1) /* timer 1 counter port */
|
102 |
|
|
#define TIMER_CNTR2 (IO_TIMER1 + 2) /* timer 2 counter port */
|
103 |
|
|
#define TIMER_MODE (IO_TIMER1 + 3) /* timer mode port */
|
104 |
|
|
#define TIMER_SEL0 0x00 /* select counter 0 */
|
105 |
|
|
#define TIMER_SEL1 0x40 /* select counter 1 */
|
106 |
|
|
#define TIMER_SEL2 0x80 /* select counter 2 */
|
107 |
|
|
#define TIMER_INTTC 0x00 /* mode 0, intr on terminal cnt */
|
108 |
|
|
#define TIMER_ONESHOT 0x02 /* mode 1, one shot */
|
109 |
|
|
#define TIMER_RATEGEN 0x04 /* mode 2, rate generator */
|
110 |
|
|
#define TIMER_SQWAVE 0x06 /* mode 3, square wave */
|
111 |
|
|
#define TIMER_SWSTROBE 0x08 /* mode 4, s/w triggered strobe */
|
112 |
|
|
#define TIMER_HWSTROBE 0x0a /* mode 5, h/w triggered strobe */
|
113 |
|
|
#define TIMER_LATCH 0x00 /* latch counter for reading */
|
114 |
|
|
#define TIMER_LSB 0x10 /* r/w counter LSB */
|
115 |
|
|
#define TIMER_MSB 0x20 /* r/w counter MSB */
|
116 |
|
|
#define TIMER_16BIT 0x30 /* r/w counter 16 bits, LSB first */
|
117 |
|
|
#define TIMER_BCD 0x01 /* count in BCD */
|
118 |
|
|
|
119 |
|
|
#define TIMER_TICK 1193182 /* The internal tick rate in ticks per second */
|
120 |
|
|
|
121 |
|
|
/*-------------------------------------------------------------------------+
|
122 |
|
|
| Define the time limits for RTEMS Test Suite test durations. Long test and
|
123 |
|
|
| short test duration limits are provided. These values are in seconds and
|
124 |
|
|
| need to be converted to ticks for the application.
|
125 |
|
|
+--------------------------------------------------------------------------*/
|
126 |
|
|
#define MAX_LONG_TEST_DURATION 300 /* 5 minutes = 300 seconds */
|
127 |
|
|
#define MAX_SHORT_TEST_DURATION 3 /* 3 seconds */
|
128 |
|
|
|
129 |
|
|
/*-------------------------------------------------------------------------+
|
130 |
|
|
| Macros
|
131 |
|
|
+--------------------------------------------------------------------------*/
|
132 |
|
|
/*-------------------------------------------------------------------------+
|
133 |
|
|
| Define the interrupt mechanism for Time Test 27.
|
134 |
|
|
| NOTE: Use a software interrupt for the i386 family.
|
135 |
|
|
+--------------------------------------------------------------------------*/
|
136 |
|
|
#define MUST_WAIT_FOR_INTERRUPT 0
|
137 |
|
|
#define Install_tm27_vector(handler) \
|
138 |
|
|
{ \
|
139 |
|
|
rtems_isr_entry dummy; \
|
140 |
|
|
rtems_interrupt_catch(handler, 0x90, &dummy); \
|
141 |
|
|
}
|
142 |
|
|
#define Cause_tm27_intr() asm volatile("int $0x90" : :);
|
143 |
|
|
#define Clear_tm27_intr()
|
144 |
|
|
#define Lower_tm27_intr()
|
145 |
|
|
|
146 |
|
|
/* does anyone need this? if so, report it so we can rename this macro */
|
147 |
|
|
#if 0
|
148 |
|
|
/*-------------------------------------------------------------------------+
|
149 |
|
|
| Simple spin delay in microsecond units for device drivers.
|
150 |
|
|
| This is very dependent on the clock speed of the target.
|
151 |
|
|
+--------------------------------------------------------------------------*/
|
152 |
|
|
#define delay(_microseconds) \
|
153 |
|
|
{ \
|
154 |
|
|
rtems_unsigned32 _cnt = _microseconds; \
|
155 |
|
|
asm volatile ("0: nop; mov %0,%0; loop 0b" : "=c"(_cnt) : "0"(_cnt)); \
|
156 |
|
|
}
|
157 |
|
|
#endif
|
158 |
|
|
|
159 |
|
|
/*-------------------------------------------------------------------------+
|
160 |
|
|
| Convert microseconds to ticks and ticks to microseconds.
|
161 |
|
|
+--------------------------------------------------------------------------*/
|
162 |
|
|
#define US_TO_TICK(us) (((us)*105+44)/88)
|
163 |
|
|
#define TICK_TO_US(tk) (((tk)*88+52)/105)
|
164 |
|
|
|
165 |
|
|
/*-------------------------------------------------------------------------+
|
166 |
|
|
| External Variables.
|
167 |
|
|
+--------------------------------------------------------------------------*/
|
168 |
|
|
#define IDT_SIZE 256
|
169 |
|
|
#define GDT_SIZE 3
|
170 |
|
|
|
171 |
|
|
extern interrupt_gate_descriptor Interrupt_descriptor_table[IDT_SIZE];
|
172 |
|
|
extern segment_descriptors Global_descriptor_table [GDT_SIZE];
|
173 |
|
|
|
174 |
|
|
extern rtems_configuration_table BSP_Configuration;
|
175 |
|
|
/* User provided BSP configuration table. */
|
176 |
|
|
extern rtems_unsigned32 rtemsFreeMemStart;
|
177 |
|
|
/* Address of start of free memory - should be used when creating new
|
178 |
|
|
partitions or regions and updated afterwards. */
|
179 |
|
|
|
180 |
|
|
/*-------------------------------------------------------------------------+
|
181 |
|
|
| Function Prototypes.
|
182 |
|
|
+--------------------------------------------------------------------------*/
|
183 |
|
|
void _IBMPC_initVideo(void); /* from 'outch.c' */
|
184 |
|
|
void _IBMPC_outch (char); /* from 'outch.c' */
|
185 |
|
|
rtems_boolean _IBMPC_chrdy (char *); /* from 'inch.c' */
|
186 |
|
|
char _IBMPC_inch (void); /* from 'inch.c' */
|
187 |
|
|
char _IBMPC_inch_sleep (void); /* from 'inch.c' */
|
188 |
|
|
|
189 |
|
|
void printk(char *fmt, ...); /* from 'printk.c' */
|
190 |
|
|
|
191 |
|
|
void rtemsReboot(void); /* from 'exit.c' */
|
192 |
|
|
|
193 |
|
|
void Wait_X_ms(unsigned int timeToWait); /* from 'timer.c' */
|
194 |
|
|
|
195 |
|
|
|
196 |
|
|
/* Definitions for BSPConsolePort */
|
197 |
|
|
#define BSP_CONSOLE_PORT_CONSOLE (-1)
|
198 |
|
|
#define BSP_CONSOLE_PORT_COM1 (BSP_UART_COM1)
|
199 |
|
|
#define BSP_CONSOLE_PORT_COM2 (BSP_UART_COM2)
|
200 |
|
|
|
201 |
|
|
/* GDB stub stuff */
|
202 |
|
|
void i386_stub_glue_init(int uart);
|
203 |
|
|
void i386_stub_glue_init_breakin(void);
|
204 |
|
|
void set_debug_traps(void);
|
205 |
|
|
void breakpoint(void);
|
206 |
|
|
|
207 |
|
|
#ifdef __cplusplus
|
208 |
|
|
}
|
209 |
|
|
#endif
|
210 |
|
|
|
211 |
|
|
#endif /* __BSP_H_ */
|
212 |
|
|
/* end of include file */
|
213 |
|
|
|
214 |
|
|
|
215 |
|
|
|
216 |
|
|
|
217 |
|
|
|
218 |
|
|
|