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

4.115
Last change on this file since 7c0273e was 528483ed, checked in by Ralf Corsepius <ralf.corsepius@…>, on 02/11/11 at 12:04:30

2011-02-11 Ralf Corsépius <ralf.corsepius@…>

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