/* * serial_mouse - device driver OPEN entry point */ rtems_device_driver serial_mouse_open(rtems_device_major_number major, rtems_device_minor_number minor, void *arg) { rtems_status_code status; static rtems_termios_callbacks cb = { NULL, /* firstOpen */ serial_mouse_last_close, /* lastClose */ NULL, /* poll read */ BSP_WRITE_FUNC, /* write */ serial_mouse_conSetAttr, /* setAttributes */ NULL, /* stopRemoteTx */ NULL, /* startRemoteTx */ 1 /* outputUsesInterrupts */ }; status = rtems_termios_open( major, minor, arg, &cb ); if(status != RTEMS_SUCCESSFUL) { printk("Error openning serial_mouse device\n"); return status; } /* * Pass data area info down to driver */ BSP_uart_termios_set( BSP_UART_PORT, ((rtems_libio_open_close_args_t *)arg)->iop->data1 ); /* Enable interrupts on channel */ BSP_uart_intr_ctrl( BSP_UART_PORT, BSP_UART_INTR_CTRL_TERMIOS); return RTEMS_SUCCESSFUL; }
static int console_first_open(int major, int minor, void *arg) { rtems_status_code status; /* must not open a minor device we have no ISR for */ assert( minor>=0 && minor < sizeof(ttyS)/sizeof(ttyS[0]) && ttyS[minor].isr ); /* 9600-8-N-1 */ BSP_uart_init(minor, 9600, 0); status = BSP_uart_install_isr(minor, ttyS[minor].isr); if (!status) { printk("Error installing serial console interrupt handler for '%s'!\n", ttyS[minor].name); rtems_fatal_error_occurred(status); } /* * Pass data area info down to driver */ BSP_uart_termios_set(minor, ((rtems_libio_open_close_args_t *)arg)->iop->data1); /* Enable interrupts on channel */ BSP_uart_intr_ctrl(minor, BSP_UART_INTR_CTRL_TERMIOS); return 0; }
/* * In order to have a possibility to break into * running program, one has to call this function */ void i386_stub_glue_init_breakin(void) { rtems_raw_irq_connect_data uart_raw_irq_data; assert(uart_current == BSP_UART_COM1 || uart_current == BSP_UART_COM2); if(uart_current == BSP_UART_COM1) { uart_raw_irq_data.idtIndex = BSP_UART_COM1_IRQ + BSP_IRQ_VECTOR_BASE; } else { uart_raw_irq_data.idtIndex = BSP_UART_COM2_IRQ + BSP_IRQ_VECTOR_BASE; } if(!i386_get_current_idt_entry(&uart_raw_irq_data)) { printk("cannot get idt entry\n"); rtems_fatal_error_occurred(1); } if(!i386_delete_idt_entry(&uart_raw_irq_data)) { printk("cannot delete idt entry\n"); rtems_fatal_error_occurred(1); } uart_raw_irq_data.on = BSP_uart_on; uart_raw_irq_data.off = BSP_uart_off; uart_raw_irq_data.isOn= BSP_uart_isOn; /* Install ISR */ if(uart_current == BSP_UART_COM1) { uart_raw_irq_data.idtIndex = BSP_UART_COM1_IRQ + BSP_IRQ_VECTOR_BASE; uart_raw_irq_data.hdl = BSP_uart_dbgisr_com1; } else { uart_raw_irq_data.idtIndex = BSP_UART_COM2_IRQ + BSP_IRQ_VECTOR_BASE; uart_raw_irq_data.hdl = BSP_uart_dbgisr_com2; } if (!i386_set_idt_entry (&uart_raw_irq_data)) { printk("raw exception handler connection failed\n"); rtems_fatal_error_occurred(1); } /* Enable interrupts */ BSP_uart_intr_ctrl(uart_current, BSP_UART_INTR_CTRL_GDB); return; }
/* * TTY2 device driver OPEN entry point */ rtems_device_driver tty2_open(rtems_device_major_number major, rtems_device_minor_number minor, void *arg) { rtems_status_code status; #ifndef USE_TASK_DRIVEN static rtems_termios_callbacks cb = { NULL, /* firstOpen */ tty2_last_close, /* lastClose */ NULL, /* poll read */ BSP_uart_termios_write_com2, /* write */ tty2_conSetAttr, /* setAttributes */ NULL, /* stopRemoteTx */ NULL, /* startRemoteTx */ TERMIOS_IRQ_DRIVEN /* outputUsesInterrupts */ }; #else static rtems_termios_callbacks cb = { NULL, /* firstOpen */ NULL, /* lastClose */ BSP_uart_termios_read_com2, /* poll read */ BSP_uart_termios_write_com2, /* write */ tty2_conSetAttr, /* setAttributes */ NULL, /* stopRemoteTx */ NULL, /* startRemoteTx */ TERMIOS_TASK_DRIVEN /* outputUsesInterrupts */ }; #endif status = rtems_termios_open (major, minor, arg, &cb); if(status != RTEMS_SUCCESSFUL) { printk("Error openning tty1 device\n"); return status; } /* * Pass data area info down to driver */ BSP_uart_termios_set( BSP_UART_COM2, ((rtems_libio_open_close_args_t *)arg)->iop->data1 ); /* Enable interrupts on channel */ BSP_uart_intr_ctrl( BSP_UART_COM2, BSP_UART_INTR_CTRL_TERMIOS); return RTEMS_SUCCESSFUL; }