Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:41

0001 /**
0002  * @file
0003  *
0004  * @ingroup RTEMSBSPsI386Pc386
0005  *
0006  * @brief Global BSP definitions.
0007  */
0008 
0009 /*-------------------------------------------------------------------------+
0010 | bsp.h v1.1 - PC386 BSP - 1997/08/07
0011 +--------------------------------------------------------------------------+
0012 | This include file contains definitions related to the PC386 BSP.
0013 +--------------------------------------------------------------------------+
0014 | (C) Copyright 1997 -
0015 | - NavIST Group - Real-Time Distributed Systems and Industrial Automation
0016 |
0017 | http://pandora.ist.utl.pt
0018 |
0019 | Instituto Superior Tecnico * Lisboa * PORTUGAL
0020 +--------------------------------------------------------------------------+
0021 | Modified by Eric Valette the 20/05/98 in order to add definitions used
0022 | to enhance video putchar capabilities.
0023 |
0024 | Copyright (C) 1998  valette@crf.canon.fr
0025 |
0026 | Canon Centre Recherche France.
0027 |
0028 +--------------------------------------------------------------------------+
0029 | Disclaimer:
0030 |
0031 | This file is provided "AS IS" without warranty of any kind, either
0032 | expressed or implied.
0033 +--------------------------------------------------------------------------+
0034 | This code is based on:
0035 |   bsp.h,v 1.5 1995/12/19 20:07:30 joel Exp - go32 BSP
0036 | With the following copyright notice:
0037 | **************************************************************************
0038 | *  COPYRIGHT (c) 1989-1999.
0039 | *  On-Line Applications Research Corporation (OAR).
0040 | *
0041 | *  The license and distribution terms for this file may be
0042 | *  found in the file LICENSE in this distribution or at
0043 | *  http://www.rtems.org/license/LICENSE.
0044 | **************************************************************************
0045 +--------------------------------------------------------------------------*/
0046 
0047 #ifndef LIBBSP_I386_PC386_BSP_H
0048 #define LIBBSP_I386_PC386_BSP_H
0049 
0050 /**
0051  * @addtogroup RTEMSBSPsI386
0052  *
0053  * @{
0054  */
0055 #ifndef ASM
0056 
0057 #include <bspopts.h>
0058 #include <bsp/default-initial-extension.h>
0059 #include <bsp/tblsizes.h>
0060 
0061 #include <rtems.h>
0062 #include <rtems/score/cpu.h>
0063 #include <rtems/bspIo.h>
0064 
0065 #ifdef __cplusplus
0066 extern "C" {
0067 #endif
0068 
0069 
0070 
0071 #define BSP_HAS_FRAME_BUFFER 1
0072 
0073 /*
0074  * Network driver configuration
0075  */
0076 struct rtems_bsdnet_ifconfig;
0077 
0078 /* app. may provide a routine (called _very_ early) to tell us
0079  * which ports to use for printk / console. BSP provides a default
0080  * implementation (weak alias) which does nothing (use BSP default
0081  * ports).
0082  */
0083 extern void
0084 BSP_runtime_console_select(int *pPrintkPort, int *pConsolePort);
0085 
0086 extern int rtems_ne_driver_attach(struct rtems_bsdnet_ifconfig *, int);
0087 #define BSP_NE2000_NETWORK_DRIVER_NAME      "ne1"
0088 #define BSP_NE2000_NETWORK_DRIVER_ATTACH    rtems_ne_driver_attach
0089 
0090 extern int rtems_wd_driver_attach(struct rtems_bsdnet_ifconfig *, int);
0091 #define BSP_WD8003_NETWORK_DRIVER_NAME      "wd1"
0092 #define BSP_WD8003_NETWORK_DRIVER_ATTACH    rtems_wd_driver_attach
0093 
0094 extern int rtems_dec21140_driver_attach(struct rtems_bsdnet_ifconfig *, int);
0095 #define BSP_DEC21140_NETWORK_DRIVER_NAME    "dc1"
0096 #define BSP_DEC21140_NETWORK_DRIVER_ATTACH  rtems_dec21140_driver_attach
0097 
0098 extern int rtems_3c509_driver_attach(struct rtems_bsdnet_ifconfig *config);
0099 #define BSP_3C509_NETWORK_DRIVER_NAME    "3c1"
0100 #define BSP_3C509_NETWORK_DRIVER_ATTACH  rtems_3c509_driver_attach
0101 
0102 #ifndef RTEMS_BSP_NETWORK_DRIVER_NAME
0103 #define RTEMS_BSP_NETWORK_DRIVER_NAME   BSP_DEC21140_NETWORK_DRIVER_NAME
0104 #endif
0105 
0106 #ifndef RTEMS_BSP_NETWORK_DRIVER_ATTACH
0107 #define RTEMS_BSP_NETWORK_DRIVER_ATTACH BSP_DEC21140_NETWORK_DRIVER_ATTACH
0108 #endif
0109 
0110 /*-------------------------------------------------------------------------+
0111 | Constants
0112 +--------------------------------------------------------------------------*/
0113 
0114 /*-------------------------------------------------------------------------+
0115 | Constants relating to the 8254 (or 8253) programmable interval timers.
0116 +--------------------------------------------------------------------------*/
0117 #define IO_TIMER1      0x40
0118                   /* Port address of the control port and timer channels */
0119 #define TIMER_CNTR0    (IO_TIMER1 + 0) /* timer 0 counter port           */
0120 #define TIMER_CNTR1    (IO_TIMER1 + 1) /* timer 1 counter port           */
0121 #define TIMER_CNTR2    (IO_TIMER1 + 2) /* timer 2 counter port           */
0122 #define TIMER_MODE     (IO_TIMER1 + 3) /* timer mode port                */
0123 #define TIMER_SEL0     0x00            /* select counter 0               */
0124 #define TIMER_SEL1     0x40            /* select counter 1               */
0125 #define TIMER_SEL2     0x80            /* select counter 2               */
0126 #define TIMER_INTTC    0x00            /* mode 0, intr on terminal cnt   */
0127 #define TIMER_ONESHOT  0x02            /* mode 1, one shot               */
0128 #define TIMER_RATEGEN  0x04            /* mode 2, rate generator         */
0129 #define TIMER_SQWAVE   0x06            /* mode 3, square wave            */
0130 #define TIMER_SWSTROBE 0x08            /* mode 4, s/w triggered strobe   */
0131 #define TIMER_HWSTROBE 0x0a            /* mode 5, h/w triggered strobe   */
0132 #define TIMER_LATCH    0x00            /* latch counter for reading      */
0133 #define TIMER_LSB      0x10            /* r/w counter LSB                */
0134 #define TIMER_MSB      0x20            /* r/w counter MSB                */
0135 #define TIMER_16BIT    0x30            /* r/w counter 16 bits, LSB first */
0136 #define TIMER_BCD      0x01            /* count in BCD                   */
0137 #define TIMER_RD_BACK  0xc0        /* Read Back Command          */
0138         /* READ BACK command layout in the Command Register      */
0139 #define RB_NOT_COUNT    0x40           /* Don't select counter latch     */
0140 #define RB_NOT_STATUS   0x20           /* Don't select status latch      */
0141 #define RB_COUNT_0  0x02           /* Counter 0 latch        */
0142 #define RB_COUNT_1  0x04           /* Counter 1 latch        */
0143 #define RB_COUNT_2  0x08           /* Counter 2 latch        */
0144 #define RB_OUTPUT   0x80           /* Output of the counter is 1     */
0145 
0146 #define TIMER_TICK     1193182  /* The internal tick rate in ticks per second */
0147 
0148 #if defined( RTEMS_SMP )
0149   extern ISR_lock_Control rtems_i386_i8254_access_lock;
0150 #endif
0151 
0152 
0153 /*-------------------------------------------------------------------------+
0154 | Console Defines
0155 |      WARNING: These Values MUST match the order in
0156 |               Console_Configuration_Ports
0157 +--------------------------------------------------------------------------*/
0158 #define    BSP_CONSOLE_VGA            0
0159 #define    BSP_CONSOLE_COM1           1
0160 #define    BSP_CONSOLE_COM2           2
0161 
0162 /*-------------------------------------------------------------------------+
0163 | Convert microseconds to ticks and ticks to microseconds.
0164 +--------------------------------------------------------------------------*/
0165 #define US_TO_TICK(us) (((us)*105+44)/88)
0166 #define TICK_TO_US(tk) (((tk)*88+52)/105)
0167 
0168 /*-------------------------------------------------------------------------+
0169 | External Variables.
0170 +--------------------------------------------------------------------------*/
0171 extern interrupt_gate_descriptor Interrupt_descriptor_table[IDT_SIZE];
0172 extern segment_descriptors _Global_descriptor_table   [GDT_SIZE];
0173 
0174 /*-------------------------------------------------------------------------+
0175 | Function Prototypes.
0176 +--------------------------------------------------------------------------*/
0177 void          _IBMPC_initVideo(void);    /* from 'outch.c'  */
0178 void          _IBMPC_outch    (char);    /* from 'outch.c'  */
0179 char          _IBMPC_inch     (void);    /* from 'inch.c'   */
0180 char          _IBMPC_inch_sleep (void);  /* from 'inch.c'   */
0181 int           BSP_wait_polled_input(void); /* from 'inch.c' */
0182 int           rtems_kbpoll( void );      /* from 'inch.c' */
0183 int           getch( void );             /* from 'inch.c' */
0184 void           add_to_queue( unsigned short b ); /* from 'inch.c' */
0185 
0186 void Wait_X_ms(unsigned int timeToWait); /* from 'timer.c'  */
0187 void Calibrate_loop_1ms(void);           /* from 'timer.c'  */
0188 
0189 void rtems_irq_mngt_init(void);          /* from 'irq_init.c' */
0190 
0191 void Clock_driver_install_handler(void);             /* from 'ckinit.c'  */
0192 void Clock_driver_support_initialize_hardware(void); /* from 'ckinit.c'  */
0193 
0194 void *bsp_idle_thread( uintptr_t ignored );
0195 #define BSP_IDLE_TASK_BODY bsp_idle_thread
0196 
0197 void kbd_reset_setup(char *str, int *ints);   /* from 'pc_keyb.c' */
0198 size_t read_aux(char * buffer, size_t count); /* from 'ps2_mouse.c'  */
0199 
0200 bool bsp_get_serial_mouse_device(             /* from 'serial_mouse.c' */
0201   const char **name,
0202   const char **type
0203 );
0204 
0205 void register_leds(                           /* from 'keyboard.c' */
0206   int console,
0207   unsigned int led,
0208   unsigned int *addr,
0209   unsigned int mask
0210 );
0211 
0212 /* Definitions for BSPConsolePort */
0213 #define BSP_CONSOLE_PORT_CONSOLE (-1)
0214 #define BSP_CONSOLE_PORT_COM1    (BSP_UART_COM1)
0215 #define BSP_CONSOLE_PORT_COM2    (BSP_UART_COM2)
0216 
0217 /*
0218  * Command line.
0219  */
0220 const char* bsp_cmdline(void);
0221 const char* bsp_cmdline_arg(const char* arg);
0222 
0223 #if BSP_ENABLE_IDE
0224 /*
0225  * IDE command line parsing.
0226  */
0227 void bsp_ide_cmdline_init(void);
0228 
0229 /*
0230  * indicate, that BSP has IDE driver
0231  */
0232 #define RTEMS_BSP_HAS_IDE_DRIVER
0233 #endif
0234 
0235 /* GDB stub stuff */
0236 void init_remote_gdb( void );
0237 void i386_stub_glue_init(int uart);
0238 void i386_stub_glue_init_breakin(void);
0239 int i386_stub_glue_uart(void);
0240 void breakpoint(void);
0241 
0242 /*
0243  * Debug helper methods
0244  */
0245 typedef __FILE FILE;
0246 uint32_t BSP_irq_count_dump(FILE *f);
0247 
0248 /*
0249  * Prototypes just called from .S files. This lets the .S file include
0250  * bsp.h just to establish the dependency.
0251  */
0252 void raw_idt_notify(void);
0253 void C_dispatch_isr(int vector);
0254 
0255 #ifdef RTEMS_SMP
0256   /* CPU specific functions used by the SMP API */
0257   int imps_probe(void);
0258   void ipi_install_irq(void);
0259   int send_ipi(unsigned int dst, unsigned int v);
0260 #endif
0261 
0262 #ifdef __cplusplus
0263 }
0264 #endif
0265 
0266 #endif /* !ASM */
0267 
0268 /** @} */
0269 
0270 #endif /* _BSP_H */