Changeset 0ebbf66 in rtems for c/src/lib/libbsp/i386/pc386/console/console.c
- Timestamp:
- 10/05/98 22:36:06 (24 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- dc6763c8
- Parents:
- 711a2a1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/lib/libbsp/i386/pc386/console/console.c
r711a2a1 r0ebbf66 35 35 #include <stdlib.h> 36 36 #include <assert.h> 37 #undef __assert 38 void __assert (const char *file, int line, const char *msg); 37 39 38 40 #include <bsp.h> … … 40 42 #include <rtems/libio.h> 41 43 #include <termios.h> 42 #include < pc386uart.h>44 #include <uart.h> 43 45 #include <libcpu/cpuModel.h> 44 46 45 47 /* 46 48 * Possible value for console input/output : 47 * PC386_CONSOLE_PORT_CONSOLE48 * PC386_UART_COM149 * PC386_UART_COM249 * BSP_CONSOLE_PORT_CONSOLE 50 * BSP_UART_COM1 51 * BSP_UART_COM2 50 52 */ 51 53 52 54 /* 53 55 * Possible value for console input/output : 54 * PC386_CONSOLE_PORT_CONSOLE55 * PC386_UART_COM156 * PC386_UART_COM256 * BSP_CONSOLE_PORT_CONSOLE 57 * BSP_UART_COM1 58 * BSP_UART_COM2 57 59 */ 58 60 59 int PC386ConsolePort = PC386_CONSOLE_PORT_CONSOLE; 61 int BSPConsolePort = BSP_CONSOLE_PORT_CONSOLE; 62 63 /* int BSPConsolePort = BSP_UART_COM2; */ 64 int BSPBaseBaud = 115200; 60 65 61 66 extern BSP_polling_getchar_function_type BSP_poll_char; … … 67 72 extern rtems_boolean _IBMPC_scankey(char *); /* defined in 'inch.c' */ 68 73 extern char BSP_wait_polled_input(void); 74 extern void _IBMPC_initVideo(void); 69 75 70 76 static int conSetAttr(int minor, const struct termios *); … … 74 80 75 81 76 static rtems_irq_connect_data console_isr_data = { PC_386_KEYBOARD,82 static rtems_irq_connect_data console_isr_data = {BSP_KEYBOARD, 77 83 _IBMPC_keyboard_isr, 78 84 isr_on, … … 95 101 isr_is_on(const rtems_irq_connect_data *irq) 96 102 { 97 return pc386_irq_enabled_at_i8259s(irq->name);103 return BSP_irq_enabled_at_i8259s(irq->name); 98 104 } 99 105 100 106 void console_reserve_resources(rtems_configuration_table *conf) 101 107 { 102 if(PC386ConsolePort != PC386_CONSOLE_PORT_CONSOLE)108 if(BSPConsolePort != BSP_CONSOLE_PORT_CONSOLE) 103 109 { 104 110 rtems_termios_reserve_resources(conf, 1); 105 111 } 112 106 113 return; 107 114 } 108 115 109 void __assert (const char *file, int line, const char *msg)110 { 111 static char exit_msg[] = "EXECUTIVE SHUTDOWN! Any key to reboot...";116 void __assert (const char *file, int line, const char *msg) 117 { 118 static char exit_msg[] = "EXECUTIVE SHUTDOWN! Any key to reboot..."; 112 119 unsigned char ch; 113 120 114 121 /* 115 122 * Note we cannot call exit or printf from here, 116 123 * assert can fail inside ISR too 117 124 */ 118 /* 125 126 /* 119 127 * Close console 120 128 */ … … 130 138 printk("\n\n"); 131 139 rtemsReboot(); 140 132 141 } 133 142 … … 150 159 */ 151 160 152 if(PC386ConsolePort == PC386_CONSOLE_PORT_CONSOLE) 153 {154 161 162 if(BSPConsolePort == BSP_CONSOLE_PORT_CONSOLE) 163 { 155 164 /* Install keyboard interrupt handler */ 156 status = pc386_install_rtems_irq_handler(&console_isr_data);165 status = BSP_install_rtems_irq_handler(&console_isr_data); 157 166 158 167 if (!status) … … 182 191 183 192 /* 9600-8-N-1 */ 184 PC386_uart_init(PC386ConsolePort, 9600, 0);193 BSP_uart_init(BSPConsolePort, 9600, 0); 185 194 186 195 187 196 /* Set interrupt handler */ 188 if( PC386ConsolePort == PC386_UART_COM1)189 { 190 console_isr_data.name = PC386_UART_COM1_IRQ;191 console_isr_data.hdl = PC386_uart_termios_isr_com1;197 if(BSPConsolePort == BSP_UART_COM1) 198 { 199 console_isr_data.name = BSP_UART_COM1_IRQ; 200 console_isr_data.hdl = BSP_uart_termios_isr_com1; 192 201 193 202 } 194 203 else 195 204 { 196 assert( PC386ConsolePort == PC386_UART_COM2);197 console_isr_data.name = PC386_UART_COM2_IRQ;198 console_isr_data.hdl = PC386_uart_termios_isr_com2;199 } 200 201 status = pc386_install_rtems_irq_handler(&console_isr_data);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; 208 } 209 210 status = BSP_install_rtems_irq_handler(&console_isr_data); 202 211 203 212 if (!status){ … … 215 224 } 216 225 217 if( PC386ConsolePort == PC386_UART_COM1)226 if(BSPConsolePort == BSP_UART_COM1) 218 227 { 219 228 printk("Initialized console on port COM1 9600-8-N-1\n\n"); … … 230 239 * This may be convenient to debug the serial line driver itself... 231 240 */ 232 printk("Warning : This will be the last message displayed on console\n");241 /* printk("Warning : This will be the last message displayed on console\n");*/ 233 242 BSP_output_char = (BSP_output_char_function_type) BSP_output_char_via_serial; 234 243 BSP_poll_char = (BSP_polling_getchar_function_type) BSP_poll_char_via_serial; … … 243 252 static int console_last_close(int major, int minor, void *arg) 244 253 { 245 pc386_remove_rtems_irq_handler (&console_isr_data);254 BSP_remove_rtems_irq_handler (&console_isr_data); 246 255 247 256 return 0; … … 262 271 console_last_close, /* lastClose */ 263 272 NULL, /* pollRead */ 264 PC386_uart_termios_write_com1, /* write */273 BSP_uart_termios_write_com1, /* write */ 265 274 conSetAttr, /* setAttributes */ 266 275 NULL, /* stopRemoteTx */ … … 269 278 }; 270 279 271 if( PC386ConsolePort == PC386_CONSOLE_PORT_CONSOLE)280 if(BSPConsolePort == BSP_CONSOLE_PORT_CONSOLE) 272 281 { 273 282 ++console_open_count; … … 275 284 } 276 285 277 if( PC386ConsolePort == PC386_UART_COM2)278 { 279 cb.write = PC386_uart_termios_write_com2;286 if(BSPConsolePort == BSP_UART_COM2) 287 { 288 cb.write = BSP_uart_termios_write_com2; 280 289 } 281 290 … … 291 300 * Pass data area info down to driver 292 301 */ 293 PC386_uart_termios_set(PC386ConsolePort,302 BSP_uart_termios_set(BSPConsolePort, 294 303 ((rtems_libio_open_close_args_t *)arg)->iop->data1); 295 304 296 305 /* Enable interrupts on channel */ 297 PC386_uart_intr_ctrl(PC386ConsolePort, PC386_UART_INTR_CTRL_TERMIOS);306 BSP_uart_intr_ctrl(BSPConsolePort, BSP_UART_INTR_CTRL_TERMIOS); 298 307 299 308 return RTEMS_SUCCESSFUL; … … 310 319 rtems_device_driver res = RTEMS_SUCCESSFUL; 311 320 312 if( PC386ConsolePort != PC386_CONSOLE_PORT_CONSOLE)321 if(BSPConsolePort != BSP_CONSOLE_PORT_CONSOLE) 313 322 { 314 323 res = rtems_termios_close (arg); … … 338 347 int count, maximum = rw_args->count; 339 348 340 if( PC386ConsolePort != PC386_CONSOLE_PORT_CONSOLE)349 if(BSPConsolePort != BSP_CONSOLE_PORT_CONSOLE) 341 350 { 342 351 return rtems_termios_read (arg); … … 383 392 int count, maximum = rw_args->count; 384 393 385 if( PC386ConsolePort != PC386_CONSOLE_PORT_CONSOLE)394 if(BSPConsolePort != BSP_CONSOLE_PORT_CONSOLE) 386 395 { 387 396 return rtems_termios_write (arg); … … 410 419 ) 411 420 { 412 if( PC386ConsolePort != PC386_CONSOLE_PORT_CONSOLE)421 if(BSPConsolePort != BSP_CONSOLE_PORT_CONSOLE) 413 422 { 414 423 return rtems_termios_ioctl (arg); … … 482 491 } 483 492 484 PC386_uart_set_baud(PC386ConsolePort, baud);493 BSP_uart_set_baud(BSPConsolePort, baud); 485 494 486 495 return 0;
Note: See TracChangeset
for help on using the changeset viewer.