source: rtems/c/src/lib/libbsp/sh/shared/console.c @ 0fdc099

4.104.114.84.95
Last change on this file since 0fdc099 was 0fdc099, checked in by Ralf Corsepius <ralf.corsepius@…>, on 04/16/04 at 21:51:30

Remove stray white spaces.

  • Property mode set to 100644
File size: 3.2 KB
Line 
1/*
2 * /dev/console for Hitachi SH 703X
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 *
12 *  Author: Ralf Corsepius (corsepiu@faw.uni-ulm.de)
13 *
14 *  COPYRIGHT (c) 1997-1998, FAW Ulm, Germany
15 *
16 *  This program is distributed in the hope that it will be useful,
17 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 *
20 *
21 *  COPYRIGHT (c) 1998.
22 *  On-Line Applications Research Corporation (OAR).
23 *
24 *  The license and distribution terms for this file may be
25 *  found in the file LICENSE in this distribution or at
26 *  http://www.rtems.com/license/LICENSE.
27 *
28 *  $Id$
29 */
30
31#include <bsp.h>
32#include <rtems.h>
33#include <rtems/libio.h>
34#include <rtems/iosupp.h>
35
36#ifndef BSP_CONSOLE_DEVNAME
37#error Missing BSP_CONSOLE_DEVNAME
38#endif
39
40static rtems_driver_name_t low_level_device_info;
41
42/*  console_initialize
43 *
44 *  This routine initializes the console IO driver.
45 *
46 *  Input parameters: NONE
47 *
48 *  Output parameters:  NONE
49 *
50 *  Return values:
51 */
52
53rtems_device_driver console_initialize(
54  rtems_device_major_number  major,
55  rtems_device_minor_number  minor,
56  void                      *arg
57)
58{
59  rtems_device_driver status;
60
61  status = rtems_io_register_name(
62    "/dev/console",
63    major,
64    (rtems_device_minor_number) 0
65  );
66
67  if (status != RTEMS_SUCCESSFUL)
68    rtems_fatal_error_occurred(status);
69
70  status = rtems_io_lookup_name( BSP_CONSOLE_DEVNAME, &low_level_device_info );
71  if (status != RTEMS_SUCCESSFUL)
72    rtems_fatal_error_occurred(status);
73
74  return RTEMS_SUCCESSFUL;
75}
76
77
78/*
79 *  Open entry point
80 */
81
82rtems_device_driver console_open(
83  rtems_device_major_number major,
84  rtems_device_minor_number minor,
85  void                    * arg
86)
87{
88  return rtems_io_open( low_level_device_info.major,
89    low_level_device_info.minor,
90    arg );
91}
92
93/*
94 *  Close entry point
95 */
96
97rtems_device_driver console_close(
98  rtems_device_major_number major,
99  rtems_device_minor_number minor,
100  void                    * arg
101)
102{
103  return rtems_io_close( low_level_device_info.major,
104    low_level_device_info.minor,
105    arg );
106}
107
108/*
109 * read bytes from the serial port. We only have stdin.
110 */
111
112rtems_device_driver console_read(
113  rtems_device_major_number major,
114  rtems_device_minor_number minor,
115  void                    * arg
116)
117{
118  return rtems_io_read( low_level_device_info.major,
119    low_level_device_info.minor,
120    arg );
121}
122
123/*
124 * write bytes to the serial port. Stdout and stderr are the same.
125 */
126
127rtems_device_driver console_write(
128  rtems_device_major_number major,
129  rtems_device_minor_number minor,
130  void                    * arg
131)
132{
133  return rtems_io_write( low_level_device_info.major,
134    low_level_device_info.minor,
135    arg );
136}
137
138/*
139 *  IO Control entry point
140 */
141
142rtems_device_driver console_control(
143  rtems_device_major_number major,
144  rtems_device_minor_number minor,
145  void                    * arg
146)
147{
148  return rtems_io_control( low_level_device_info.major,
149    low_level_device_info.minor,
150    arg );
151}
Note: See TracBrowser for help on using the repository browser.