RTEMS 7.0-rc1
Loading...
Searching...
No Matches
bsp.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
11/*
12 * Copyright (c) 1994 Joel Sherrill <joel@rtems.org>
13 * Copyright (c) 1998 Eric Valette <eric.valette@free.fr>
14 * Copyright (c) 1997 NavIST Group - Real-Time Distributed Systems
15 * and Industrial Automation
16 *
17 * Redistribution and use in source and binary forms, with or without
18 * modification, are permitted provided that the following conditions
19 * are met:
20 * 1. Redistributions of source code must retain the above copyright
21 * notice, this list of conditions and the following disclaimer.
22 * 2. Redistributions in binary form must reproduce the above copyright
23 * notice, this list of conditions and the following disclaimer in the
24 * documentation and/or other materials provided with the distribution.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
30 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39
40#ifndef LIBBSP_I386_PC386_BSP_H
41#define LIBBSP_I386_PC386_BSP_H
42
48#ifndef ASM
49
50#include <bspopts.h>
52#include <bsp/tblsizes.h>
53
54#include <rtems.h>
55#include <rtems/score/cpu.h>
56#include <rtems/bspIo.h>
57
58#ifdef __cplusplus
59extern "C" {
60#endif
61
62
63
64#define BSP_HAS_FRAME_BUFFER 1
65
66/*
67 * Network driver configuration
68 */
69struct rtems_bsdnet_ifconfig;
70
71/* app. may provide a routine (called _very_ early) to tell us
72 * which ports to use for printk / console. BSP provides a default
73 * implementation (weak alias) which does nothing (use BSP default
74 * ports).
75 */
76extern void
77BSP_runtime_console_select(int *pPrintkPort, int *pConsolePort);
78
79extern int rtems_ne_driver_attach(struct rtems_bsdnet_ifconfig *, int);
80#define BSP_NE2000_NETWORK_DRIVER_NAME "ne1"
81#define BSP_NE2000_NETWORK_DRIVER_ATTACH rtems_ne_driver_attach
82
83extern int rtems_wd_driver_attach(struct rtems_bsdnet_ifconfig *, int);
84#define BSP_WD8003_NETWORK_DRIVER_NAME "wd1"
85#define BSP_WD8003_NETWORK_DRIVER_ATTACH rtems_wd_driver_attach
86
87extern int rtems_dec21140_driver_attach(struct rtems_bsdnet_ifconfig *, int);
88#define BSP_DEC21140_NETWORK_DRIVER_NAME "dc1"
89#define BSP_DEC21140_NETWORK_DRIVER_ATTACH rtems_dec21140_driver_attach
90
91extern int rtems_3c509_driver_attach(struct rtems_bsdnet_ifconfig *config);
92#define BSP_3C509_NETWORK_DRIVER_NAME "3c1"
93#define BSP_3C509_NETWORK_DRIVER_ATTACH rtems_3c509_driver_attach
94
95#ifndef RTEMS_BSP_NETWORK_DRIVER_NAME
96#define RTEMS_BSP_NETWORK_DRIVER_NAME BSP_DEC21140_NETWORK_DRIVER_NAME
97#endif
98
99#ifndef RTEMS_BSP_NETWORK_DRIVER_ATTACH
100#define RTEMS_BSP_NETWORK_DRIVER_ATTACH BSP_DEC21140_NETWORK_DRIVER_ATTACH
101#endif
102
103/*-------------------------------------------------------------------------+
104| Constants
105+--------------------------------------------------------------------------*/
106
107/*-------------------------------------------------------------------------+
108| Constants relating to the 8254 (or 8253) programmable interval timers.
109+--------------------------------------------------------------------------*/
110#define IO_TIMER1 0x40
111 /* Port address of the control port and timer channels */
112#define TIMER_CNTR0 (IO_TIMER1 + 0) /* timer 0 counter port */
113#define TIMER_CNTR1 (IO_TIMER1 + 1) /* timer 1 counter port */
114#define TIMER_CNTR2 (IO_TIMER1 + 2) /* timer 2 counter port */
115#define TIMER_MODE (IO_TIMER1 + 3) /* timer mode port */
116#define TIMER_SEL0 0x00 /* select counter 0 */
117#define TIMER_SEL1 0x40 /* select counter 1 */
118#define TIMER_SEL2 0x80 /* select counter 2 */
119#define TIMER_INTTC 0x00 /* mode 0, intr on terminal cnt */
120#define TIMER_ONESHOT 0x02 /* mode 1, one shot */
121#define TIMER_RATEGEN 0x04 /* mode 2, rate generator */
122#define TIMER_SQWAVE 0x06 /* mode 3, square wave */
123#define TIMER_SWSTROBE 0x08 /* mode 4, s/w triggered strobe */
124#define TIMER_HWSTROBE 0x0a /* mode 5, h/w triggered strobe */
125#define TIMER_LATCH 0x00 /* latch counter for reading */
126#define TIMER_LSB 0x10 /* r/w counter LSB */
127#define TIMER_MSB 0x20 /* r/w counter MSB */
128#define TIMER_16BIT 0x30 /* r/w counter 16 bits, LSB first */
129#define TIMER_BCD 0x01 /* count in BCD */
130#define TIMER_RD_BACK 0xc0 /* Read Back Command */
131 /* READ BACK command layout in the Command Register */
132#define RB_NOT_COUNT 0x40 /* Don't select counter latch */
133#define RB_NOT_STATUS 0x20 /* Don't select status latch */
134#define RB_COUNT_0 0x02 /* Counter 0 latch */
135#define RB_COUNT_1 0x04 /* Counter 1 latch */
136#define RB_COUNT_2 0x08 /* Counter 2 latch */
137#define RB_OUTPUT 0x80 /* Output of the counter is 1 */
138
139#define TIMER_TICK 1193182 /* The internal tick rate in ticks per second */
140
141#if defined( RTEMS_SMP )
142 extern ISR_lock_Control rtems_i386_i8254_access_lock;
143#endif
144
145
146/*-------------------------------------------------------------------------+
147| Console Defines
148| WARNING: These Values MUST match the order in
149| Console_Configuration_Ports
150+--------------------------------------------------------------------------*/
151#define BSP_CONSOLE_VGA 0
152#define BSP_CONSOLE_COM1 1
153#define BSP_CONSOLE_COM2 2
154
155/*-------------------------------------------------------------------------+
156| Convert microseconds to ticks and ticks to microseconds.
157+--------------------------------------------------------------------------*/
158#define US_TO_TICK(us) (((us)*105+44)/88)
159#define TICK_TO_US(tk) (((tk)*88+52)/105)
160
161/*-------------------------------------------------------------------------+
162| External Variables.
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' */
174int BSP_wait_polled_input(void); /* from 'inch.c' */
175int rtems_kbpoll( void ); /* from 'inch.c' */
176int getch( void ); /* from 'inch.c' */
177void add_to_queue( unsigned short b ); /* from 'inch.c' */
178
179void Wait_X_ms(unsigned int timeToWait); /* from 'timer.c' */
180void Calibrate_loop_1ms(void); /* from 'timer.c' */
181
182void rtems_irq_mngt_init(void); /* from 'irq_init.c' */
183
184void Clock_driver_install_handler(void); /* from 'ckinit.c' */
185void Clock_driver_support_initialize_hardware(void); /* from 'ckinit.c' */
186
187void *bsp_idle_thread( uintptr_t ignored );
188#define BSP_IDLE_TASK_BODY bsp_idle_thread
189
190void kbd_reset_setup(char *str, int *ints); /* from 'pc_keyb.c' */
191size_t read_aux(char * buffer, size_t count); /* from 'ps2_mouse.c' */
192
193bool bsp_get_serial_mouse_device( /* from 'serial_mouse.c' */
194 const char **name,
195 const char **type
196);
197
198void register_leds( /* from 'keyboard.c' */
199 int console,
200 unsigned int led,
201 unsigned int *addr,
202 unsigned int mask
203);
204
205/* Definitions for BSPConsolePort */
206#define BSP_CONSOLE_PORT_CONSOLE (-1)
207#define BSP_CONSOLE_PORT_COM1 (BSP_UART_COM1)
208#define BSP_CONSOLE_PORT_COM2 (BSP_UART_COM2)
209
210/*
211 * Command line.
212 */
213const char* bsp_cmdline(void);
214const char* bsp_cmdline_arg(const char* arg);
215
216#if BSP_ENABLE_IDE
217/*
218 * IDE command line parsing.
219 */
220void bsp_ide_cmdline_init(void);
221
222/*
223 * indicate, that BSP has IDE driver
224 */
225#define RTEMS_BSP_HAS_IDE_DRIVER
226#endif
227
228/* GDB stub stuff */
229void init_remote_gdb( void );
230void i386_stub_glue_init(int uart);
231void i386_stub_glue_init_breakin(void);
232int i386_stub_glue_uart(void);
233void rtems_pc386_breakpoint(void);
234
235/*
236 * Debug helper methods
237 */
238typedef __FILE FILE;
239uint32_t BSP_irq_count_dump(FILE *f);
240
241/*
242 * Prototypes just called from .S files. This lets the .S file include
243 * bsp.h just to establish the dependency.
244 */
245void raw_idt_notify(void);
246void C_dispatch_isr(int vector);
247
248#ifdef RTEMS_SMP
249 /* CPU specific functions used by the SMP API */
250 int imps_probe(void);
251 void ipi_install_irq(void);
252 int send_ipi(unsigned int dst, unsigned int v);
253#endif
254
255#ifdef __cplusplus
256}
257#endif
258
259#endif /* !ASM */
260
263#endif /* _BSP_H */
This header file provides the kernel character input/output support API.
This header file provides the default definition of BSP_INITIAL_EXTENSION.
void * bsp_idle_thread(uintptr_t ignored)
Optimized idle task.
Definition: bspidle.c:39
bool bsp_get_serial_mouse_device(const char **name, const char **type)
Obtain serial mouse configuration information.
Definition: serial_mouse_config.c:48
This header file defines the RTEMS Classic API.
Definition: idtr.h:58
Sizes of Global and Interrupt descriptor tables.