Changeset 6fc2d389 in rtems for c/src/lib/libbsp/sh


Ignore:
Timestamp:
10/20/14 16:31:25 (9 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.11, 5, master
Children:
82f5ec4
Parents:
e48bbaa
Message:

libbsp/sh/shared/console.c: Eliminate use of obsolete method

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/sh/shared/console.c

    re48bbaa r6fc2d389  
    22 * /dev/console for Hitachi SH 703X
    33 *
    4  * The SH doesn't have a designated console device. Therefore we "alias"
    5  * another device as /dev/console and revector all calls to /dev/console
    6  * to this device.
    7  *
    8  * This approach is similar to installing a sym-link from one device to
    9  * another device. If rtems once will support sym-links for devices files,
    10  * this implementation could be dropped.
    11  *
     4 * This driver installs an alternate device name (e.g. /dev/console for
     5 * the designated console device /dev/console.
     6 */
     7
     8/*
    129 *  Author: Ralf Corsepius (corsepiu@faw.uni-ulm.de)
    1310 *
     
    1815 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    1916 *
    20  *
    21  *  COPYRIGHT (c) 1998.
     17 *  COPYRIGHT (c) 1998, 2014.
    2218 *  On-Line Applications Research Corporation (OAR).
    2319 *
     
    3228#include <rtems/iosupp.h>
    3329
     30#include <sys/stat.h>
     31
    3432#ifndef BSP_CONSOLE_DEVNAME
    3533#error Missing BSP_CONSOLE_DEVNAME
    3634#endif
    3735
    38 static rtems_driver_name_t low_level_device_info;
    39 
    4036/*  console_initialize
    4137 *
    4238 *  This routine initializes the console IO driver.
    43  *
    44  *  Input parameters: NONE
    45  *
    46  *  Output parameters:  NONE
    47  *
    48  *  Return values:
    4939 */
    50 
    5140rtems_device_driver console_initialize(
    5241  rtems_device_major_number  major,
     
    5645{
    5746  rtems_device_driver status;
     47  struct stat         st;
     48  int                 rv;
     49
     50  rv = stat( BSP_CONSOLE_DEVNAME, &st );
     51  if ( rv != 0 )
     52    rtems_fatal_error_occurred(rv);
    5853
    5954  status = rtems_io_register_name(
    6055    "/dev/console",
    61     major,
    62     (rtems_device_minor_number) 0
     56    rtems_filesystem_dev_major_t( st.st_rdev ),
     57    rtems_filesystem_dev_minor_t( st.st_rdev )
    6358  );
    64 
    65   if (status != RTEMS_SUCCESSFUL)
    66     rtems_fatal_error_occurred(status);
    67 
    68   status = rtems_io_lookup_name( BSP_CONSOLE_DEVNAME, &low_level_device_info );
    6959  if (status != RTEMS_SUCCESSFUL)
    7060    rtems_fatal_error_occurred(status);
     
    7666 *  Open entry point
    7767 */
    78 
    7968rtems_device_driver console_open(
    8069  rtems_device_major_number major,
     
    8372)
    8473{
    85   return rtems_io_open( low_level_device_info.major,
    86     low_level_device_info.minor,
    87     arg );
     74  rtems_fatal_error_occurred(-1);
    8875}
    8976
     
    9178 *  Close entry point
    9279 */
    93 
    9480rtems_device_driver console_close(
    9581  rtems_device_major_number major,
     
    9884)
    9985{
    100   return rtems_io_close( low_level_device_info.major,
    101     low_level_device_info.minor,
    102     arg );
     86  rtems_fatal_error_occurred(-1);
    10387}
    10488
     
    10690 * read bytes from the serial port. We only have stdin.
    10791 */
    108 
    10992rtems_device_driver console_read(
    11093  rtems_device_major_number major,
     
    11396)
    11497{
    115   return rtems_io_read( low_level_device_info.major,
    116     low_level_device_info.minor,
    117     arg );
     98  rtems_fatal_error_occurred(-1);
    11899}
    119100
     
    121102 * write bytes to the serial port. Stdout and stderr are the same.
    122103 */
    123 
    124104rtems_device_driver console_write(
    125105  rtems_device_major_number major,
     
    128108)
    129109{
    130   return rtems_io_write( low_level_device_info.major,
    131     low_level_device_info.minor,
    132     arg );
     110  rtems_fatal_error_occurred(-1);
    133111}
    134112
     
    136114 *  IO Control entry point
    137115 */
    138 
    139116rtems_device_driver console_control(
    140117  rtems_device_major_number major,
     
    143120)
    144121{
    145   return rtems_io_control( low_level_device_info.major,
    146     low_level_device_info.minor,
    147     arg );
     122  rtems_fatal_error_occurred(-1);
    148123}
Note: See TracChangeset for help on using the changeset viewer.