Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:02

0001 /*
0002  * /dev/console for Hitachi SH 703X
0003  *
0004  * This driver installs an alternate device name (e.g. /dev/console for
0005  * the designated console device /dev/console.
0006  */
0007 
0008 /*
0009  *  Author: Ralf Corsepius (corsepiu@faw.uni-ulm.de)
0010  *
0011  *  COPYRIGHT (c) 1997-1998, FAW Ulm, Germany
0012  *
0013  *  This program is distributed in the hope that it will be useful,
0014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
0016  *
0017  *  COPYRIGHT (c) 1998, 2014.
0018  *  On-Line Applications Research Corporation (OAR).
0019  *
0020  *  The license and distribution terms for this file may be
0021  *  found in the file LICENSE in this distribution or at
0022  *  http://www.rtems.org/license/LICENSE.
0023  */
0024 
0025 #include <bsp.h>
0026 #include <rtems.h>
0027 #include <rtems/libio.h>
0028 #include <rtems/console.h>
0029 
0030 #include <sys/stat.h>
0031 
0032 #ifndef BSP_CONSOLE_DEVNAME
0033 #error Missing BSP_CONSOLE_DEVNAME
0034 #endif
0035 
0036 /*  console_initialize
0037  *
0038  *  This routine initializes the console IO driver.
0039  */
0040 rtems_device_driver console_initialize(
0041   rtems_device_major_number  major,
0042   rtems_device_minor_number  minor,
0043   void                      *arg
0044 )
0045 {
0046   rtems_device_driver status;
0047   struct stat         st;
0048   int                 rv;
0049 
0050   rv = stat( BSP_CONSOLE_DEVNAME, &st );
0051   if ( rv != 0 )
0052     rtems_fatal_error_occurred(rv);
0053 
0054   status = rtems_io_register_name(
0055     "/dev/console",
0056     rtems_filesystem_dev_major_t( st.st_rdev ),
0057     rtems_filesystem_dev_minor_t( st.st_rdev )
0058   );
0059   if (status != RTEMS_SUCCESSFUL)
0060     rtems_fatal_error_occurred(status);
0061 
0062   return RTEMS_SUCCESSFUL;
0063 }
0064 
0065 /*
0066  *  Open entry point
0067  */
0068 rtems_device_driver console_open(
0069   rtems_device_major_number major,
0070   rtems_device_minor_number minor,
0071   void                    * arg
0072 )
0073 {
0074   rtems_fatal_error_occurred(-1);
0075 }
0076 
0077 /*
0078  *  Close entry point
0079  */
0080 rtems_device_driver console_close(
0081   rtems_device_major_number major,
0082   rtems_device_minor_number minor,
0083   void                    * arg
0084 )
0085 {
0086   rtems_fatal_error_occurred(-1);
0087 }
0088 
0089 /*
0090  * read bytes from the serial port. We only have stdin.
0091  */
0092 rtems_device_driver console_read(
0093   rtems_device_major_number major,
0094   rtems_device_minor_number minor,
0095   void                    * arg
0096 )
0097 {
0098   rtems_fatal_error_occurred(-1);
0099 }
0100 
0101 /*
0102  * write bytes to the serial port. Stdout and stderr are the same.
0103  */
0104 rtems_device_driver console_write(
0105   rtems_device_major_number major,
0106   rtems_device_minor_number minor,
0107   void                    * arg
0108 )
0109 {
0110   rtems_fatal_error_occurred(-1);
0111 }
0112 
0113 /*
0114  *  IO Control entry point
0115  */
0116 rtems_device_driver console_control(
0117   rtems_device_major_number major,
0118   rtems_device_minor_number minor,
0119   void                    * arg
0120 )
0121 {
0122   rtems_fatal_error_occurred(-1);
0123 }