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

5
Last change on this file since 02f4c11 was 578d839, checked in by Joel Sherrill <joel@…>, on 03/29/16 at 18:10:50

i386/pc386: Remove include of <rtems/console.h> from <bsp.h> and fix warnings

  • Property mode set to 100644
File size: 9.8 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup i386_pc386
5 *
6 * @brief Global BSP definitions.
7 */
8
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
50#ifndef ASM
51
52#include <bspopts.h>
53#include <bsp/default-initial-extension.h>
54#include <bsp/tblsizes.h>
55
56#include <rtems.h>
57#include <rtems/iosupp.h>
58#include <rtems/score/cpu.h>
59#include <rtems/bspIo.h>
60
61#ifdef __cplusplus
62extern "C" {
63#endif
64
65/**
66 * @degroup pc386_i386 PC386 Support
67 *
68 * @ingroup bsp_i386
69 *
70 * @brief PC386 support.
71 */
72
73#define BSP_HAS_FRAME_BUFFER 1
74
75/*
76 * Network driver configuration
77 */
78struct rtems_bsdnet_ifconfig;
79
80/* app. may provide a routine (called _very_ early) to tell us
81 * which ports to use for printk / console. BSP provides a default
82 * implementation (weak alias) which does nothing (use BSP default
83 * ports).
84 */
85extern void
86BSP_runtime_console_select(int *pPrintkPort, int *pConsolePort);
87
88extern int rtems_ne_driver_attach(struct rtems_bsdnet_ifconfig *, int);
89#define BSP_NE2000_NETWORK_DRIVER_NAME      "ne1"
90#define BSP_NE2000_NETWORK_DRIVER_ATTACH    rtems_ne_driver_attach
91
92extern int rtems_wd_driver_attach(struct rtems_bsdnet_ifconfig *, int);
93#define BSP_WD8003_NETWORK_DRIVER_NAME      "wd1"
94#define BSP_WD8003_NETWORK_DRIVER_ATTACH    rtems_wd_driver_attach
95
96extern int rtems_dec21140_driver_attach(struct rtems_bsdnet_ifconfig *, int);
97#define BSP_DEC21140_NETWORK_DRIVER_NAME    "dc1"
98#define BSP_DEC21140_NETWORK_DRIVER_ATTACH  rtems_dec21140_driver_attach
99
100extern int rtems_3c509_driver_attach(struct rtems_bsdnet_ifconfig *config);
101#define BSP_3C509_NETWORK_DRIVER_NAME    "3c1"
102#define BSP_3C509_NETWORK_DRIVER_ATTACH  rtems_3c509_driver_attach
103
104#ifndef RTEMS_BSP_NETWORK_DRIVER_NAME
105#define RTEMS_BSP_NETWORK_DRIVER_NAME   BSP_DEC21140_NETWORK_DRIVER_NAME
106#endif
107
108#ifndef RTEMS_BSP_NETWORK_DRIVER_ATTACH
109#define RTEMS_BSP_NETWORK_DRIVER_ATTACH BSP_DEC21140_NETWORK_DRIVER_ATTACH
110#endif
111
112/*-------------------------------------------------------------------------+
113| Constants
114+--------------------------------------------------------------------------*/
115
116/*-------------------------------------------------------------------------+
117| Constants relating to the 8254 (or 8253) programmable interval timers.
118+--------------------------------------------------------------------------*/
119#define IO_TIMER1      0x40
120                  /* Port address of the control port and timer channels */
121#define TIMER_CNTR0    (IO_TIMER1 + 0) /* timer 0 counter port           */
122#define TIMER_CNTR1    (IO_TIMER1 + 1) /* timer 1 counter port           */
123#define TIMER_CNTR2    (IO_TIMER1 + 2) /* timer 2 counter port           */
124#define TIMER_MODE     (IO_TIMER1 + 3) /* timer mode port                */
125#define TIMER_SEL0     0x00            /* select counter 0               */
126#define TIMER_SEL1     0x40            /* select counter 1               */
127#define TIMER_SEL2     0x80            /* select counter 2               */
128#define TIMER_INTTC    0x00            /* mode 0, intr on terminal cnt   */
129#define TIMER_ONESHOT  0x02            /* mode 1, one shot               */
130#define TIMER_RATEGEN  0x04            /* mode 2, rate generator         */
131#define TIMER_SQWAVE   0x06            /* mode 3, square wave            */
132#define TIMER_SWSTROBE 0x08            /* mode 4, s/w triggered strobe   */
133#define TIMER_HWSTROBE 0x0a            /* mode 5, h/w triggered strobe   */
134#define TIMER_LATCH    0x00            /* latch counter for reading      */
135#define TIMER_LSB      0x10            /* r/w counter LSB                */
136#define TIMER_MSB      0x20            /* r/w counter MSB                */
137#define TIMER_16BIT    0x30            /* r/w counter 16 bits, LSB first */
138#define TIMER_BCD      0x01            /* count in BCD                   */
139#define TIMER_RD_BACK  0xc0            /* Read Back Command              */
140                /* READ BACK command layout in the Command Register      */
141#define RB_NOT_COUNT    0x40           /* Don't select counter latch     */
142#define RB_NOT_STATUS   0x20           /* Don't select status latch      */
143#define RB_COUNT_0      0x02           /* Counter 0 latch                */
144#define RB_COUNT_1      0x04           /* Counter 1 latch                */
145#define RB_COUNT_2      0x08           /* Counter 2 latch                */
146#define RB_OUTPUT       0x80           /* Output of the counter is 1     */
147
148#define TIMER_TICK     1193182  /* The internal tick rate in ticks per second */
149
150/*-------------------------------------------------------------------------+
151| Console Defines
152|      WARNING: These Values MUST match the order in
153|               Console_Configuration_Ports
154+--------------------------------------------------------------------------*/
155#define    BSP_CONSOLE_VGA            0
156#define    BSP_CONSOLE_COM1           1
157#define    BSP_CONSOLE_COM2           2
158
159/*-------------------------------------------------------------------------+
160| Convert microseconds to ticks and ticks to microseconds.
161+--------------------------------------------------------------------------*/
162#define US_TO_TICK(us) (((us)*105+44)/88)
163#define TICK_TO_US(tk) (((tk)*88+52)/105)
164
165/*-------------------------------------------------------------------------+
166| External Variables.
167+--------------------------------------------------------------------------*/
168extern interrupt_gate_descriptor Interrupt_descriptor_table[IDT_SIZE];
169extern segment_descriptors _Global_descriptor_table   [GDT_SIZE];
170
171/*-------------------------------------------------------------------------+
172| Function Prototypes.
173+--------------------------------------------------------------------------*/
174void          _IBMPC_initVideo(void);    /* from 'outch.c'  */
175void          _IBMPC_outch    (char);    /* from 'outch.c'  */
176char          _IBMPC_inch     (void);    /* from 'inch.c'   */
177char          _IBMPC_inch_sleep (void);  /* from 'inch.c'   */
178int           BSP_wait_polled_input(void); /* from 'inch.c' */
179int           rtems_kbpoll( void );      /* from 'inch.c' */
180int           getch( void );             /* from 'inch.c' */
181void           add_to_queue( unsigned short b ); /* from 'inch.c' */
182
183void Wait_X_ms(unsigned int timeToWait); /* from 'timer.c'  */
184void Calibrate_loop_1ms(void);           /* from 'timer.c'  */
185
186void rtems_irq_mngt_init(void);          /* from 'irq_init.c' */
187
188#if (BSP_IS_EDISON == 0)
189  void Clock_driver_install_handler(void);             /* from 'ckinit.c'  */
190  void Clock_driver_support_initialize_hardware(void); /* from 'ckinit.c'  */
191#else
192  /**
193   *  @defgroup edison_bsp Clock Tick Support
194   *
195   *  @ingroup i386_pc386
196   *
197   *  @brief Clock Tick Support Package
198   */
199   void *clock_driver_sim_idle_body(uintptr_t);
200   #define BSP_IDLE_TASK_BODY clock_driver_sim_idle_body
201  /* 
202   * hack to kill some time. Hopefully hitting a hardware register is slower
203   * than an empty loop.
204   */
205  #define BSP_CLOCK_DRIVER_DELAY() \
206    do { \
207      uint64_t _i = 2500000; \
208      while (_i) { \
209        _i--; \
210      } \
211    } while ( 0 )
212#endif /* edison */
213
214void *bsp_idle_thread( uintptr_t ignored );
215#define BSP_IDLE_TASK_BODY bsp_idle_thread
216
217void kbd_reset_setup(char *str, int *ints);   /* from 'pc_keyb.c' */
218size_t read_aux(char * buffer, size_t count); /* from 'ps2_mouse.c'  */
219
220bool bsp_get_serial_mouse_device(             /* from 'serial_mouse.c' */
221  const char **name,
222  const char **type
223);
224
225void register_leds(                           /* from 'keyboard.c' */
226  int console,
227  unsigned int led,
228  unsigned int *addr,
229  unsigned int mask
230);
231
232/* Definitions for BSPConsolePort */
233#define BSP_CONSOLE_PORT_CONSOLE (-1)
234#define BSP_CONSOLE_PORT_COM1    (BSP_UART_COM1)
235#define BSP_CONSOLE_PORT_COM2    (BSP_UART_COM2)
236
237/*
238 * Command line.
239 */
240const char* bsp_cmdline(void);
241const char* bsp_cmdline_arg(const char* arg);
242
243#if BSP_ENABLE_IDE
244/*
245 * IDE command line parsing.
246 */
247void bsp_ide_cmdline_init(void);
248
249/*
250 * indicate, that BSP has IDE driver
251 */
252#define RTEMS_BSP_HAS_IDE_DRIVER
253#endif
254
255/* GDB stub stuff */
256void init_remote_gdb( void );
257void i386_stub_glue_init(int uart);
258void i386_stub_glue_init_breakin(void);
259void breakpoint(void);
260
261#define BSP_MAXIMUM_DEVICES 6
262
263/*
264 * Debug helper methods
265 */
266typedef __FILE FILE;
267uint32_t BSP_irq_count_dump(FILE *f);
268
269/*
270 * Prototypes just called from .S files. This lets the .S file include
271 * bsp.h just to establish the dependency.
272 */
273void raw_idt_notify(void);
274void C_dispatch_isr(int vector);
275
276#ifdef __cplusplus
277}
278#endif
279
280#endif /* !ASM */
281
282#endif /* _BSP_H */
Note: See TracBrowser for help on using the repository browser.