source: rtems/c/src/lib/libbsp/i386/pc386/include/bsp.h @ 7150f00f

4.104.114.84.95
Last change on this file since 7150f00f was 7150f00f, checked in by Joel Sherrill <joel.sherrill@…>, on Dec 1, 1997 at 10:06:48 PM

Inclusion of PC386 BSP submitted by Pedro Miguel Da Cruz Neto Romano
<pmcnr@…> and Jose Rufino <ruf@…>
of NavIST (http://pandora.ist.utl.pt/).

  • 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| Disclaimer:
14|
15| This file is provided "AS IS" without warranty of any kind, either
16| expressed or implied.
17+--------------------------------------------------------------------------+
18| This code is based on:
19|   bsp.h,v 1.5 1995/12/19 20:07:30 joel Exp - go32 BSP
20| With the following copyright notice:
21| **************************************************************************
22| * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.                      *
23| * On-Line Applications Research Corporation (OAR).                       *
24| * All rights assigned to U.S. Government, 1994.                          *
25| *                                                                        *
26| * This material may be reproduced by or for the U.S. Government pursuant *
27| * to the copyright license under the clause at DFARS 252.227-7013.  This *
28| * notice must appear in all copies of this file and its derivatives.     *
29| **************************************************************************
30+--------------------------------------------------------------------------*/
31
32
33#ifndef __BSP_H_
34#define __BSP_H_
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40#include <rtems.h>
41#include <iosupp.h>
42#include <console.h>
43#include <clockdrv.h>
44
45/*-------------------------------------------------------------------------+
46| Constants
47+--------------------------------------------------------------------------*/
48#define BSP_LIBIO_MAX_FDS 20             /* Number of libio files we want.    */
49
50/*-------------------------------------------------------------------------+
51| Memory related constants.
52+--------------------------------------------------------------------------*/
53#ifdef RTEMS_SMALL_MEMORY                /* We only have low (640K) memory.   */
54
55#define RAM_START 0x00000
56#define RAM_END   0xA0000
57
58#else                                    /* We have at least 2048K of memory. */
59
60#define RAM_START 0x100000
61#define RAM_END   0x200000
62
63#endif /* RTEMS_SMALL_MEMORY */
64
65#define HEAP_SIZE 64  /* Size of libc Heap (used for malloc et al) in KBytes. */
66
67/*-------------------------------------------------------------------------+
68| Video (console) related constants.
69+--------------------------------------------------------------------------*/
70#define COLOUR  1  /* Assume colour console */
71
72#if COLOUR
73
74# define        GDC_REG_PORT    0x3D4
75# define        GDC_VAL_PORT    0x3D5
76# define        TVRAM           ((rtems_unsigned16 *)0xB8000)
77
78#else
79
80# define        GDC_REG_PORT    0x3B4
81# define        GDC_VAL_PORT    0x3B5
82# define        TVRAM           ((rtems_unsigned16 *)0xB0000)
83
84#endif /* COLOUR */
85
86/* Number of Video Lines & Columns */
87
88#define MAX_COL 80
89
90#ifdef RTEMS_VIDEO_80x50
91#define MAX_ROW 50
92#else
93#define MAX_ROW 25
94#endif /* RTEMS_VIDEO_80x50 */
95
96/*-------------------------------------------------------------------------+
97| Constants relating to the 8254 (or 8253) programmable interval timers.
98+--------------------------------------------------------------------------*/
99#define IO_TIMER1      0x40
100                  /* Port address of the control port and timer channels */
101#define TIMER_CNTR0    (IO_TIMER1 + 0) /* timer 0 counter port           */
102#define TIMER_CNTR1    (IO_TIMER1 + 1) /* timer 1 counter port           */
103#define TIMER_CNTR2    (IO_TIMER1 + 2) /* timer 2 counter port           */
104#define TIMER_MODE     (IO_TIMER1 + 3) /* timer mode port                */
105#define TIMER_SEL0     0x00            /* select counter 0               */
106#define TIMER_SEL1     0x40            /* select counter 1               */
107#define TIMER_SEL2     0x80            /* select counter 2               */
108#define TIMER_INTTC    0x00            /* mode 0, intr on terminal cnt   */
109#define TIMER_ONESHOT  0x02            /* mode 1, one shot               */
110#define TIMER_RATEGEN  0x04            /* mode 2, rate generator         */
111#define TIMER_SQWAVE   0x06            /* mode 3, square wave            */
112#define TIMER_SWSTROBE 0x08            /* mode 4, s/w triggered strobe   */
113#define TIMER_HWSTROBE 0x0a            /* mode 5, h/w triggered strobe   */
114#define TIMER_LATCH    0x00            /* latch counter for reading      */
115#define TIMER_LSB      0x10            /* r/w counter LSB                */
116#define TIMER_MSB      0x20            /* r/w counter MSB                */
117#define TIMER_16BIT    0x30            /* r/w counter 16 bits, LSB first */
118#define TIMER_BCD      0x01            /* count in BCD                   */
119
120#define TIMER_TICK     1193182  /* The internal tick rate in ticks per second */
121
122/*-------------------------------------------------------------------------+
123| Define the time limits for RTEMS Test Suite test durations. Long test and
124| short test duration limits are provided. These values are in seconds and
125| need to be converted to ticks for the application.
126+--------------------------------------------------------------------------*/
127#define MAX_LONG_TEST_DURATION       300  /* 5 minutes = 300 seconds */
128#define MAX_SHORT_TEST_DURATION      3    /* 3 seconds */
129
130/*-------------------------------------------------------------------------+
131| Macros
132+--------------------------------------------------------------------------*/
133/*-------------------------------------------------------------------------+
134| Define the interrupt mechanism for Time Test 27.
135| NOTE: Use a software interrupt for the i386 family.
136+--------------------------------------------------------------------------*/
137#define MUST_WAIT_FOR_INTERRUPT 0
138#define Install_tm27_vector(handler) \
139{ \
140  rtems_isr_entry dummy; \
141  rtems_interrupt_catch(handler, 0x90, &dummy); \
142}
143#define Cause_tm27_intr() asm volatile("int $0x90" : :);
144#define Clear_tm27_intr()
145#define Lower_tm27_intr()
146
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 delay(_microseconds) \
152{ \
153  rtems_unsigned32 _cnt = _microseconds; \
154  asm volatile ("0: nop; mov %0,%0; loop 0b" : "=c"(_cnt) : "0"(_cnt)); \
155}
156
157/*-------------------------------------------------------------------------+
158| Convert microseconds to ticks and ticks to microseconds.
159+--------------------------------------------------------------------------*/
160#define US_TO_TICK(us) (((us)*105+44)/88)
161#define TICK_TO_US(tk) (((tk)*88+52)/105)
162
163/*-------------------------------------------------------------------------+
164| External Variables.
165+--------------------------------------------------------------------------*/
166extern i386_IDT_slot Interrupt_descriptor_table[256];
167extern i386_GDT_slot Global_descriptor_table   [8192];
168 
169extern rtems_configuration_table BSP_Configuration;
170                                    /* User provided BSP configuration table. */
171extern rtems_unsigned32          rtemsFreeMemStart;
172  /* Address of start of free memory - should be used when creating new
173     partitions or regions and updated afterwards. */
174
175/*-------------------------------------------------------------------------+
176| Function Prototypes.
177+--------------------------------------------------------------------------*/
178void          _IBMPC_initVideo(void);    /* from 'outch.c'  */
179void          _IBMPC_outch    (char);    /* from 'outch.c'  */
180rtems_boolean _IBMPC_chrdy    (char *);  /* from 'inch.c'   */
181char          _IBMPC_inch     (void);    /* from 'inch.c'   */ 
182
183void printk(char *fmt, ...);             /* from 'printk.c' */
184
185void rtemsReboot(void);                  /* from 'exit.c'   */
186
187#ifdef __cplusplus
188}
189#endif
190
191#endif /* __BSP_H_ */
192/* end of include file */
Note: See TracBrowser for help on using the repository browser.