source: rtems/c/src/lib/libbsp/i386/pc386/include/bsp.h @ 67a2288

4.104.114.84.95
Last change on this file since 67a2288 was 67a2288, checked in by Joel Sherrill <joel.sherrill@…>, on 07/23/98 at 22:02:34

Patch from Eric VALETTE <valette@…>:

Here is a enhanced version of my previous patch. This patch enables
to potentially share the new interrupt management code for all Intel targets
(pc386, go32 and force386) bsp.

Note : this patch is complete only for pc386. It still needs to

be completed for go32 and force386. I carrefully checked
that anything needed is in for force386 (only some function
name changes for IDT manipulation and GDT segment
manipulation). But anyway I will not be able to test any
of theses targets...

  • Property mode set to 100644
File size: 7.6 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-1998.
31| *  On-Line Applications Research Corporation (OAR).
32| *  Copyright assigned to U.S. Government, 1994.
33| *
34| *  The license and distribution terms for this file may be
35| *  found in found in the file LICENSE in this distribution or at
36| *  http://www.OARcorp.com/rtems/license.html.
37| **************************************************************************
38|
39|  $Id$
40+--------------------------------------------------------------------------*/
41
42
43#ifndef __BSP_H_
44#define __BSP_H_
45
46#ifdef __cplusplus
47extern "C" {
48#endif
49
50#include <rtems.h>
51#include <iosupp.h>
52#include <console.h>
53#include <clockdrv.h>
54#include <libcpu/cpu.h>
55 
56/*-------------------------------------------------------------------------+
57| Constants
58+--------------------------------------------------------------------------*/
59#define BSP_LIBIO_MAX_FDS 20             /* Number of libio files we want.    */
60
61/*-------------------------------------------------------------------------+
62| Video (console) related constants.
63+--------------------------------------------------------------------------*/
64
65#include <crt.h> 
66 
67/*-------------------------------------------------------------------------+
68| Constants relating to the 8254 (or 8253) programmable interval timers.
69+--------------------------------------------------------------------------*/
70#define IO_TIMER1      0x40
71                  /* Port address of the control port and timer channels */
72#define TIMER_CNTR0    (IO_TIMER1 + 0) /* timer 0 counter port           */
73#define TIMER_CNTR1    (IO_TIMER1 + 1) /* timer 1 counter port           */
74#define TIMER_CNTR2    (IO_TIMER1 + 2) /* timer 2 counter port           */
75#define TIMER_MODE     (IO_TIMER1 + 3) /* timer mode port                */
76#define TIMER_SEL0     0x00            /* select counter 0               */
77#define TIMER_SEL1     0x40            /* select counter 1               */
78#define TIMER_SEL2     0x80            /* select counter 2               */
79#define TIMER_INTTC    0x00            /* mode 0, intr on terminal cnt   */
80#define TIMER_ONESHOT  0x02            /* mode 1, one shot               */
81#define TIMER_RATEGEN  0x04            /* mode 2, rate generator         */
82#define TIMER_SQWAVE   0x06            /* mode 3, square wave            */
83#define TIMER_SWSTROBE 0x08            /* mode 4, s/w triggered strobe   */
84#define TIMER_HWSTROBE 0x0a            /* mode 5, h/w triggered strobe   */
85#define TIMER_LATCH    0x00            /* latch counter for reading      */
86#define TIMER_LSB      0x10            /* r/w counter LSB                */
87#define TIMER_MSB      0x20            /* r/w counter MSB                */
88#define TIMER_16BIT    0x30            /* r/w counter 16 bits, LSB first */
89#define TIMER_BCD      0x01            /* count in BCD                   */
90
91#define TIMER_TICK     1193182  /* The internal tick rate in ticks per second */
92
93/*-------------------------------------------------------------------------+
94| Define the time limits for RTEMS Test Suite test durations. Long test and
95| short test duration limits are provided. These values are in seconds and
96| need to be converted to ticks for the application.
97+--------------------------------------------------------------------------*/
98#define MAX_LONG_TEST_DURATION       300  /* 5 minutes = 300 seconds */
99#define MAX_SHORT_TEST_DURATION      3    /* 3 seconds */
100
101/*-------------------------------------------------------------------------+
102| Macros
103+--------------------------------------------------------------------------*/
104/*-------------------------------------------------------------------------+
105| Define the interrupt mechanism for Time Test 27.
106| NOTE: Use a software interrupt for the i386 family.
107+--------------------------------------------------------------------------*/
108#define MUST_WAIT_FOR_INTERRUPT 0
109#define Install_tm27_vector(handler) \
110{ \
111  rtems_isr_entry dummy; \
112  rtems_interrupt_catch(handler, 0x90, &dummy); \
113}
114#define Cause_tm27_intr() asm volatile("int $0x90" : :);
115#define Clear_tm27_intr()
116#define Lower_tm27_intr()
117
118/*-------------------------------------------------------------------------+
119| Simple spin delay in microsecond units for device drivers.
120| This is very dependent on the clock speed of the target.
121+--------------------------------------------------------------------------*/
122#define delay(_microseconds) \
123{ \
124  rtems_unsigned32 _cnt = _microseconds; \
125  asm volatile ("0: nop; mov %0,%0; loop 0b" : "=c"(_cnt) : "0"(_cnt)); \
126}
127
128/*-------------------------------------------------------------------------+
129| Convert microseconds to ticks and ticks to microseconds.
130+--------------------------------------------------------------------------*/
131#define US_TO_TICK(us) (((us)*105+44)/88)
132#define TICK_TO_US(tk) (((tk)*88+52)/105)
133
134/*-------------------------------------------------------------------------+
135| External Variables.
136+--------------------------------------------------------------------------*/
137#define IDT_SIZE 256
138#define GDT_SIZE 3
139
140extern interrupt_gate_descriptor Interrupt_descriptor_table[IDT_SIZE];
141extern segment_descriptors Global_descriptor_table   [GDT_SIZE];
142 
143extern rtems_configuration_table BSP_Configuration;
144                                    /* User provided BSP configuration table. */
145extern rtems_unsigned32          rtemsFreeMemStart;
146  /* Address of start of free memory - should be used when creating new
147     partitions or regions and updated afterwards. */
148
149/*-------------------------------------------------------------------------+
150| Function Prototypes.
151+--------------------------------------------------------------------------*/
152void          _IBMPC_initVideo(void);    /* from 'outch.c'  */
153void          _IBMPC_outch    (char);    /* from 'outch.c'  */
154rtems_boolean _IBMPC_chrdy    (char *);  /* from 'inch.c'   */
155char          _IBMPC_inch     (void);    /* from 'inch.c'   */
156char          _IBMPC_inch_sleep (void);  /* from 'inch.c'   */
157
158void printk(char *fmt, ...);             /* from 'printk.c' */
159
160void rtemsReboot(void);                  /* from 'exit.c'   */
161
162/* Definitions for PC386ConsolePort */
163#define PC386_CONSOLE_PORT_CONSOLE (-1)
164#define PC386_CONSOLE_PORT_COM1    (PC386_UART_COM1)
165#define PC386_CONSOLE_PORT_COM2    (PC386_UART_COM2)
166
167/* GDB stub stuff */
168void i386_stub_glue_init(int uart);
169void i386_stub_glue_init_breakin(void);
170void set_debug_traps(void);
171void breakpoint(void);
172
173#ifdef __cplusplus
174}
175#endif
176
177#endif /* __BSP_H_ */
178/* end of include file */
179
180
181
182
183
184
Note: See TracBrowser for help on using the repository browser.