source: rtems/c/src/lib/libbsp/i386/pc386/include/bsp.h @ 4e36a2f

4.104.114.84.95
Last change on this file since 4e36a2f was 08311cc3, checked in by Joel Sherrill <joel.sherrill@…>, on 11/17/99 at 17:51:34

Updated copyright notice.

  • Property mode set to 100644
File size: 8.1 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 <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 * Network driver configuration
58 */
59
60struct rtems_bsdnet_ifconfig;
61extern int rtems_wd_driver_attach (struct rtems_bsdnet_ifconfig *config);
62extern int rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config);
63
64#if 0
65#define RTEMS_BSP_NETWORK_DRIVER_NAME "wd1"
66#define RTEMS_BSP_NETWORK_DRIVER_ATTACH       rtems_wd_driver_attach
67#endif
68
69#if 1
70#define RTEMS_BSP_NETWORK_DRIVER_NAME "dc1"
71#define RTEMS_BSP_NETWORK_DRIVER_ATTACH       rtems_dec21140_driver_attach
72#endif
73
74
75/*-------------------------------------------------------------------------+
76| Constants
77+--------------------------------------------------------------------------*/
78#define BSP_LIBIO_MAX_FDS 20             /* Number of libio files we want.    */
79
80/*-------------------------------------------------------------------------+
81| Video (console) related constants.
82+--------------------------------------------------------------------------*/
83
84#include <crt.h> 
85 
86/*-------------------------------------------------------------------------+
87| Constants relating to the 8254 (or 8253) programmable interval timers.
88+--------------------------------------------------------------------------*/
89#define IO_TIMER1      0x40
90                  /* Port address of the control port and timer channels */
91#define TIMER_CNTR0    (IO_TIMER1 + 0) /* timer 0 counter port           */
92#define TIMER_CNTR1    (IO_TIMER1 + 1) /* timer 1 counter port           */
93#define TIMER_CNTR2    (IO_TIMER1 + 2) /* timer 2 counter port           */
94#define TIMER_MODE     (IO_TIMER1 + 3) /* timer mode port                */
95#define TIMER_SEL0     0x00            /* select counter 0               */
96#define TIMER_SEL1     0x40            /* select counter 1               */
97#define TIMER_SEL2     0x80            /* select counter 2               */
98#define TIMER_INTTC    0x00            /* mode 0, intr on terminal cnt   */
99#define TIMER_ONESHOT  0x02            /* mode 1, one shot               */
100#define TIMER_RATEGEN  0x04            /* mode 2, rate generator         */
101#define TIMER_SQWAVE   0x06            /* mode 3, square wave            */
102#define TIMER_SWSTROBE 0x08            /* mode 4, s/w triggered strobe   */
103#define TIMER_HWSTROBE 0x0a            /* mode 5, h/w triggered strobe   */
104#define TIMER_LATCH    0x00            /* latch counter for reading      */
105#define TIMER_LSB      0x10            /* r/w counter LSB                */
106#define TIMER_MSB      0x20            /* r/w counter MSB                */
107#define TIMER_16BIT    0x30            /* r/w counter 16 bits, LSB first */
108#define TIMER_BCD      0x01            /* count in BCD                   */
109
110#define TIMER_TICK     1193182  /* The internal tick rate in ticks per second */
111
112/*-------------------------------------------------------------------------+
113| Define the time limits for RTEMS Test Suite test durations. Long test and
114| short test duration limits are provided. These values are in seconds and
115| need to be converted to ticks for the application.
116+--------------------------------------------------------------------------*/
117#define MAX_LONG_TEST_DURATION       300  /* 5 minutes = 300 seconds */
118#define MAX_SHORT_TEST_DURATION      3    /* 3 seconds */
119
120/*-------------------------------------------------------------------------+
121| Macros
122+--------------------------------------------------------------------------*/
123/*-------------------------------------------------------------------------+
124| Define the interrupt mechanism for Time Test 27.
125| NOTE: Use a software interrupt for the i386 family.
126+--------------------------------------------------------------------------*/
127#define MUST_WAIT_FOR_INTERRUPT 0
128#define Install_tm27_vector(handler) \
129{ \
130  rtems_isr_entry dummy; \
131  rtems_interrupt_catch(handler, 0x90, &dummy); \
132}
133#define Cause_tm27_intr() asm volatile("int $0x90" : :);
134#define Clear_tm27_intr()
135#define Lower_tm27_intr()
136
137/*-------------------------------------------------------------------------+
138| Simple spin delay in microsecond units for device drivers.
139| This is very dependent on the clock speed of the target.
140+--------------------------------------------------------------------------*/
141#define delay(_microseconds) \
142{ \
143  rtems_unsigned32 _cnt = _microseconds; \
144  asm volatile ("0: nop; mov %0,%0; loop 0b" : "=c"(_cnt) : "0"(_cnt)); \
145}
146
147/*-------------------------------------------------------------------------+
148| Convert microseconds to ticks and ticks to microseconds.
149+--------------------------------------------------------------------------*/
150#define US_TO_TICK(us) (((us)*105+44)/88)
151#define TICK_TO_US(tk) (((tk)*88+52)/105)
152
153/*-------------------------------------------------------------------------+
154| External Variables.
155+--------------------------------------------------------------------------*/
156#define IDT_SIZE 256
157#define GDT_SIZE 3
158
159extern interrupt_gate_descriptor Interrupt_descriptor_table[IDT_SIZE];
160extern segment_descriptors Global_descriptor_table   [GDT_SIZE];
161 
162extern rtems_configuration_table BSP_Configuration;
163                                    /* User provided BSP configuration table. */
164extern rtems_unsigned32          rtemsFreeMemStart;
165  /* Address of start of free memory - should be used when creating new
166     partitions or regions and updated afterwards. */
167
168/*-------------------------------------------------------------------------+
169| Function Prototypes.
170+--------------------------------------------------------------------------*/
171void          _IBMPC_initVideo(void);    /* from 'outch.c'  */
172void          _IBMPC_outch    (char);    /* from 'outch.c'  */
173rtems_boolean _IBMPC_chrdy    (char *);  /* from 'inch.c'   */
174char          _IBMPC_inch     (void);    /* from 'inch.c'   */
175char          _IBMPC_inch_sleep (void);  /* from 'inch.c'   */
176
177void printk(char *fmt, ...);             /* from 'printk.c' */
178
179void rtemsReboot(void);                  /* from 'exit.c'   */
180
181void Wait_X_ms(unsigned int timeToWait); /* from 'timer.c'  */
182
183
184/* Definitions for BSPConsolePort */
185#define BSP_CONSOLE_PORT_CONSOLE (-1)
186#define BSP_CONSOLE_PORT_COM1    (BSP_UART_COM1)
187#define BSP_CONSOLE_PORT_COM2    (BSP_UART_COM2)
188
189/* GDB stub stuff */
190void i386_stub_glue_init(int uart);
191void i386_stub_glue_init_breakin(void);
192void set_debug_traps(void);
193void breakpoint(void);
194
195#ifdef __cplusplus
196}
197#endif
198
199#endif /* __BSP_H_ */
200/* end of include file */
201
202
203
204
205
206
Note: See TracBrowser for help on using the repository browser.