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-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.rtems.com/license/LICENSE. |
---|
36 | | ************************************************************************** |
---|
37 | | |
---|
38 | | $Id$ |
---|
39 | +--------------------------------------------------------------------------*/ |
---|
40 | |
---|
41 | #ifndef _BSP_H |
---|
42 | #define _BSP_H |
---|
43 | |
---|
44 | #ifdef __cplusplus |
---|
45 | extern "C" { |
---|
46 | #endif |
---|
47 | |
---|
48 | #include <bspopts.h> |
---|
49 | |
---|
50 | #include <rtems.h> |
---|
51 | #include <rtems/iosupp.h> |
---|
52 | #include <rtems/console.h> |
---|
53 | #include <rtems/clockdrv.h> |
---|
54 | #include <libcpu/cpu.h> |
---|
55 | #include <rtems/bspIo.h> |
---|
56 | |
---|
57 | /* |
---|
58 | * confdefs.h overrides for this BSP: |
---|
59 | * - number of termios serial ports |
---|
60 | * - Interrupt stack space is not minimum if defined. |
---|
61 | */ |
---|
62 | |
---|
63 | #define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 1 |
---|
64 | |
---|
65 | /* |
---|
66 | * Network driver configuration |
---|
67 | */ |
---|
68 | |
---|
69 | struct rtems_bsdnet_ifconfig; |
---|
70 | |
---|
71 | extern int rtems_ne_driver_attach(struct rtems_bsdnet_ifconfig *, int); |
---|
72 | #define BSP_NE2000_NETWORK_DRIVER_NAME "ne1" |
---|
73 | #define BSP_NE2000_NETWORK_DRIVER_ATTACH rtems_ne_driver_attach |
---|
74 | |
---|
75 | extern int rtems_wd_driver_attach(struct rtems_bsdnet_ifconfig *, int); |
---|
76 | #define BSP_WD8003_NETWORK_DRIVER_NAME "wd1" |
---|
77 | #define BSP_WD8003_NETWORK_DRIVER_ATTACH rtems_wd_driver_attach |
---|
78 | |
---|
79 | extern int rtems_dec21140_driver_attach(struct rtems_bsdnet_ifconfig *, int); |
---|
80 | #define BSP_DEC21140_NETWORK_DRIVER_NAME "dc1" |
---|
81 | #define BSP_DEC21140_NETWORK_DRIVER_ATTACH rtems_dec21140_driver_attach |
---|
82 | |
---|
83 | #ifndef RTEMS_BSP_NETWORK_DRIVER_NAME |
---|
84 | #define RTEMS_BSP_NETWORK_DRIVER_NAME BSP_DEC21140_NETWORK_DRIVER_NAME |
---|
85 | #endif |
---|
86 | |
---|
87 | #ifndef RTEMS_BSP_NETWORK_DRIVER_ATTACH |
---|
88 | #define RTEMS_BSP_NETWORK_DRIVER_ATTACH BSP_DEC21140_NETWORK_DRIVER_ATTACH |
---|
89 | #endif |
---|
90 | |
---|
91 | /*-------------------------------------------------------------------------+ |
---|
92 | | Constants |
---|
93 | +--------------------------------------------------------------------------*/ |
---|
94 | |
---|
95 | /*-------------------------------------------------------------------------+ |
---|
96 | | Video (console) related constants. |
---|
97 | +--------------------------------------------------------------------------*/ |
---|
98 | |
---|
99 | #include <crt.h> |
---|
100 | |
---|
101 | /*-------------------------------------------------------------------------+ |
---|
102 | | Constants relating to the 8254 (or 8253) programmable interval timers. |
---|
103 | +--------------------------------------------------------------------------*/ |
---|
104 | #define IO_TIMER1 0x40 |
---|
105 | /* Port address of the control port and timer channels */ |
---|
106 | #define TIMER_CNTR0 (IO_TIMER1 + 0) /* timer 0 counter port */ |
---|
107 | #define TIMER_CNTR1 (IO_TIMER1 + 1) /* timer 1 counter port */ |
---|
108 | #define TIMER_CNTR2 (IO_TIMER1 + 2) /* timer 2 counter port */ |
---|
109 | #define TIMER_MODE (IO_TIMER1 + 3) /* timer mode port */ |
---|
110 | #define TIMER_SEL0 0x00 /* select counter 0 */ |
---|
111 | #define TIMER_SEL1 0x40 /* select counter 1 */ |
---|
112 | #define TIMER_SEL2 0x80 /* select counter 2 */ |
---|
113 | #define TIMER_INTTC 0x00 /* mode 0, intr on terminal cnt */ |
---|
114 | #define TIMER_ONESHOT 0x02 /* mode 1, one shot */ |
---|
115 | #define TIMER_RATEGEN 0x04 /* mode 2, rate generator */ |
---|
116 | #define TIMER_SQWAVE 0x06 /* mode 3, square wave */ |
---|
117 | #define TIMER_SWSTROBE 0x08 /* mode 4, s/w triggered strobe */ |
---|
118 | #define TIMER_HWSTROBE 0x0a /* mode 5, h/w triggered strobe */ |
---|
119 | #define TIMER_LATCH 0x00 /* latch counter for reading */ |
---|
120 | #define TIMER_LSB 0x10 /* r/w counter LSB */ |
---|
121 | #define TIMER_MSB 0x20 /* r/w counter MSB */ |
---|
122 | #define TIMER_16BIT 0x30 /* r/w counter 16 bits, LSB first */ |
---|
123 | #define TIMER_BCD 0x01 /* count in BCD */ |
---|
124 | #define TIMER_RD_BACK 0xc0 /* Read Back Command */ |
---|
125 | /* READ BACK command layout in the Command Register */ |
---|
126 | #define RB_NOT_COUNT 0x40 /* Don't select counter latch */ |
---|
127 | #define RB_NOT_STATUS 0x20 /* Don't select status latch */ |
---|
128 | #define RB_COUNT_0 0x02 /* Counter 0 latch */ |
---|
129 | #define RB_COUNT_1 0x04 /* Counter 1 latch */ |
---|
130 | #define RB_COUNT_2 0x08 /* Counter 2 latch */ |
---|
131 | #define RB_OUTPUT 0x80 /* Output of the counter is 1 */ |
---|
132 | |
---|
133 | #define TIMER_TICK 1193182 /* The internal tick rate in ticks per second */ |
---|
134 | |
---|
135 | /*-------------------------------------------------------------------------+ |
---|
136 | | Macros |
---|
137 | +--------------------------------------------------------------------------*/ |
---|
138 | /* does anyone need this? if so, report it so we can rename this macro */ |
---|
139 | #if 0 |
---|
140 | /*-------------------------------------------------------------------------+ |
---|
141 | | Simple spin delay in microsecond units for device drivers. |
---|
142 | | This is very dependent on the clock speed of the target. |
---|
143 | +--------------------------------------------------------------------------*/ |
---|
144 | #define rtems_bsp_delay(_microseconds) \ |
---|
145 | { \ |
---|
146 | uint32_t _cnt = _microseconds; \ |
---|
147 | asm volatile ("0: nop; mov %0,%0; loop 0b" : "=c"(_cnt) : "0"(_cnt)); \ |
---|
148 | } |
---|
149 | #endif |
---|
150 | |
---|
151 | /*-------------------------------------------------------------------------+ |
---|
152 | | Convert microseconds to ticks and ticks to microseconds. |
---|
153 | +--------------------------------------------------------------------------*/ |
---|
154 | #define US_TO_TICK(us) (((us)*105+44)/88) |
---|
155 | #define TICK_TO_US(tk) (((tk)*88+52)/105) |
---|
156 | |
---|
157 | /*-------------------------------------------------------------------------+ |
---|
158 | | External Variables. |
---|
159 | +--------------------------------------------------------------------------*/ |
---|
160 | #define IDT_SIZE 256 |
---|
161 | #define GDT_SIZE 3 |
---|
162 | |
---|
163 | extern interrupt_gate_descriptor Interrupt_descriptor_table[IDT_SIZE]; |
---|
164 | extern segment_descriptors Global_descriptor_table [GDT_SIZE]; |
---|
165 | |
---|
166 | extern uint32_t rtemsFreeMemStart; |
---|
167 | /* Address of start of free memory - should be used when creating new |
---|
168 | partitions or regions and updated afterwards. */ |
---|
169 | |
---|
170 | /*-------------------------------------------------------------------------+ |
---|
171 | | Function Prototypes. |
---|
172 | +--------------------------------------------------------------------------*/ |
---|
173 | void _IBMPC_initVideo(void); /* from 'outch.c' */ |
---|
174 | void _IBMPC_outch (char); /* from 'outch.c' */ |
---|
175 | char _IBMPC_inch (void); /* from 'inch.c' */ |
---|
176 | char _IBMPC_inch_sleep (void); /* from 'inch.c' */ |
---|
177 | |
---|
178 | void rtemsReboot(void); /* from 'exit.c' */ |
---|
179 | |
---|
180 | void Wait_X_ms(unsigned int timeToWait); /* from 'timer.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 | /* |
---|
188 | * indicate, that BSP has IDE driver |
---|
189 | */ |
---|
190 | #define RTEMS_BSP_HAS_IDE_DRIVER |
---|
191 | |
---|
192 | /* GDB stub stuff */ |
---|
193 | void i386_stub_glue_init(int uart); |
---|
194 | void i386_stub_glue_init_breakin(void); |
---|
195 | void set_debug_traps(void); |
---|
196 | void breakpoint(void); |
---|
197 | |
---|
198 | #ifdef __cplusplus |
---|
199 | } |
---|
200 | #endif |
---|
201 | |
---|
202 | #endif /* _BSP_H */ |
---|