source: rtems/c/src/lib/libbsp/i386/ts_386ex/include/bsp.h @ cf282090

4.104.114.84.95
Last change on this file since cf282090 was cf282090, checked in by Joel Sherrill <joel.sherrill@…>, on 09/28/01 at 13:28:11

2001-09-27 Joel Sherrill <joel@…>

  • include/bsp.h: Renamed delay() to rtems_bsp_delay().
  • Property mode set to 100644
File size: 5.0 KB
Line 
1/*
2 *  This include file definitions related to an Intel i386ex board.
3 *
4 *  COPYRIGHT (c) 1989-1999.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.OARcorp.com/rtems/license.html.
10 *
11 *  $Id$
12 */
13
14
15#ifndef __TS386_h
16#define __TS386_h
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22#include <bspopts.h>
23
24#include <rtems.h>
25#include <iosupp.h>
26#include <console.h>
27#include <clockdrv.h>
28#include <bspIo.h>
29#include <irq.h>
30
31/*
32 *  confdefs.h overrides for this BSP:
33 *   - termios serial ports (defaults to 1)
34 *   - Interrupt stack space is not minimum if defined.
35 */
36
37/* #define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 2 */
38#define CONFIGURE_INTERRUPT_STACK_MEMORY  (8 * 1024)
39 
40/*
41 * Network driver configuration
42 */
43
44struct rtems_bsdnet_ifconfig;
45extern int rtems_ne_driver_attach (struct rtems_bsdnet_ifconfig *config);
46
47extern void Wait_X_ms (unsigned);
48
49#define RTEMS_BSP_NETWORK_DRIVER_NAME         "ne1"
50#define RTEMS_BSP_NETWORK_DRIVER_ATTACH       rtems_ne_driver_attach
51
52#define NE2000_BYTE_TRANSFERS
53
54/*
55 * Constants relating to the 8254 (or 8253) programmable interval timers.
56 */
57
58#define TIMER_CONFIG   0xF834
59#define IO_TIMER1      0xF040
60
61  /* Port address of the control port and timer channels */
62
63#define TIMER_CNTR0    (IO_TIMER1 + 0) /* timer 0 counter port           */
64#define TIMER_CNTR1    (IO_TIMER1 + 1) /* timer 1 counter port           */
65#define TIMER_CNTR2    (IO_TIMER1 + 2) /* timer 2 counter port           */
66#define TIMER_MODE     (IO_TIMER1 + 3) /* timer mode port                */
67#define TIMER_SEL0     0x00            /* select counter 0               */
68#define TIMER_SEL1     0x40            /* select counter 1               */
69#define TIMER_SEL2     0x80            /* select counter 2               */
70#define TIMER_INTTC    0x00            /* mode 0, intr on terminal cnt   */
71#define TIMER_ONESHOT  0x02            /* mode 1, one shot               */
72#define TIMER_RATEGEN  0x04            /* mode 2, rate generator         */
73#define TIMER_SQWAVE   0x06            /* mode 3, square wave            */
74#define TIMER_SWSTROBE 0x08            /* mode 4, s/w triggered strobe   */
75#define TIMER_HWSTROBE 0x0a            /* mode 5, h/w triggered strobe   */
76#define TIMER_LATCH    0x00            /* latch counter for reading      */
77#define TIMER_LSB      0x10            /* r/w counter LSB                */
78#define TIMER_MSB      0x20            /* r/w counter MSB                */
79#define TIMER_16BIT    0x30            /* r/w counter 16 bits, LSB first */
80#define TIMER_BCD      0x01            /* count in BCD                   */
81
82/*
83 *  Define the time limits for RTEMS Test Suite test durations.
84 *  Long test and short test duration limits are provided.  These
85 *  values are in seconds and need to be converted to ticks for the
86 *  application.
87 *
88 */
89
90#define MAX_LONG_TEST_DURATION       300 /* 5 minutes = 300 seconds */
91#define MAX_SHORT_TEST_DURATION      3   /* 3 seconds */
92
93/*
94 *  Define the interrupt mechanism for Time Test 27
95 *
96 *  NOTE: Use a software interrupt for the i386.
97 */
98
99#define MUST_WAIT_FOR_INTERRUTPT 0
100
101
102#define Install_tm27_vector(handler) \
103{ \
104  rtems_isr_entry dummy; \
105  rtems_interrupt_catch(handler, 0x90, &dummy); \
106}
107#define Cause_tm27_intr()              asm volatile( "int $0x90" : : );
108
109#define Clear_tm27_intr()
110
111#define Lower_tm27_intr()
112
113/*
114 *  Simple spin delay in microsecond units for device drivers.
115 *  This is very dependent on the clock speed of the target.
116 */
117
118#define rtems_bsp_delay( _microseconds ) \
119  { \
120    rtems_unsigned32 _counter; \
121    \
122    _counter = (_microseconds); \
123    \
124    asm volatile ( "0: nop;" \
125                   " mov %0,%0 ;" \
126                   " loop 0b" : "=c" (_counter) \
127                              : "0"  (_counter) \
128                 ); \
129    \
130  }
131
132/* Constants */
133
134#define RAM_START 0
135
136/* replaced the earlier EI kludge of 0xfffff */
137
138#define RAM_END   0x200000
139
140/* I/O addressing */
141
142/*
143 *#define Is_tx_ready( _status ) ( (_status) & 0x20 )
144 */
145/* dec 20. try the TE instead of TBE as the check */
146
147#define Is_tx_ready( _status ) ( (_status) & 0x40 )
148
149
150#define Is_rx_ready( _status ) ( (_status) & 0x01 )
151
152/* Structures */
153
154#ifdef F386_INIT
155#undef BSP_EXTERN
156#define BSP_EXTERN
157#else
158#undef BSP_EXTERN
159#define BSP_EXTERN extern
160#endif
161
162/*
163 *  Device Driver Table Entries
164 */
165 
166/*
167 * NOTE: Use the standard Console driver entry
168 */
169 
170/*
171 * NOTE: Use the standard Clock driver entry
172 */
173 
174/* miscellaneous stuff assumed to exist */
175
176extern rtems_configuration_table BSP_Configuration;
177
178#define IDT_SIZE 256
179#define GDT_SIZE 3
180
181extern interrupt_gate_descriptor Interrupt_descriptor_table[IDT_SIZE];
182extern segment_descriptors Global_descriptor_table   [GDT_SIZE];
183
184BSP_EXTERN unsigned short Idt[3];  /* Interrupt Descriptor Table Address */
185BSP_EXTERN unsigned short Gdt[3];  /* Global Descriptor Table Address */
186BSP_EXTERN unsigned int   Idt_base;
187BSP_EXTERN unsigned int   Gdt_base;
188
189/* routines */
190
191#ifdef __cplusplus
192}
193#endif
194
195#endif
196/* end of include file */
Note: See TracBrowser for help on using the repository browser.