source: rtems/c/src/lib/libbsp/i386/pc386/include/bsp.h @ 34c4852

4.104.114.84.95
Last change on this file since 34c4852 was 34c4852, checked in by Ralf Corsepius <ralf.corsepius@…>, on 05/26/05 at 05:36:48

2005-05-26 Ralf Corsepius <ralf.corsepius@…>

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