rtems_device_driver console_initialize( rtems_device_major_number major, rtems_device_minor_number minor, void *arg ) { rtems_status_code status; rtems_termios_initialize(); /* * Register Device Names */ status = rtems_io_register_name( "/dev/console", major, 0 ); if (status != RTEMS_SUCCESSFUL) rtems_fatal_error_occurred(status); status = rtems_io_register_name( "/dev/console_b", major, 1 ); if (status != RTEMS_SUCCESSFUL) rtems_fatal_error_occurred(status); /* * Initialize Hardware */ LEON_REG.UART_Control_1 |= LEON_REG_UART_CTRL_RE | LEON_REG_UART_CTRL_TE; LEON_REG.UART_Control_2 |= LEON_REG_UART_CTRL_RE | LEON_REG_UART_CTRL_TE | LEON_REG_UART_CTRL_RI; /* rx irq default enable for remote debugger */ LEON_REG.UART_Status_1 = 0; LEON_REG.UART_Status_2 = 0; #if (CONSOLE_USE_INTERRUPTS) console_initialize_interrupts(); #endif return RTEMS_SUCCESSFUL; }
/* PAGE * * console_initialize * * Routine called to initialize the console device driver. */ rtems_device_driver console_initialize( rtems_device_major_number major, rtems_device_minor_number minor, void *arg ) { rtems_status_code status; rtems_device_minor_number console; int port, chip, p0,p1; /* * initialize the termio interface. */ rtems_termios_initialize(); /* * Register Device Names */ console = USE_FOR_CONSOLE; status = rtems_io_register_name( "/dev/console", major, console ); if (status != RTEMS_SUCCESSFUL) rtems_fatal_error_occurred(status); /* * Initialize Hardware */ /* * INITIALIZE_COM_PORTS is defined in the linker script. If it is * true all serial chips on the board are to be reset at startup * otherwise the reset is assumed to occur elsewhere (ie. in the * debugger...) */ #if ( INITIALIZE_COM_PORTS ) /* * Force to perform a hardware reset w/o * Master interrupt enable via register 9 */ for (port=0; port<NUM_Z85C30_PORTS; port++){ p0 = port; port++; p1 = port; Reset_85c30_chip( Ports_85C30[p0].ctrl, Ports_85C30[p1].ctrl ); } #else /* TEMP - To see if this makes a diff with the new ports. * Never reset chip 1 when using the chip as a monitor */ for (port=2; port<NUM_Z85C30_PORTS; port++){ p0 = port; port++; p1 = port; Reset_85c30_chip( Ports_85C30[p0].ctrl, Ports_85C30[p1].ctrl ); } #endif /* * Initialize each port. * Note: the ports are numbered such that 0,1 are on the first chip * 2,3 are on the second .... */ for (port=1; port<NUM_Z85C30_PORTS; port++) { chip = port >> 1; initialize_85c30_port( &Ports_85C30[port] ); } #if CONSOLE_USE_INTERRUPTS console_initialize_interrupts(); #endif return RTEMS_SUCCESSFUL; }