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

5
Last change on this file since 3abf685f was 3abf685f, checked in by Joel Sherrill <joel@…>, on 03/25/16 at 15:45:14

i386/pc386/include/bsp.h: Do not include <rtems/clockdrv.h>

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