Changeset 6fc2d389 in rtems for c/src/lib/libbsp/sh
- Timestamp:
- 10/20/14 16:31:25 (9 years ago)
- Branches:
- 4.11, 5, master
- Children:
- 82f5ec4
- Parents:
- e48bbaa
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/lib/libbsp/sh/shared/console.c
re48bbaa r6fc2d389 2 2 * /dev/console for Hitachi SH 703X 3 3 * 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 /* 12 9 * Author: Ralf Corsepius (corsepiu@faw.uni-ulm.de) 13 10 * … … 18 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 19 16 * 20 * 21 * COPYRIGHT (c) 1998. 17 * COPYRIGHT (c) 1998, 2014. 22 18 * On-Line Applications Research Corporation (OAR). 23 19 * … … 32 28 #include <rtems/iosupp.h> 33 29 30 #include <sys/stat.h> 31 34 32 #ifndef BSP_CONSOLE_DEVNAME 35 33 #error Missing BSP_CONSOLE_DEVNAME 36 34 #endif 37 35 38 static rtems_driver_name_t low_level_device_info;39 40 36 /* console_initialize 41 37 * 42 38 * This routine initializes the console IO driver. 43 *44 * Input parameters: NONE45 *46 * Output parameters: NONE47 *48 * Return values:49 39 */ 50 51 40 rtems_device_driver console_initialize( 52 41 rtems_device_major_number major, … … 56 45 { 57 46 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); 58 53 59 54 status = rtems_io_register_name( 60 55 "/dev/console", 61 major,62 (rtems_device_minor_number) 056 rtems_filesystem_dev_major_t( st.st_rdev ), 57 rtems_filesystem_dev_minor_t( st.st_rdev ) 63 58 ); 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 );69 59 if (status != RTEMS_SUCCESSFUL) 70 60 rtems_fatal_error_occurred(status); … … 76 66 * Open entry point 77 67 */ 78 79 68 rtems_device_driver console_open( 80 69 rtems_device_major_number major, … … 83 72 ) 84 73 { 85 return rtems_io_open( low_level_device_info.major, 86 low_level_device_info.minor, 87 arg ); 74 rtems_fatal_error_occurred(-1); 88 75 } 89 76 … … 91 78 * Close entry point 92 79 */ 93 94 80 rtems_device_driver console_close( 95 81 rtems_device_major_number major, … … 98 84 ) 99 85 { 100 return rtems_io_close( low_level_device_info.major, 101 low_level_device_info.minor, 102 arg ); 86 rtems_fatal_error_occurred(-1); 103 87 } 104 88 … … 106 90 * read bytes from the serial port. We only have stdin. 107 91 */ 108 109 92 rtems_device_driver console_read( 110 93 rtems_device_major_number major, … … 113 96 ) 114 97 { 115 return rtems_io_read( low_level_device_info.major, 116 low_level_device_info.minor, 117 arg ); 98 rtems_fatal_error_occurred(-1); 118 99 } 119 100 … … 121 102 * write bytes to the serial port. Stdout and stderr are the same. 122 103 */ 123 124 104 rtems_device_driver console_write( 125 105 rtems_device_major_number major, … … 128 108 ) 129 109 { 130 return rtems_io_write( low_level_device_info.major, 131 low_level_device_info.minor, 132 arg ); 110 rtems_fatal_error_occurred(-1); 133 111 } 134 112 … … 136 114 * IO Control entry point 137 115 */ 138 139 116 rtems_device_driver console_control( 140 117 rtems_device_major_number major, … … 143 120 ) 144 121 { 145 return rtems_io_control( low_level_device_info.major, 146 low_level_device_info.minor, 147 arg ); 122 rtems_fatal_error_occurred(-1); 148 123 }
Note: See TracChangeset
for help on using the changeset viewer.