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

4.104.115
Last change on this file since b1ded240 was f05b2ac, checked in by Ralf Corsepius <ralf.corsepius@…>, on Apr 21, 2004 at 4:01:48 PM

Remove duplicate white lines.

  • 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 *  Open entry point
79 */
80
81rtems_device_driver console_open(
82  rtems_device_major_number major,
83  rtems_device_minor_number minor,
84  void                    * arg
85)
86{
87  return rtems_io_open( low_level_device_info.major,
88    low_level_device_info.minor,
89    arg );
90}
91
92/*
93 *  Close entry point
94 */
95
96rtems_device_driver console_close(
97  rtems_device_major_number major,
98  rtems_device_minor_number minor,
99  void                    * arg
100)
101{
102  return rtems_io_close( low_level_device_info.major,
103    low_level_device_info.minor,
104    arg );
105}
106
107/*
108 * read bytes from the serial port. We only have stdin.
109 */
110
111rtems_device_driver console_read(
112  rtems_device_major_number major,
113  rtems_device_minor_number minor,
114  void                    * arg
115)
116{
117  return rtems_io_read( low_level_device_info.major,
118    low_level_device_info.minor,
119    arg );
120}
121
122/*
123 * write bytes to the serial port. Stdout and stderr are the same.
124 */
125
126rtems_device_driver console_write(
127  rtems_device_major_number major,
128  rtems_device_minor_number minor,
129  void                    * arg
130)
131{
132  return rtems_io_write( low_level_device_info.major,
133    low_level_device_info.minor,
134    arg );
135}
136
137/*
138 *  IO Control entry point
139 */
140
141rtems_device_driver console_control(
142  rtems_device_major_number major,
143  rtems_device_minor_number minor,
144  void                    * arg
145)
146{
147  return rtems_io_control( low_level_device_info.major,
148    low_level_device_info.minor,
149    arg );
150}
Note: See TracBrowser for help on using the repository browser.