source: rtems/c/src/lib/libbsp/i386/go32/include/bsp.h @ 98e4ebf

4.104.114.84.95
Last change on this file since 98e4ebf was 98e4ebf, checked in by Joel Sherrill <joel.sherrill@…>, on Oct 8, 1997 at 3:45:54 PM

Fixed typo in the pointer to the license terms.

  • Property mode set to 100644
File size: 4.5 KB
Line 
1/*  bsp.h
2 *
3 *  This include file definitions related to the ibm386 (go32) board.
4 *
5 *  COPYRIGHT (c) 1989-1997.
6 *  On-Line Applications Research Corporation (OAR).
7 *  Copyright assigned to U.S. Government, 1994.
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.OARcorp.com/rtems/license.html.
12 *
13 *  $Id$
14 */
15
16#ifndef __IBMPC_h
17#define __IBMPC_h
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23#include <rtems.h>
24#include <iosupp.h>
25#include <console.h>
26#include <clockdrv.h>
27
28/*
29 *  Define the time limits for RTEMS Test Suite test durations.
30 *  Long test and short test duration limits are provided.  These
31 *  values are in seconds and need to be converted to ticks for the
32 *  application.
33 *
34 */
35
36#define MAX_LONG_TEST_DURATION       300 /* 5 minutes = 300 seconds */
37#define MAX_SHORT_TEST_DURATION      3   /* 3 seconds */
38
39
40/*
41 *  Define the interrupt mechanism for Time Test 27
42 *
43 *  NOTE:  Use a software interrupt for the i386 family.
44 */
45#define MUST_WAIT_FOR_INTERRUPT 0
46#define Install_tm27_vector( handler ) set_vector( (handler), 0x90, 1 )
47#define Cause_tm27_intr()              asm volatile( "int $0x90" : : );
48#define Clear_tm27_intr()
49#define Lower_tm27_intr()
50
51/*
52 *  Simple spin delay in microsecond units for device drivers.
53 *  This is very dependent on the clock speed of the target.
54 */
55
56#define delay( _microseconds )  { \
57    rtems_unsigned32 _cnt = (_microseconds); \
58    asm volatile ("0: nop; mov %0,%0; loop 0b" : "=c"(_cnt) : "0"(_cnt) ); \
59}
60
61
62/* Constants */
63
64/* Assume color console */
65#define COLOR           1
66#if COLOR
67# define        GDC_REG_PORT    0x3d4
68# define        GDC_VAL_PORT    0x3d5
69# define        TVRAM           ((unsigned short *)0xb8000L)
70#else
71# define        GDC_REG_PORT    0x3b4
72# define        GDC_VAL_PORT    0x3b5
73# define        TVRAM           ((unsigned short *)0xb0000L)
74#endif
75
76/* White character attribute--works for MGA and CGA */
77#define WHITE   0x07
78
79/* Ports for PC keyboard */
80#define KBD_CTL 0x61
81#define KBD_DATA 0x60
82#define KBD_STATUS 0x64
83
84/* Constants relating to the 8254 (or 8253) programmable interval timers */
85 /*     Port address of the control port and timer channels */
86/*
87 * Macros for specifying values to be written into a mode register.
88 */
89#define IO_TIMER1       0x40
90#define TIMER_CNTR0     (IO_TIMER1 + 0) /* timer 0 counter port */
91#define TIMER_CNTR1     (IO_TIMER1 + 1) /* timer 1 counter port */
92#define TIMER_CNTR2     (IO_TIMER1 + 2) /* timer 2 counter port */
93#define TIMER_MODE      (IO_TIMER1 + 3) /* timer mode port */
94#define         TIMER_SEL0      0x00    /* select counter 0 */
95#define         TIMER_SEL1      0x40    /* select counter 1 */
96#define         TIMER_SEL2      0x80    /* select counter 2 */
97#define         TIMER_INTTC     0x00    /* mode 0, intr on terminal cnt */
98#define         TIMER_ONESHOT   0x02    /* mode 1, one shot */
99#define         TIMER_RATEGEN   0x04    /* mode 2, rate generator */
100#define         TIMER_SQWAVE    0x06    /* mode 3, square wave */
101#define         TIMER_SWSTROBE  0x08    /* mode 4, s/w triggered strobe */
102#define         TIMER_HWSTROBE  0x0a    /* mode 5, h/w triggered strobe */
103#define         TIMER_LATCH     0x00    /* latch counter for reading */
104#define         TIMER_LSB       0x10    /* r/w counter LSB */
105#define         TIMER_MSB       0x20    /* r/w counter MSB */
106#define         TIMER_16BIT     0x30    /* r/w counter 16 bits, LSB first */
107#define         TIMER_BCD       0x01    /* count in BCD */
108
109#define CLOCK_DISABLE() \
110    ({ char mask; inport_byte( 0x21, mask ); outport_byte( 0x21, mask | 1 ); })
111#define CLOCK_ENABLE()  \
112    ({ char mask; inport_byte( 0x21, mask ); outport_byte( 0x21, mask & ~1); })
113
114/*      The internal tick rate in ticks per second */
115#define         TIMER_TICK      1193182
116#define         US_TO_TICK(us)  (((us)*105+44)/88)
117#define         TICK_TO_US(tk)  (((tk)*88+52)/105)
118
119/* Structures */
120
121#ifdef IBMPC_INIT
122#undef BSP_EXTERN
123#define BSP_EXTERN
124#else
125#undef BSP_EXTERN
126#define BSP_EXTERN extern
127#endif
128
129/*
130 *  Device Driver Table Entries
131 */
132
133/*
134 * NOTE: Use the standard Console driver entry
135 */
136 
137/*
138 * NOTE: Use the standard Clock driver entry
139 */
140
141/*
142 * How many libio files we want
143 */
144
145#define BSP_LIBIO_MAX_FDS       20
146
147/* functions */
148
149int _IBMPC_chrdy( char * ch );
150int _IBMPC_inch( void );
151void _IBMPC_outch( unsigned char );
152
153/* miscellaneous stuff assumed to exist */
154
155extern rtems_configuration_table BSP_Configuration;
156
157/* routines */
158
159i386_isr_entry set_vector(
160  rtems_isr_entry     handler,
161  rtems_vector_number vector,
162  int                 type
163);
164
165#ifdef __cplusplus
166}
167#endif
168
169#endif
170/* end of include file */
171
172
Note: See TracBrowser for help on using the repository browser.