source: rtems/c/src/lib/libbsp/i386/pc386/include/bsp.h @ 96d56b3

4.104.114.84.95
Last change on this file since 96d56b3 was 96d56b3, checked in by Joel Sherrill <joel.sherrill@…>, on 04/27/98 at 18:42:04

Update from Pedro Romano <pmcnr@…>.

  • Property mode set to 100644
File size: 7.6 KB
RevLine 
[7150f00f]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| **************************************************************************
[60b791ad]22| *  COPYRIGHT (c) 1989-1998.
[6f9c75c3]23| *  On-Line Applications Research Corporation (OAR).
24| *  Copyright assigned to U.S. Government, 1994.
25| *
26| *  The license and distribution terms for this file may be
27| *  found in found in the file LICENSE in this distribution or at
28| *  http://www.OARcorp.com/rtems/license.html.
[7150f00f]29| **************************************************************************
[6f9c75c3]30|
31|  $Id$
[7150f00f]32+--------------------------------------------------------------------------*/
33
34
35#ifndef __BSP_H_
36#define __BSP_H_
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
42#include <rtems.h>
43#include <iosupp.h>
44#include <console.h>
45#include <clockdrv.h>
46
47/*-------------------------------------------------------------------------+
48| Constants
49+--------------------------------------------------------------------------*/
50#define BSP_LIBIO_MAX_FDS 20             /* Number of libio files we want.    */
51
52/*-------------------------------------------------------------------------+
53| Memory related constants.
54+--------------------------------------------------------------------------*/
55#define HEAP_SIZE 64  /* Size of libc Heap (used for malloc et al) in KBytes. */
56
57/*-------------------------------------------------------------------------+
58| Video (console) related constants.
59+--------------------------------------------------------------------------*/
60#define COLOUR  1  /* Assume colour console */
61
62#if COLOUR
63
64# define        GDC_REG_PORT    0x3D4
65# define        GDC_VAL_PORT    0x3D5
66# define        TVRAM           ((rtems_unsigned16 *)0xB8000)
67
68#else
69
70# define        GDC_REG_PORT    0x3B4
71# define        GDC_VAL_PORT    0x3B5
72# define        TVRAM           ((rtems_unsigned16 *)0xB0000)
73
74#endif /* COLOUR */
75
76/* Number of Video Lines & Columns */
77
78#define MAX_COL 80
79
80#ifdef RTEMS_VIDEO_80x50
81#define MAX_ROW 50
82#else
83#define MAX_ROW 25
84#endif /* RTEMS_VIDEO_80x50 */
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+--------------------------------------------------------------------------*/
156extern i386_IDT_slot Interrupt_descriptor_table[256];
157extern i386_GDT_slot Global_descriptor_table   [8192];
158 
159extern rtems_configuration_table BSP_Configuration;
160                                    /* User provided BSP configuration table. */
161extern rtems_unsigned32          rtemsFreeMemStart;
162  /* Address of start of free memory - should be used when creating new
163     partitions or regions and updated afterwards. */
164
165/*-------------------------------------------------------------------------+
166| Function Prototypes.
167+--------------------------------------------------------------------------*/
168void          _IBMPC_initVideo(void);    /* from 'outch.c'  */
169void          _IBMPC_outch    (char);    /* from 'outch.c'  */
170rtems_boolean _IBMPC_chrdy    (char *);  /* from 'inch.c'   */
171char          _IBMPC_inch     (void);    /* from 'inch.c'   */
172
173void printk(char *fmt, ...);             /* from 'printk.c' */
174
175void rtemsReboot(void);                  /* from 'exit.c'   */
176
177#ifdef __cplusplus
178}
179#endif
180
181#endif /* __BSP_H_ */
182/* end of include file */
Note: See TracBrowser for help on using the repository browser.