RTEMS 5.2
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
bsp.h
Go to the documentation of this file.
1
9/*-------------------------------------------------------------------------+
10| bsp.h v1.1 - PC386 BSP - 1997/08/07
11+--------------------------------------------------------------------------+
12| This include file contains definitions related to the PC386 BSP.
13+--------------------------------------------------------------------------+
14| (C) Copyright 1997 -
15| - NavIST Group - Real-Time Distributed Systems and Industrial Automation
16|
17| http://pandora.ist.utl.pt
18|
19| Instituto Superior Tecnico * Lisboa * PORTUGAL
20+--------------------------------------------------------------------------+
21| Modified by Eric Valette the 20/05/98 in order to add definitions used
22| to enhance video putchar capabilities.
23|
24| Copyright (C) 1998 valette@crf.canon.fr
25|
26| Canon Centre Recherche France.
27|
28+--------------------------------------------------------------------------+
29| Disclaimer:
30|
31| This file is provided "AS IS" without warranty of any kind, either
32| expressed or implied.
33+--------------------------------------------------------------------------+
34| This code is based on:
35| bsp.h,v 1.5 1995/12/19 20:07:30 joel Exp - go32 BSP
36| With the following copyright notice:
37| **************************************************************************
38| * COPYRIGHT (c) 1989-1999.
39| * On-Line Applications Research Corporation (OAR).
40| *
41| * The license and distribution terms for this file may be
42| * found in the file LICENSE in this distribution or at
43| * http://www.rtems.org/license/LICENSE.
44| **************************************************************************
45+--------------------------------------------------------------------------*/
46
47#ifndef LIBBSP_I386_PC386_BSP_H
48#define LIBBSP_I386_PC386_BSP_H
49
55#ifndef ASM
56
57#include <bspopts.h>
59#include <bsp/tblsizes.h>
60
61#include <rtems.h>
62#include <rtems/score/cpu.h>
63#include <rtems/bspIo.h>
64
65#ifdef __cplusplus
66extern "C" {
67#endif
68
69
70
71#define BSP_HAS_FRAME_BUFFER 1
72
73/*
74 * Network driver configuration
75 */
76struct rtems_bsdnet_ifconfig;
77
78/* app. may provide a routine (called _very_ early) to tell us
79 * which ports to use for printk / console. BSP provides a default
80 * implementation (weak alias) which does nothing (use BSP default
81 * ports).
82 */
83extern void
84BSP_runtime_console_select(int *pPrintkPort, int *pConsolePort);
85
86extern int rtems_ne_driver_attach(struct rtems_bsdnet_ifconfig *, int);
87#define BSP_NE2000_NETWORK_DRIVER_NAME "ne1"
88#define BSP_NE2000_NETWORK_DRIVER_ATTACH rtems_ne_driver_attach
89
90extern int rtems_wd_driver_attach(struct rtems_bsdnet_ifconfig *, int);
91#define BSP_WD8003_NETWORK_DRIVER_NAME "wd1"
92#define BSP_WD8003_NETWORK_DRIVER_ATTACH rtems_wd_driver_attach
93
94extern int rtems_dec21140_driver_attach(struct rtems_bsdnet_ifconfig *, int);
95#define BSP_DEC21140_NETWORK_DRIVER_NAME "dc1"
96#define BSP_DEC21140_NETWORK_DRIVER_ATTACH rtems_dec21140_driver_attach
97
98extern int rtems_3c509_driver_attach(struct rtems_bsdnet_ifconfig *config);
99#define BSP_3C509_NETWORK_DRIVER_NAME "3c1"
100#define BSP_3C509_NETWORK_DRIVER_ATTACH rtems_3c509_driver_attach
101
102#ifndef RTEMS_BSP_NETWORK_DRIVER_NAME
103#define RTEMS_BSP_NETWORK_DRIVER_NAME BSP_DEC21140_NETWORK_DRIVER_NAME
104#endif
105
106#ifndef RTEMS_BSP_NETWORK_DRIVER_ATTACH
107#define RTEMS_BSP_NETWORK_DRIVER_ATTACH BSP_DEC21140_NETWORK_DRIVER_ATTACH
108#endif
109
110/*-------------------------------------------------------------------------+
111| Constants
112+--------------------------------------------------------------------------*/
113
114/*-------------------------------------------------------------------------+
115| Constants relating to the 8254 (or 8253) programmable interval timers.
116+--------------------------------------------------------------------------*/
117#define IO_TIMER1 0x40
118 /* Port address of the control port and timer channels */
119#define TIMER_CNTR0 (IO_TIMER1 + 0) /* timer 0 counter port */
120#define TIMER_CNTR1 (IO_TIMER1 + 1) /* timer 1 counter port */
121#define TIMER_CNTR2 (IO_TIMER1 + 2) /* timer 2 counter port */
122#define TIMER_MODE (IO_TIMER1 + 3) /* timer mode port */
123#define TIMER_SEL0 0x00 /* select counter 0 */
124#define TIMER_SEL1 0x40 /* select counter 1 */
125#define TIMER_SEL2 0x80 /* select counter 2 */
126#define TIMER_INTTC 0x00 /* mode 0, intr on terminal cnt */
127#define TIMER_ONESHOT 0x02 /* mode 1, one shot */
128#define TIMER_RATEGEN 0x04 /* mode 2, rate generator */
129#define TIMER_SQWAVE 0x06 /* mode 3, square wave */
130#define TIMER_SWSTROBE 0x08 /* mode 4, s/w triggered strobe */
131#define TIMER_HWSTROBE 0x0a /* mode 5, h/w triggered strobe */
132#define TIMER_LATCH 0x00 /* latch counter for reading */
133#define TIMER_LSB 0x10 /* r/w counter LSB */
134#define TIMER_MSB 0x20 /* r/w counter MSB */
135#define TIMER_16BIT 0x30 /* r/w counter 16 bits, LSB first */
136#define TIMER_BCD 0x01 /* count in BCD */
137#define TIMER_RD_BACK 0xc0 /* Read Back Command */
138 /* READ BACK command layout in the Command Register */
139#define RB_NOT_COUNT 0x40 /* Don't select counter latch */
140#define RB_NOT_STATUS 0x20 /* Don't select status latch */
141#define RB_COUNT_0 0x02 /* Counter 0 latch */
142#define RB_COUNT_1 0x04 /* Counter 1 latch */
143#define RB_COUNT_2 0x08 /* Counter 2 latch */
144#define RB_OUTPUT 0x80 /* Output of the counter is 1 */
145
146#define TIMER_TICK 1193182 /* The internal tick rate in ticks per second */
147
148#if defined( RTEMS_SMP )
149 extern ISR_lock_Control rtems_i386_i8254_access_lock;
150#endif
151
152
153/*-------------------------------------------------------------------------+
154| Console Defines
155| WARNING: These Values MUST match the order in
156| Console_Configuration_Ports
157+--------------------------------------------------------------------------*/
158#define BSP_CONSOLE_VGA 0
159#define BSP_CONSOLE_COM1 1
160#define BSP_CONSOLE_COM2 2
161
162/*-------------------------------------------------------------------------+
163| Convert microseconds to ticks and ticks to microseconds.
164+--------------------------------------------------------------------------*/
165#define US_TO_TICK(us) (((us)*105+44)/88)
166#define TICK_TO_US(tk) (((tk)*88+52)/105)
167
168/*-------------------------------------------------------------------------+
169| External Variables.
170+--------------------------------------------------------------------------*/
171extern interrupt_gate_descriptor Interrupt_descriptor_table[IDT_SIZE];
172extern segment_descriptors _Global_descriptor_table [GDT_SIZE];
173
174/*-------------------------------------------------------------------------+
175| Function Prototypes.
176+--------------------------------------------------------------------------*/
177void _IBMPC_initVideo(void); /* from 'outch.c' */
178void _IBMPC_outch (char); /* from 'outch.c' */
179char _IBMPC_inch (void); /* from 'inch.c' */
180char _IBMPC_inch_sleep (void); /* from 'inch.c' */
181int BSP_wait_polled_input(void); /* from 'inch.c' */
182int rtems_kbpoll( void ); /* from 'inch.c' */
183int getch( void ); /* from 'inch.c' */
184void add_to_queue( unsigned short b ); /* from 'inch.c' */
185
186void Wait_X_ms(unsigned int timeToWait); /* from 'timer.c' */
187void Calibrate_loop_1ms(void); /* from 'timer.c' */
188
189void rtems_irq_mngt_init(void); /* from 'irq_init.c' */
190
191void Clock_driver_install_handler(void); /* from 'ckinit.c' */
192void Clock_driver_support_initialize_hardware(void); /* from 'ckinit.c' */
193
194void *bsp_idle_thread( uintptr_t ignored );
195#define BSP_IDLE_TASK_BODY bsp_idle_thread
196
197void kbd_reset_setup(char *str, int *ints); /* from 'pc_keyb.c' */
198size_t read_aux(char * buffer, size_t count); /* from 'ps2_mouse.c' */
199
200bool bsp_get_serial_mouse_device( /* from 'serial_mouse.c' */
201 const char **name,
202 const char **type
203);
204
205void register_leds( /* from 'keyboard.c' */
206 int console,
207 unsigned int led,
208 unsigned int *addr,
209 unsigned int mask
210);
211
212/* Definitions for BSPConsolePort */
213#define BSP_CONSOLE_PORT_CONSOLE (-1)
214#define BSP_CONSOLE_PORT_COM1 (BSP_UART_COM1)
215#define BSP_CONSOLE_PORT_COM2 (BSP_UART_COM2)
216
217/*
218 * Command line.
219 */
220const char* bsp_cmdline(void);
221const char* bsp_cmdline_arg(const char* arg);
222
223#if BSP_ENABLE_IDE
224/*
225 * IDE command line parsing.
226 */
227void bsp_ide_cmdline_init(void);
228
229/*
230 * indicate, that BSP has IDE driver
231 */
232#define RTEMS_BSP_HAS_IDE_DRIVER
233#endif
234
235/* GDB stub stuff */
236void init_remote_gdb( void );
237void i386_stub_glue_init(int uart);
238void i386_stub_glue_init_breakin(void);
239int i386_stub_glue_uart(void);
240void breakpoint(void);
241
242/*
243 * Debug helper methods
244 */
245typedef __FILE FILE;
246uint32_t BSP_irq_count_dump(FILE *f);
247
248/*
249 * Prototypes just called from .S files. This lets the .S file include
250 * bsp.h just to establish the dependency.
251 */
252void raw_idt_notify(void);
253void C_dispatch_isr(int vector);
254
255#ifdef RTEMS_SMP
256 /* CPU specific functions used by the SMP API */
257 int imps_probe(void);
258 void ipi_install_irq(void);
259 int send_ipi(unsigned int dst, unsigned int v);
260#endif
261
262#ifdef __cplusplus
263}
264#endif
265
266#endif /* !ASM */
267
270#endif /* _BSP_H */
Interface to Kernel Print Methods.
DEFAULT_INITIAL_EXTENSION Support.
void * bsp_idle_thread(uintptr_t ignored)
Optimized idle task.
Definition: bspidle.c:26
bool bsp_get_serial_mouse_device(const char **name, const char **type)
Obtain serial mouse configuration information.
Definition: serial_mouse_config.c:29
ISR lock control.
Definition: isrlock.h:56
Definition: deflate.c:115
Definition: idtr.h:39
unsigned v
Definition: tte.h:0
Sizes of Global and Interrupt descriptor tables.