source: rtems/c/src/lib/libbsp/m68k/mrm332/console/console.c @ 89aa1ec8

4.115
Last change on this file since 89aa1ec8 was 89aa1ec8, checked in by James Fitzsimons <james.fitzsimons@…>, on 03/24/14 at 09:32:10

m68k/mrm332: changes required to get the mrm332 bsp working again.

Changed console driver to use interrupts instead of polling.
Change to avoid overwriting CPU32Bug interrupt vector when setting up the Sci interrupt handler.
Fixed type for boolean flag in bsp.h.
Changed mrm332.h to use 25Mhz clock.
Fixes to mrm332.cfg to use correct mcpu32 value for RTEMS_CPU_MODEL instead of m68332 which is no longer supported.
Added -mcpu=cpu32 to compiler options.
Removed broken ROM linker script and replaced broken RAM linker script with working ROM linker script.
Removed no longer required file except_vect_332_ROM.S.
Enabled 0xbeefbeef magic string in start.S to allow MRM version of CPU32Bug to auto run RTEMS.
Removed old code from start.S
Changed compiler optimization flag to optimize for size.

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