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

4.104.115
Last change on this file since a7a9af76 was a7a9af76, checked in by Joel Sherrill <joel.sherrill@…>, on 12/08/09 at 22:28:05

2009-12-08 Joel Sherrill <joel.sherrill@…>

  • include/bsp.h: BSP should not define CONFIGURE_NUMBER_OF_TERMIOS_PORTS.
  • Property mode set to 100644
File size: 8.2 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-1999.
31| *  On-Line Applications Research Corporation (OAR).
32| *
33| *  The license and distribution terms for this file may be
34| *  found in found in the file LICENSE in this distribution or at
35| *  http://www.rtems.com/license/LICENSE.
36| **************************************************************************
37|
38|  $Id$
39+--------------------------------------------------------------------------*/
40
41#ifndef _BSP_H
42#define _BSP_H
43
44#ifdef __cplusplus
45extern "C" {
46#endif
47
48#include <bspopts.h>
49
50#include <rtems.h>
51#include <rtems/iosupp.h>
52#include <rtems/console.h>
53#include <rtems/clockdrv.h>
54#include <libcpu/cpu.h>
55#include <rtems/bspIo.h>
56
57/*
58 * Network driver configuration
59 */
60struct rtems_bsdnet_ifconfig;
61
62/* app. may provide a routine (called _very_ early) to tell us
63 * which ports to use for printk / console. BSP provides a default
64 * implementation (weak alias) which does nothing (use BSP default
65 * ports).
66 */
67extern void
68BSP_runtime_console_select(int *pPrintkPort, int *pConsolePort);
69
70extern int rtems_ne_driver_attach(struct rtems_bsdnet_ifconfig *, int);
71#define BSP_NE2000_NETWORK_DRIVER_NAME      "ne1"
72#define BSP_NE2000_NETWORK_DRIVER_ATTACH    rtems_ne_driver_attach
73
74extern int rtems_wd_driver_attach(struct rtems_bsdnet_ifconfig *, int);
75#define BSP_WD8003_NETWORK_DRIVER_NAME      "wd1"
76#define BSP_WD8003_NETWORK_DRIVER_ATTACH    rtems_wd_driver_attach
77
78extern int rtems_dec21140_driver_attach(struct rtems_bsdnet_ifconfig *, int);
79#define BSP_DEC21140_NETWORK_DRIVER_NAME    "dc1"
80#define BSP_DEC21140_NETWORK_DRIVER_ATTACH  rtems_dec21140_driver_attach
81
82#ifndef RTEMS_BSP_NETWORK_DRIVER_NAME
83#define RTEMS_BSP_NETWORK_DRIVER_NAME   BSP_DEC21140_NETWORK_DRIVER_NAME
84#endif
85
86#ifndef RTEMS_BSP_NETWORK_DRIVER_ATTACH
87#define RTEMS_BSP_NETWORK_DRIVER_ATTACH BSP_DEC21140_NETWORK_DRIVER_ATTACH
88#endif
89
90/*-------------------------------------------------------------------------+
91| Constants
92+--------------------------------------------------------------------------*/
93
94/*-------------------------------------------------------------------------+
95| Video (console) related constants.
96+--------------------------------------------------------------------------*/
97
98#include <crt.h>
99
100/*-------------------------------------------------------------------------+
101| Constants relating to the 8254 (or 8253) programmable interval timers.
102+--------------------------------------------------------------------------*/
103#define IO_TIMER1      0x40
104                  /* Port address of the control port and timer channels */
105#define TIMER_CNTR0    (IO_TIMER1 + 0) /* timer 0 counter port           */
106#define TIMER_CNTR1    (IO_TIMER1 + 1) /* timer 1 counter port           */
107#define TIMER_CNTR2    (IO_TIMER1 + 2) /* timer 2 counter port           */
108#define TIMER_MODE     (IO_TIMER1 + 3) /* timer mode port                */
109#define TIMER_SEL0     0x00            /* select counter 0               */
110#define TIMER_SEL1     0x40            /* select counter 1               */
111#define TIMER_SEL2     0x80            /* select counter 2               */
112#define TIMER_INTTC    0x00            /* mode 0, intr on terminal cnt   */
113#define TIMER_ONESHOT  0x02            /* mode 1, one shot               */
114#define TIMER_RATEGEN  0x04            /* mode 2, rate generator         */
115#define TIMER_SQWAVE   0x06            /* mode 3, square wave            */
116#define TIMER_SWSTROBE 0x08            /* mode 4, s/w triggered strobe   */
117#define TIMER_HWSTROBE 0x0a            /* mode 5, h/w triggered strobe   */
118#define TIMER_LATCH    0x00            /* latch counter for reading      */
119#define TIMER_LSB      0x10            /* r/w counter LSB                */
120#define TIMER_MSB      0x20            /* r/w counter MSB                */
121#define TIMER_16BIT    0x30            /* r/w counter 16 bits, LSB first */
122#define TIMER_BCD      0x01            /* count in BCD                   */
123#define TIMER_RD_BACK  0xc0            /* Read Back Command              */
124                /* READ BACK command layout in the Command Register      */
125#define RB_NOT_COUNT    0x40           /* Don't select counter latch     */
126#define RB_NOT_STATUS   0x20           /* Don't select status latch      */
127#define RB_COUNT_0      0x02           /* Counter 0 latch                */
128#define RB_COUNT_1      0x04           /* Counter 1 latch                */
129#define RB_COUNT_2      0x08           /* Counter 2 latch                */
130#define RB_OUTPUT       0x80           /* Output of the counter is 1     */
131
132#define TIMER_TICK     1193182  /* The internal tick rate in ticks per second */
133
134/*-------------------------------------------------------------------------+
135| Macros
136+--------------------------------------------------------------------------*/
137/* does anyone need this? if so, report it so we can rename this macro */
138#if 0
139/*-------------------------------------------------------------------------+
140| Simple spin delay in microsecond units for device drivers.
141| This is very dependent on the clock speed of the target.
142+--------------------------------------------------------------------------*/
143#define rtems_bsp_delay(_microseconds) \
144{ \
145  uint32_t         _cnt = _microseconds; \
146  asm volatile ("0: nop; mov %0,%0; loop 0b" : "=c"(_cnt) : "0"(_cnt)); \
147}
148#endif
149
150/*-------------------------------------------------------------------------+
151| Convert microseconds to ticks and ticks to microseconds.
152+--------------------------------------------------------------------------*/
153#define US_TO_TICK(us) (((us)*105+44)/88)
154#define TICK_TO_US(tk) (((tk)*88+52)/105)
155
156/*-------------------------------------------------------------------------+
157| External Variables.
158+--------------------------------------------------------------------------*/
159#define IDT_SIZE 256
160#define GDT_SIZE 3
161
162extern interrupt_gate_descriptor Interrupt_descriptor_table[IDT_SIZE];
163extern segment_descriptors Global_descriptor_table   [GDT_SIZE];
164
165extern uint32_t                  rtemsFreeMemStart;
166  /* Address of start of free memory - should be used when creating new
167     partitions or regions and updated afterwards. */
168
169/*-------------------------------------------------------------------------+
170| Function Prototypes.
171+--------------------------------------------------------------------------*/
172void          _IBMPC_initVideo(void);    /* from 'outch.c'  */
173void          _IBMPC_outch    (char);    /* from 'outch.c'  */
174char          _IBMPC_inch     (void);    /* from 'inch.c'   */
175char          _IBMPC_inch_sleep (void);  /* from 'inch.c'   */
176
177void Wait_X_ms(unsigned int timeToWait); /* from 'timer.c'  */
178
179/* Definitions for BSPConsolePort */
180#define BSP_CONSOLE_PORT_CONSOLE (-1)
181#define BSP_CONSOLE_PORT_COM1    (BSP_UART_COM1)
182#define BSP_CONSOLE_PORT_COM2    (BSP_UART_COM2)
183
184/*
185 * Command line.
186 */
187const char* bsp_cmdline(void);
188const char* bsp_cmdline_arg(const char* arg);
189
190/*
191 * IDE command line parsing.
192 */
193void bsp_ide_cmdline_init(void);
194
195/*
196 * indicate, that BSP has IDE driver
197 */
198#define RTEMS_BSP_HAS_IDE_DRIVER
199
200/* GDB stub stuff */
201void i386_stub_glue_init(int uart);
202void i386_stub_glue_init_breakin(void);
203void set_debug_traps(void);
204void breakpoint(void);
205
206#ifdef __cplusplus
207}
208#endif
209
210#endif /* _BSP_H */
Note: See TracBrowser for help on using the repository browser.