[7150f00f] | 1 | /*-------------------------------------------------------------------------+ |
---|
| 2 | | console.c v1.1 - PC386 BSP - 1997/08/07 |
---|
| 3 | +--------------------------------------------------------------------------+ |
---|
| 4 | | This file contains the PC386 console I/O package. |
---|
| 5 | +--------------------------------------------------------------------------+ |
---|
| 6 | | (C) Copyright 1997 - |
---|
| 7 | | - NavIST Group - Real-Time Distributed Systems and Industrial Automation |
---|
| 8 | | |
---|
| 9 | | http://pandora.ist.utl.pt |
---|
| 10 | | |
---|
| 11 | | Instituto Superior Tecnico * Lisboa * PORTUGAL |
---|
| 12 | +--------------------------------------------------------------------------+ |
---|
| 13 | | Disclaimer: |
---|
| 14 | | |
---|
| 15 | | This file is provided "AS IS" without warranty of any kind, either |
---|
| 16 | | expressed or implied. |
---|
| 17 | +--------------------------------------------------------------------------+ |
---|
| 18 | | This code is based on: |
---|
| 19 | | console.c,v 1.4 1995/12/19 20:07:23 joel Exp - go32 BSP |
---|
| 20 | | With the following copyright notice: |
---|
| 21 | | ************************************************************************** |
---|
[60b791ad] | 22 | | * COPYRIGHT (c) 1989-1998. |
---|
[6f9c75c3] | 23 | | * On-Line Applications Research Corporation (OAR). |
---|
| 24 | | * Copyright assigned to U.S. Government, 1994. |
---|
| 25 | | * |
---|
| 26 | | * The license and distribution terms for this file may be |
---|
| 27 | | * found in found in the file LICENSE in this distribution or at |
---|
| 28 | | * http://www.OARcorp.com/rtems/license.html. |
---|
[7150f00f] | 29 | | ************************************************************************** |
---|
[6f9c75c3] | 30 | | |
---|
| 31 | | $Id$ |
---|
[7150f00f] | 32 | +--------------------------------------------------------------------------*/ |
---|
| 33 | |
---|
[dbfa3148] | 34 | #include <stdio.h> |
---|
[7150f00f] | 35 | #include <stdlib.h> |
---|
[5d18fb0] | 36 | #include <assert.h> |
---|
[0ebbf66] | 37 | #undef __assert |
---|
| 38 | void __assert (const char *file, int line, const char *msg); |
---|
[7150f00f] | 39 | |
---|
| 40 | #include <bsp.h> |
---|
| 41 | #include <irq.h> |
---|
| 42 | #include <rtems/libio.h> |
---|
[5d18fb0] | 43 | #include <termios.h> |
---|
[0ebbf66] | 44 | #include <uart.h> |
---|
[2d7d605] | 45 | #include <libcpu/cpuModel.h> |
---|
[5d18fb0] | 46 | |
---|
[de9edc4] | 47 | /* |
---|
| 48 | * Possible value for console input/output : |
---|
[0ebbf66] | 49 | * BSP_CONSOLE_PORT_CONSOLE |
---|
| 50 | * BSP_UART_COM1 |
---|
| 51 | * BSP_UART_COM2 |
---|
[de9edc4] | 52 | */ |
---|
| 53 | |
---|
[b7e3949] | 54 | /* |
---|
| 55 | * Possible value for console input/output : |
---|
[0ebbf66] | 56 | * BSP_CONSOLE_PORT_CONSOLE |
---|
| 57 | * BSP_UART_COM1 |
---|
| 58 | * BSP_UART_COM2 |
---|
[b7e3949] | 59 | */ |
---|
| 60 | |
---|
[0ebbf66] | 61 | int BSPConsolePort = BSP_CONSOLE_PORT_CONSOLE; |
---|
| 62 | |
---|
| 63 | /* int BSPConsolePort = BSP_UART_COM2; */ |
---|
| 64 | int BSPBaseBaud = 115200; |
---|
[5d18fb0] | 65 | |
---|
[69036586] | 66 | extern BSP_polling_getchar_function_type BSP_poll_char; |
---|
[7150f00f] | 67 | |
---|
| 68 | /*-------------------------------------------------------------------------+ |
---|
| 69 | | External Prototypes |
---|
| 70 | +--------------------------------------------------------------------------*/ |
---|
[8a496e46] | 71 | extern void _IBMPC_keyboard_isr(void); |
---|
| 72 | extern rtems_boolean _IBMPC_scankey(char *); /* defined in 'inch.c' */ |
---|
| 73 | extern char BSP_wait_polled_input(void); |
---|
[0ebbf66] | 74 | extern void _IBMPC_initVideo(void); |
---|
[8a496e46] | 75 | |
---|
| 76 | static int conSetAttr(int minor, const struct termios *); |
---|
| 77 | static void isr_on(const rtems_irq_connect_data *); |
---|
| 78 | static void isr_off(const rtems_irq_connect_data *); |
---|
| 79 | static int isr_is_on(const rtems_irq_connect_data *); |
---|
| 80 | |
---|
[67a2288] | 81 | |
---|
[0ebbf66] | 82 | static rtems_irq_connect_data console_isr_data = {BSP_KEYBOARD, |
---|
[67a2288] | 83 | _IBMPC_keyboard_isr, |
---|
[8a496e46] | 84 | isr_on, |
---|
| 85 | isr_off, |
---|
| 86 | isr_is_on}; |
---|
| 87 | |
---|
| 88 | static void |
---|
| 89 | isr_on(const rtems_irq_connect_data *unused) |
---|
| 90 | { |
---|
| 91 | return; |
---|
| 92 | } |
---|
[67a2288] | 93 | |
---|
[8a496e46] | 94 | static void |
---|
| 95 | isr_off(const rtems_irq_connect_data *unused) |
---|
| 96 | { |
---|
| 97 | return; |
---|
| 98 | } |
---|
[7150f00f] | 99 | |
---|
[8a496e46] | 100 | static int |
---|
| 101 | isr_is_on(const rtems_irq_connect_data *irq) |
---|
| 102 | { |
---|
[0ebbf66] | 103 | return BSP_irq_enabled_at_i8259s(irq->name); |
---|
[8a496e46] | 104 | } |
---|
[7150f00f] | 105 | |
---|
[5d18fb0] | 106 | void console_reserve_resources(rtems_configuration_table *conf) |
---|
[7150f00f] | 107 | { |
---|
[0ebbf66] | 108 | if(BSPConsolePort != BSP_CONSOLE_PORT_CONSOLE) |
---|
[5d18fb0] | 109 | { |
---|
| 110 | rtems_termios_reserve_resources(conf, 1); |
---|
| 111 | } |
---|
[0ebbf66] | 112 | |
---|
[5d18fb0] | 113 | return; |
---|
| 114 | } |
---|
[7150f00f] | 115 | |
---|
[0ebbf66] | 116 | void __assert (const char *file, int line, const char *msg) |
---|
[7150f00f] | 117 | { |
---|
[0ebbf66] | 118 | static char exit_msg[] = "EXECUTIVE SHUTDOWN! Any key to reboot..."; |
---|
[dbfa3148] | 119 | unsigned char ch; |
---|
[0ebbf66] | 120 | |
---|
[dbfa3148] | 121 | /* |
---|
| 122 | * Note we cannot call exit or printf from here, |
---|
| 123 | * assert can fail inside ISR too |
---|
| 124 | */ |
---|
[0ebbf66] | 125 | |
---|
| 126 | /* |
---|
[b285860] | 127 | * Close console |
---|
| 128 | */ |
---|
[97d6366] | 129 | close(2); |
---|
| 130 | close(1); |
---|
| 131 | close(0); |
---|
[b285860] | 132 | |
---|
[69036586] | 133 | printk("\nassert failed: %s: ", file); |
---|
| 134 | printk("%d: ", line); |
---|
| 135 | printk("%s\n\n", msg); |
---|
| 136 | printk(exit_msg); |
---|
| 137 | ch = BSP_poll_char(); |
---|
| 138 | printk("\n\n"); |
---|
[dbfa3148] | 139 | rtemsReboot(); |
---|
[0ebbf66] | 140 | |
---|
[5d18fb0] | 141 | } |
---|
[7150f00f] | 142 | |
---|
[dbfa3148] | 143 | |
---|
[7150f00f] | 144 | /*-------------------------------------------------------------------------+ |
---|
| 145 | | Console device driver INITIALIZE entry point. |
---|
| 146 | +--------------------------------------------------------------------------+ |
---|
| 147 | | Initilizes the I/O console (keyboard + VGA display) driver. |
---|
| 148 | +--------------------------------------------------------------------------*/ |
---|
| 149 | rtems_device_driver |
---|
| 150 | console_initialize(rtems_device_major_number major, |
---|
| 151 | rtems_device_minor_number minor, |
---|
| 152 | void *arg) |
---|
| 153 | { |
---|
| 154 | rtems_status_code status; |
---|
| 155 | |
---|
[da38d8a] | 156 | /* |
---|
| 157 | * The video was initialized in the start.s code and does not need |
---|
| 158 | * to be reinitialized. |
---|
| 159 | */ |
---|
[7150f00f] | 160 | |
---|
| 161 | |
---|
[0ebbf66] | 162 | if(BSPConsolePort == BSP_CONSOLE_PORT_CONSOLE) |
---|
| 163 | { |
---|
[5d18fb0] | 164 | /* Install keyboard interrupt handler */ |
---|
[0ebbf66] | 165 | status = BSP_install_rtems_irq_handler(&console_isr_data); |
---|
[67a2288] | 166 | |
---|
[2d7d605] | 167 | if (!status) |
---|
[5d18fb0] | 168 | { |
---|
| 169 | printk("Error installing keyboard interrupt handler!\n"); |
---|
| 170 | rtems_fatal_error_occurred(status); |
---|
| 171 | } |
---|
| 172 | |
---|
| 173 | status = rtems_io_register_name("/dev/console", major, 0); |
---|
| 174 | if (status != RTEMS_SUCCESSFUL) |
---|
| 175 | { |
---|
| 176 | printk("Error registering console device!\n"); |
---|
| 177 | rtems_fatal_error_occurred(status); |
---|
| 178 | } |
---|
| 179 | printk("Initialized console on port CONSOLE\n\n"); |
---|
| 180 | } |
---|
| 181 | else |
---|
| 182 | { |
---|
| 183 | /* |
---|
| 184 | * Set up TERMIOS |
---|
| 185 | */ |
---|
| 186 | rtems_termios_initialize (); |
---|
| 187 | |
---|
| 188 | /* |
---|
| 189 | * Do device-specific initialization |
---|
| 190 | */ |
---|
| 191 | |
---|
| 192 | /* 9600-8-N-1 */ |
---|
[0ebbf66] | 193 | BSP_uart_init(BSPConsolePort, 9600, 0); |
---|
[5d18fb0] | 194 | |
---|
| 195 | |
---|
| 196 | /* Set interrupt handler */ |
---|
[0ebbf66] | 197 | if(BSPConsolePort == BSP_UART_COM1) |
---|
[5d18fb0] | 198 | { |
---|
[0ebbf66] | 199 | console_isr_data.name = BSP_UART_COM1_IRQ; |
---|
| 200 | console_isr_data.hdl = BSP_uart_termios_isr_com1; |
---|
[67a2288] | 201 | |
---|
[5d18fb0] | 202 | } |
---|
| 203 | else |
---|
| 204 | { |
---|
[0ebbf66] | 205 | assert(BSPConsolePort == BSP_UART_COM2); |
---|
| 206 | console_isr_data.name = BSP_UART_COM2_IRQ; |
---|
| 207 | console_isr_data.hdl = BSP_uart_termios_isr_com2; |
---|
[5d18fb0] | 208 | } |
---|
[67a2288] | 209 | |
---|
[0ebbf66] | 210 | status = BSP_install_rtems_irq_handler(&console_isr_data); |
---|
[69036586] | 211 | |
---|
| 212 | if (!status){ |
---|
| 213 | printk("Error installing serial console interrupt handler!\n"); |
---|
| 214 | rtems_fatal_error_occurred(status); |
---|
| 215 | } |
---|
[5d18fb0] | 216 | /* |
---|
| 217 | * Register the device |
---|
| 218 | */ |
---|
| 219 | status = rtems_io_register_name ("/dev/console", major, 0); |
---|
| 220 | if (status != RTEMS_SUCCESSFUL) |
---|
| 221 | { |
---|
| 222 | printk("Error registering console device!\n"); |
---|
| 223 | rtems_fatal_error_occurred (status); |
---|
| 224 | } |
---|
| 225 | |
---|
[0ebbf66] | 226 | if(BSPConsolePort == BSP_UART_COM1) |
---|
[5d18fb0] | 227 | { |
---|
| 228 | printk("Initialized console on port COM1 9600-8-N-1\n\n"); |
---|
| 229 | } |
---|
| 230 | else |
---|
| 231 | { |
---|
| 232 | printk("Initialized console on port COM2 9600-8-N-1\n\n"); |
---|
| 233 | } |
---|
[8a496e46] | 234 | #define PRINTK_ON_SERIAL |
---|
[de9edc4] | 235 | #ifdef PRINTK_ON_SERIAL |
---|
| 236 | /* |
---|
| 237 | * You can remove the follwoing tree lines if you want to have printk |
---|
| 238 | * using the video console for output while printf use serial line. |
---|
| 239 | * This may be convenient to debug the serial line driver itself... |
---|
| 240 | */ |
---|
[0ebbf66] | 241 | /* printk("Warning : This will be the last message displayed on console\n");*/ |
---|
[69036586] | 242 | BSP_output_char = (BSP_output_char_function_type) BSP_output_char_via_serial; |
---|
| 243 | BSP_poll_char = (BSP_polling_getchar_function_type) BSP_poll_char_via_serial; |
---|
[de9edc4] | 244 | #endif |
---|
[5d18fb0] | 245 | } |
---|
[7150f00f] | 246 | return RTEMS_SUCCESSFUL; |
---|
| 247 | } /* console_initialize */ |
---|
| 248 | |
---|
| 249 | |
---|
[b285860] | 250 | static int console_open_count = 0; |
---|
| 251 | |
---|
[8a496e46] | 252 | static int console_last_close(int major, int minor, void *arg) |
---|
[b285860] | 253 | { |
---|
[0ebbf66] | 254 | BSP_remove_rtems_irq_handler (&console_isr_data); |
---|
[8a496e46] | 255 | |
---|
| 256 | return 0; |
---|
[b285860] | 257 | } |
---|
| 258 | |
---|
[7150f00f] | 259 | /*-------------------------------------------------------------------------+ |
---|
| 260 | | Console device driver OPEN entry point |
---|
| 261 | +--------------------------------------------------------------------------*/ |
---|
| 262 | rtems_device_driver |
---|
| 263 | console_open(rtems_device_major_number major, |
---|
[5d18fb0] | 264 | rtems_device_minor_number minor, |
---|
| 265 | void *arg) |
---|
[7150f00f] | 266 | { |
---|
[5d18fb0] | 267 | rtems_status_code status; |
---|
| 268 | static rtems_termios_callbacks cb = |
---|
| 269 | { |
---|
| 270 | NULL, /* firstOpen */ |
---|
[b285860] | 271 | console_last_close, /* lastClose */ |
---|
[5d18fb0] | 272 | NULL, /* pollRead */ |
---|
[0ebbf66] | 273 | BSP_uart_termios_write_com1, /* write */ |
---|
[5d18fb0] | 274 | conSetAttr, /* setAttributes */ |
---|
| 275 | NULL, /* stopRemoteTx */ |
---|
| 276 | NULL, /* startRemoteTx */ |
---|
| 277 | 1 /* outputUsesInterrupts */ |
---|
| 278 | }; |
---|
| 279 | |
---|
[0ebbf66] | 280 | if(BSPConsolePort == BSP_CONSOLE_PORT_CONSOLE) |
---|
[5d18fb0] | 281 | { |
---|
[b285860] | 282 | ++console_open_count; |
---|
[5d18fb0] | 283 | return RTEMS_SUCCESSFUL; |
---|
| 284 | } |
---|
[7150f00f] | 285 | |
---|
[0ebbf66] | 286 | if(BSPConsolePort == BSP_UART_COM2) |
---|
[5d18fb0] | 287 | { |
---|
[0ebbf66] | 288 | cb.write = BSP_uart_termios_write_com2; |
---|
[5d18fb0] | 289 | } |
---|
| 290 | |
---|
| 291 | status = rtems_termios_open (major, minor, arg, &cb); |
---|
| 292 | |
---|
| 293 | if(status != RTEMS_SUCCESSFUL) |
---|
| 294 | { |
---|
| 295 | printk("Error openning console device\n"); |
---|
| 296 | return status; |
---|
| 297 | } |
---|
| 298 | |
---|
| 299 | /* |
---|
| 300 | * Pass data area info down to driver |
---|
| 301 | */ |
---|
[0ebbf66] | 302 | BSP_uart_termios_set(BSPConsolePort, |
---|
[5d18fb0] | 303 | ((rtems_libio_open_close_args_t *)arg)->iop->data1); |
---|
| 304 | |
---|
| 305 | /* Enable interrupts on channel */ |
---|
[0ebbf66] | 306 | BSP_uart_intr_ctrl(BSPConsolePort, BSP_UART_INTR_CTRL_TERMIOS); |
---|
[5d18fb0] | 307 | |
---|
| 308 | return RTEMS_SUCCESSFUL; |
---|
| 309 | } |
---|
[7150f00f] | 310 | |
---|
| 311 | /*-------------------------------------------------------------------------+ |
---|
| 312 | | Console device driver CLOSE entry point |
---|
| 313 | +--------------------------------------------------------------------------*/ |
---|
| 314 | rtems_device_driver |
---|
| 315 | console_close(rtems_device_major_number major, |
---|
| 316 | rtems_device_minor_number minor, |
---|
| 317 | void *arg) |
---|
| 318 | { |
---|
[67a2288] | 319 | rtems_device_driver res = RTEMS_SUCCESSFUL; |
---|
[b285860] | 320 | |
---|
[0ebbf66] | 321 | if(BSPConsolePort != BSP_CONSOLE_PORT_CONSOLE) |
---|
[5d18fb0] | 322 | { |
---|
[67a2288] | 323 | res = rtems_termios_close (arg); |
---|
[5d18fb0] | 324 | } |
---|
[b285860] | 325 | else { |
---|
| 326 | if (--console_open_count == 0) { |
---|
[8a496e46] | 327 | console_last_close(major, minor, arg); |
---|
[b285860] | 328 | } |
---|
| 329 | } |
---|
[67a2288] | 330 | |
---|
| 331 | return res; |
---|
[7150f00f] | 332 | } /* console_close */ |
---|
| 333 | |
---|
| 334 | |
---|
| 335 | /*-------------------------------------------------------------------------+ |
---|
| 336 | | Console device driver READ entry point. |
---|
| 337 | +--------------------------------------------------------------------------+ |
---|
| 338 | | Read characters from the I/O console. We only have stdin. |
---|
| 339 | +--------------------------------------------------------------------------*/ |
---|
| 340 | rtems_device_driver |
---|
| 341 | console_read(rtems_device_major_number major, |
---|
| 342 | rtems_device_minor_number minor, |
---|
| 343 | void *arg) |
---|
| 344 | { |
---|
| 345 | rtems_libio_rw_args_t *rw_args = (rtems_libio_rw_args_t *)arg; |
---|
| 346 | char *buffer = rw_args->buffer; |
---|
| 347 | int count, maximum = rw_args->count; |
---|
[5d18fb0] | 348 | |
---|
[0ebbf66] | 349 | if(BSPConsolePort != BSP_CONSOLE_PORT_CONSOLE) |
---|
[5d18fb0] | 350 | { |
---|
| 351 | return rtems_termios_read (arg); |
---|
| 352 | } |
---|
[7150f00f] | 353 | |
---|
| 354 | for (count = 0; count < maximum; count++) |
---|
| 355 | { |
---|
[5d18fb0] | 356 | /* Get character */ |
---|
| 357 | buffer[count] = _IBMPC_inch_sleep(); |
---|
| 358 | |
---|
| 359 | /* Echo character to screen */ |
---|
| 360 | _IBMPC_outch(buffer[count]); |
---|
| 361 | if (buffer[count] == '\r') |
---|
| 362 | { |
---|
| 363 | _IBMPC_outch('\n'); /* CR = CR + LF */ |
---|
| 364 | } |
---|
| 365 | |
---|
[7150f00f] | 366 | if (buffer[count] == '\n' || buffer[count] == '\r') |
---|
| 367 | { |
---|
| 368 | /* What if this goes past the end of the buffer? We're hosed. [bhc] */ |
---|
| 369 | buffer[count++] = '\n'; |
---|
| 370 | buffer[count] = '\0'; |
---|
| 371 | break; |
---|
| 372 | } |
---|
| 373 | } |
---|
| 374 | |
---|
| 375 | rw_args->bytes_moved = count; |
---|
| 376 | return ((count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED); |
---|
| 377 | } /* console_read */ |
---|
| 378 | |
---|
| 379 | |
---|
| 380 | /*-------------------------------------------------------------------------+ |
---|
| 381 | | Console device driver WRITE entry point. |
---|
| 382 | +--------------------------------------------------------------------------+ |
---|
| 383 | | Write characters to the I/O console. Stderr and stdout are the same. |
---|
| 384 | +--------------------------------------------------------------------------*/ |
---|
| 385 | rtems_device_driver |
---|
| 386 | console_write(rtems_device_major_number major, |
---|
| 387 | rtems_device_minor_number minor, |
---|
| 388 | void * arg) |
---|
| 389 | { |
---|
| 390 | rtems_libio_rw_args_t *rw_args = (rtems_libio_rw_args_t *)arg; |
---|
| 391 | char *buffer = rw_args->buffer; |
---|
| 392 | int count, maximum = rw_args->count; |
---|
[5d18fb0] | 393 | |
---|
[0ebbf66] | 394 | if(BSPConsolePort != BSP_CONSOLE_PORT_CONSOLE) |
---|
[5d18fb0] | 395 | { |
---|
| 396 | return rtems_termios_write (arg); |
---|
| 397 | } |
---|
[7150f00f] | 398 | |
---|
| 399 | for (count = 0; count < maximum; count++) |
---|
| 400 | { |
---|
[5d18fb0] | 401 | _IBMPC_outch(buffer[count]); |
---|
[7150f00f] | 402 | if (buffer[count] == '\n') |
---|
[5d18fb0] | 403 | _IBMPC_outch('\r'); /* LF = LF + CR */ |
---|
[7150f00f] | 404 | } |
---|
| 405 | |
---|
| 406 | rw_args->bytes_moved = maximum; |
---|
| 407 | return RTEMS_SUCCESSFUL; |
---|
| 408 | } /* console_write */ |
---|
| 409 | |
---|
| 410 | |
---|
[5d18fb0] | 411 | |
---|
| 412 | /* |
---|
| 413 | * Handle ioctl request. |
---|
| 414 | */ |
---|
| 415 | rtems_device_driver |
---|
[7150f00f] | 416 | console_control(rtems_device_major_number major, |
---|
[5d18fb0] | 417 | rtems_device_minor_number minor, |
---|
| 418 | void * arg |
---|
| 419 | ) |
---|
| 420 | { |
---|
[0ebbf66] | 421 | if(BSPConsolePort != BSP_CONSOLE_PORT_CONSOLE) |
---|
[5d18fb0] | 422 | { |
---|
| 423 | return rtems_termios_ioctl (arg); |
---|
| 424 | } |
---|
| 425 | |
---|
[7150f00f] | 426 | return RTEMS_SUCCESSFUL; |
---|
[5d18fb0] | 427 | } |
---|
| 428 | |
---|
| 429 | static int |
---|
| 430 | conSetAttr(int minor, const struct termios *t) |
---|
| 431 | { |
---|
| 432 | int baud; |
---|
| 433 | |
---|
| 434 | switch (t->c_cflag & CBAUD) |
---|
| 435 | { |
---|
| 436 | case B50: |
---|
| 437 | baud = 50; |
---|
| 438 | break; |
---|
| 439 | case B75: |
---|
| 440 | baud = 75; |
---|
| 441 | break; |
---|
| 442 | case B110: |
---|
| 443 | baud = 110; |
---|
| 444 | break; |
---|
| 445 | case B134: |
---|
| 446 | baud = 134; |
---|
| 447 | break; |
---|
| 448 | case B150: |
---|
| 449 | baud = 150; |
---|
| 450 | break; |
---|
| 451 | case B200: |
---|
| 452 | baud = 200; |
---|
| 453 | break; |
---|
| 454 | case B300: |
---|
| 455 | baud = 300; |
---|
| 456 | break; |
---|
| 457 | case B600: |
---|
| 458 | baud = 600; |
---|
| 459 | break; |
---|
| 460 | case B1200: |
---|
| 461 | baud = 1200; |
---|
| 462 | break; |
---|
| 463 | case B1800: |
---|
| 464 | baud = 1800; |
---|
| 465 | break; |
---|
| 466 | case B2400: |
---|
| 467 | baud = 2400; |
---|
| 468 | break; |
---|
| 469 | case B4800: |
---|
| 470 | baud = 4800; |
---|
| 471 | break; |
---|
| 472 | case B9600: |
---|
| 473 | baud = 9600; |
---|
| 474 | break; |
---|
| 475 | case B19200: |
---|
| 476 | baud = 19200; |
---|
| 477 | break; |
---|
| 478 | case B38400: |
---|
| 479 | baud = 38400; |
---|
| 480 | break; |
---|
| 481 | case B57600: |
---|
| 482 | baud = 57600; |
---|
| 483 | break; |
---|
| 484 | case B115200: |
---|
| 485 | baud = 115200; |
---|
| 486 | break; |
---|
| 487 | default: |
---|
| 488 | baud = 0; |
---|
| 489 | rtems_fatal_error_occurred (RTEMS_INTERNAL_ERROR); |
---|
| 490 | return 0; |
---|
| 491 | } |
---|
| 492 | |
---|
[0ebbf66] | 493 | BSP_uart_set_baud(BSPConsolePort, baud); |
---|
[5d18fb0] | 494 | |
---|
| 495 | return 0; |
---|
| 496 | } |
---|
| 497 | |
---|
[bd8c8b2a] | 498 | /* |
---|
| 499 | * BSP initialization |
---|
| 500 | */ |
---|
| 501 | |
---|
[2d7d605] | 502 | BSP_output_char_function_type BSP_output_char = |
---|
| 503 | (BSP_output_char_function_type) _IBMPC_outch; |
---|
| 504 | |
---|
| 505 | BSP_polling_getchar_function_type BSP_poll_char = BSP_wait_polled_input; |
---|
| 506 | |
---|
[5d18fb0] | 507 | |
---|