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