source: rtems/c/src/lib/libbsp/m68k/mrm332/console/console.c @ 9bc5fd16

4.104.114.84.95
Last change on this file since 9bc5fd16 was 9bc5fd16, checked in by Joel Sherrill <joel.sherrill@…>, on 09/04/03 at 18:51:57

2003-09-04 Joel Sherrill <joel@…>

  • clock/ckinit.c, console/console.c, include/bsp.h, misc/interr.c, spurious/spinit.c, startup/bspclean.c, startup/bspstart.c, timer/timer.c: URL for license changed.
  • Property mode set to 100644
File size: 3.5 KB
Line 
1/*
2 *  This file contains the generic console driver shell used
3 *  by all console drivers using libchip.
4 *
5 *  This driver uses the termios pseudo driver.
6 *
7 *  COPYRIGHT (c) 1989-1997.
8 *  On-Line Applications Research Corporation (OAR).
9 *
10 *  The license and distribution terms for this file may be
11 *  found in the file LICENSE in this distribution or at
12 *  http://www.rtems.com/license/LICENSE.
13 *
14 *  $Id$
15 */
16
17#include <bsp.h>
18#include <rtems/libio.h>
19#include <termios.h>
20#include "sci.h"
21//#include "../../../../../../rtems/c/src/lib/libbsp/m68k/opti/console/duart.h"
22//#include "../../../../../../rtems/c/src/lib/libc/libio_.h"
23
24/*PAGE
25 *
26 *  console_open
27 *
28 *  open a port as a termios console.
29 *
30 *  the console is opened in bsp_postdriver_hook() in bsppost.c
31 *
32 */
33
34rtems_device_driver console_open(
35  rtems_device_major_number major,
36  rtems_device_minor_number minor,
37  void                    * arg
38)
39{
40    rtems_status_code status;
41
42    /* the console is opened three times at startup */
43    /* for standard input, output, and error */
44
45    /* Get correct callback structure for the device */
46
47    /* argument of FALSE gives us interrupt driven serial io */
48    /* argument of TRUE  gives us polling   based  serial io */
49
50    /* SCI internal uart */
51
52    status = rtems_termios_open( major, minor, arg, SciGetTermiosHandlers( TRUE ) );       
53
54    return status;
55}
56 
57/*PAGE
58 *
59 *  console_close
60 *
61 *  This routine closes a port that has been opened as console.
62 */
63
64rtems_device_driver console_close(
65  rtems_device_major_number major,
66  rtems_device_minor_number minor,
67  void                    * arg
68)
69{
70  return rtems_termios_close (arg);
71}
72 
73/*PAGE
74 *
75 *  console_read
76 *
77 *  This routine uses the termios driver to read a character.
78 */
79
80rtems_device_driver console_read(
81  rtems_device_major_number major,
82  rtems_device_minor_number minor,
83  void                    * arg
84)
85{
86  return rtems_termios_read (arg);
87}
88 
89/*PAGE
90 *
91 *  console_write
92 *
93 *  this routine uses the termios driver to write a character.
94 */
95
96rtems_device_driver console_write(
97  rtems_device_major_number major,
98  rtems_device_minor_number minor,
99  void                    * arg
100)
101{
102  return rtems_termios_write (arg);
103}
104 
105/*PAGE
106 *
107 *  console_control
108 *
109 *  this routine uses the termios driver to process io
110 */
111
112rtems_device_driver console_control(
113  rtems_device_major_number major,
114  rtems_device_minor_number minor,
115  void                    * arg
116)
117{
118  return rtems_termios_ioctl (arg);
119}
120
121/*PAGE
122 *
123 *  console_initialize
124 *
125 *  Routine called to initialize the console device driver.
126 */
127
128rtems_device_driver console_initialize(
129  rtems_device_major_number  major,
130  rtems_device_minor_number  minor_arg,
131  void                      *arg
132)
133{
134  rtems_status_code          status;
135
136  /*
137   * initialize the termio interface.
138   */
139  rtems_termios_initialize();
140
141
142  /*
143   * register the SCI device name for termios
144   * do this over in the sci driver init routine?
145   */
146
147  status = rtems_io_register_name( "/dev/sci", major, 0 );
148
149  if (status != RTEMS_SUCCESSFUL)
150  {
151    rtems_fatal_error_occurred(status);
152  }
153
154
155  /*
156   * Link the uart device to the console device
157   */
158
159#if 1
160  status = rtems_io_register_name( "/dev/console", major, 0 );
161
162  if (status != RTEMS_SUCCESSFUL)
163  {
164    rtems_fatal_error_occurred(status);
165  }
166#else
167  if ( link( "/dev/sci", "/dev/console") < 0 )
168  {
169    rtems_fatal_error_occurred( RTEMS_IO_ERROR );
170  }                               
171#endif
172
173  /*
174   * Console Initialize Succesful
175   */
176
177  return RTEMS_SUCCESSFUL;
178}
179
180
Note: See TracBrowser for help on using the repository browser.