コード例 #1
0
ファイル: uart.c プロジェクト: 0871087123/rtems
/*
 * Set baud
 */
void
BSP_uart_set_baud(int uart, int baud)
{
  unsigned char  ier;

  /* Sanity check */
  assert(uart == BSP_UART_COM1 || uart == BSP_UART_COM2);

  /*
   * This function may be called whenever TERMIOS parameters
   * are changed, so we have to make sure that baud change is
   * indeed required
   */

  if(baud == uart_data[uart].baud)
    {
      return;
    }

  ier = uread(uart, IER);

  BSP_uart_init(uart, baud, uart_data[uart].hwFlow);

  uwrite(uart, IER, ier);

  return;
}
コード例 #2
0
ファイル: console.c プロジェクト: Dipupo/rtems
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;
}
コード例 #3
0
/*-------------------------------------------------------------------------+
| Console device driver INITIALIZE entry point.
+--------------------------------------------------------------------------+
| Initilizes the I/O console (keyboard + VGA display) driver.
+--------------------------------------------------------------------------*/
rtems_device_driver
console_initialize(rtems_device_major_number major,
                   rtems_device_minor_number minor,
                   void                      *arg)
{
  rtems_status_code status;

  /*
   * Set up TERMIOS
   */
  rtems_termios_initialize ();

  /*
   * Do device-specific initialization
   */

  /* 115200-8-N-1, without hardware flow control */
  BSP_uart_init(BSPConsolePort, 115200, CHR_8_BITS, 0, 0, 0);

  /* Set interrupt handler */
  if(BSPConsolePort == BSP_UART_COM1)
    {
      console_isr_data.name = BSP_UART_COM1_IRQ;
      console_isr_data.hdl  = BSP_uart_termios_isr_com1;

    }
  else
    {
      assert(BSPConsolePort == BSP_UART_COM2);
      console_isr_data.name = BSP_UART_COM2_IRQ;
      console_isr_data.hdl  = BSP_uart_termios_isr_com2;
    }

  status = BSP_install_rtems_irq_handler(&console_isr_data);

  if (!status){
    printk("Error installing serial console interrupt handler!\n");
    rtems_fatal_error_occurred(status);
  }
  /*
   * Register the device
   */
  status = rtems_io_register_name ("/dev/console", major, 0);
  if (status != RTEMS_SUCCESSFUL)
    {
      printk("Error registering console device!\n");
      rtems_fatal_error_occurred (status);
    }

  if(BSPConsolePort == BSP_UART_COM1)
    {
      printk("Initialized console on port COM1 115200-8-N-1\n\n");
    }
  else
    {
      printk("Initialized console on port COM2 115200-8-N-1\n\n");
    }

  return RTEMS_SUCCESSFUL;
} /* console_initialize */
コード例 #4
0
/*
 * Initialize glue code linking i386-stub with the rest of
 * the system
 */
void
i386_stub_glue_init(int uart)
{
  assert(uart == BSP_UART_COM1 || uart == BSP_UART_COM2);

  uart_current = uart;

  /* BSP_uart_init(uart, 38400, CHR_8_BITS, 0, 0, 0);*/
  BSP_uart_init(uart, 115200, CHR_8_BITS, 0, 0, 0);
}
コード例 #5
0
/*
 *  Serial Mouse - device driver INITIALIZE entry point.
 */
rtems_device_driver
serial_mouse_initialize(rtems_device_major_number major,
                   rtems_device_minor_number minor,
                   void                      *arg)
{
  rtems_status_code status;

  /* Check if this port is not been used as console */
  if( BSPConsolePort == BSP_UART_PORT )
  {
    status = -1;
    printk("SERIAL MOUSE: port selected as console.( %d )\n", BSP_UART_PORT  );
    rtems_fatal_error_occurred( status );
  }

  /*
   * Set up TERMIOS
   */
  rtems_termios_initialize();

  /*
   * Do device-specific initialization
   */
  /* 9600-8-N-1, without hardware flow control */
  BSP_uart_init( BSP_UART_PORT, 1200, CHR_8_BITS, 0, 0, 0 );
  status = BSP_install_rtems_irq_handler( &serial_mouse_isr_data );
  if( !status )
  {
    printk("Error installing serial mouse interrupt handler!\n");
    rtems_fatal_error_occurred(status);
  }
  /*
   * Register the device
   */
  status = rtems_io_register_name ("/dev/mouse", major, 0);
  if (status != RTEMS_SUCCESSFUL)
  {
      printk("Error registering /dev/mouse device!\n");
      rtems_fatal_error_occurred (status);
  }
  printk("Device: /dev/mouse on COM%d -- ok \n", BSP_UART_PORT );
  return RTEMS_SUCCESSFUL;
} /* tty_initialize */
コード例 #6
0
ファイル: uart.c プロジェクト: RTEMS/rtems
void
BSP_uart_set_attributes
(
  int uart,
  unsigned long baud,
  unsigned long databits,
  unsigned long parity,
  unsigned long stopbits
)
{
  unsigned char mcr, ier;

  /* Sanity check */
  assert(uart == BSP_UART_COM1 || uart == BSP_UART_COM2);

  /*
   * This function may be called whenever TERMIOS parameters
   * are changed, so we have to make sure that baud change is
   * indeed required
   */

  if( (baud     == uart_data[uart].baud)     &&
      (databits == uart_data[uart].databits) &&
      (parity   == uart_data[uart].parity)   &&
      (stopbits == uart_data[uart].stopbits) )
    {
      return;
    }

  mcr = uread(uart, MCR);
  ier = uread(uart, IER);

  BSP_uart_init(uart, baud, databits, parity, stopbits, uart_data[uart].hwFlow);

  uwrite(uart, MCR, mcr);
  uwrite(uart, IER, ier);

  return;
}
コード例 #7
0
ファイル: bspstart.c プロジェクト: 0871087123/rtems
void bsp_start(void)
{
  /* Setup console baud rate */
  BSP_uart_init(UART_BAUD_RATE);
}