source: rtems/bsps/m68k/mrm332/console/console.c @ d7d66d7

5
Last change on this file since d7d66d7 was d7d66d7, checked in by Sebastian Huber <sebastian.huber@…>, on 04/19/18 at 04:28:01

bsps: Move console drivers to bsps

This patch is a part of the BSP source reorganization.

Update #3285.

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