source: rtems/c/src/lib/libbsp/i386/pc386/include/bsp.h @ 084879d

4.104.114.84.95
Last change on this file since 084879d was 45805cc, checked in by Joel Sherrill <joel.sherrill@…>, on 01/06/02 at 20:06:53

2002-01-03 Ralf Corsepius <corsepiu@…>

  • include/bsp.h: Include rtems/bspIo.h instead of bspIo.h.
  • Property mode set to 100644
File size: 9.3 KB
Line 
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.OARcorp.com/rtems/license.html.
36| **************************************************************************
37|
38|  $Id$
39+--------------------------------------------------------------------------*/
40
41
42#ifndef __BSP_H_
43#define __BSP_H_
44
45#ifdef __cplusplus
46extern "C" {
47#endif
48
49#include <bspopts.h>
50
51#include <rtems.h>
52#include <iosupp.h>
53#include <console.h>
54#include <clockdrv.h>
55#include <libcpu/cpu.h>
56#include <rtems/bspIo.h>
57 
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
65
66#if STACK_MINIMUM_SIZE < (4 * 1024)
67#define CONFIGURE_INTERRUPT_STACK_MEMORY  (4 * 1024)
68#else
69#define CONFIGURE_INTERRUPT_STACK_MEMORY STACK_MINIMUM_SIZE
70#endif
71
72/*
73 * Network driver configuration
74 */
75
76struct rtems_bsdnet_ifconfig;
77
78extern 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
81
82extern 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
86extern 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
89
90#define RTEMS_BSP_NETWORK_DRIVER_NAME   BSP_DEC21140_NETWORK_DRIVER_NAME
91#define RTEMS_BSP_NETWORK_DRIVER_ATTACH BSP_DEC21140_NETWORK_DRIVER_ATTACH
92
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
102#include <crt.h> 
103 
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                   */
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     */
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
163/* does anyone need this? if so, report it so we can rename this macro */
164#if 0
165/*-------------------------------------------------------------------------+
166| Simple spin delay in microsecond units for device drivers.
167| This is very dependent on the clock speed of the target.
168+--------------------------------------------------------------------------*/
169#define rtems_bsp_delay(_microseconds) \
170{ \
171  rtems_unsigned32 _cnt = _microseconds; \
172  asm volatile ("0: nop; mov %0,%0; loop 0b" : "=c"(_cnt) : "0"(_cnt)); \
173}
174#endif
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+--------------------------------------------------------------------------*/
185#define IDT_SIZE 256
186#define GDT_SIZE 3
187
188extern interrupt_gate_descriptor Interrupt_descriptor_table[IDT_SIZE];
189extern segment_descriptors Global_descriptor_table   [GDT_SIZE];
190 
191extern rtems_configuration_table BSP_Configuration;
192                                    /* User provided BSP configuration table. */
193extern 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+--------------------------------------------------------------------------*/
200void          _IBMPC_initVideo(void);    /* from 'outch.c'  */
201void          _IBMPC_outch    (char);    /* from 'outch.c'  */
202rtems_boolean _IBMPC_chrdy    (char *);  /* from 'inch.c'   */
203char          _IBMPC_inch     (void);    /* from 'inch.c'   */
204char          _IBMPC_inch_sleep (void);  /* from 'inch.c'   */
205
206void printk(char *fmt, ...);             /* from 'printk.c' */
207
208void rtemsReboot(void);                  /* from 'exit.c'   */
209
210void Wait_X_ms(unsigned int timeToWait); /* from 'timer.c'  */
211
212
213/* Definitions for BSPConsolePort */
214#define BSP_CONSOLE_PORT_CONSOLE (-1)
215#define BSP_CONSOLE_PORT_COM1    (BSP_UART_COM1)
216#define BSP_CONSOLE_PORT_COM2    (BSP_UART_COM2)
217
218/* GDB stub stuff */
219void i386_stub_glue_init(int uart);
220void i386_stub_glue_init_breakin(void);
221void set_debug_traps(void);
222void breakpoint(void);
223
224#ifdef __cplusplus
225}
226#endif
227
228#endif /* __BSP_H_ */
229/* end of include file */
230
231
232
233
234
235
Note: See TracBrowser for help on using the repository browser.