source: rtems/c/src/lib/libbsp/shared/console-polled.c @ 6273201

4.115
Last change on this file since 6273201 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 3.1 KB
Line 
1/*
2 *  This file contains the hardware independent portion of a polled
3 *  console device driver.  If a BSP chooses to use this, then it
4 *  only has to provide a few board dependent routines.
5 *
6 *  COPYRIGHT (c) 1989-1997.
7 *  On-Line Applications Research Corporation (OAR).
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.rtems.com/license/LICENSE.
12 */
13
14#include <bsp.h>
15#include <rtems/libio.h>
16#include <stdlib.h>
17#include <assert.h>
18
19/* external prototypes for monitor interface routines */
20
21void console_outbyte_polled(
22  int  port,
23  char ch
24);
25
26int console_inbyte_nonblocking(
27  int port
28);
29
30void console_initialize_hardware(void);
31
32/*
33 *  Console Termios Support Entry Points
34 *
35 */
36ssize_t console_write_support (
37  int         minor,
38  const char *bufarg,
39  size_t      len
40)
41{
42  int nwrite = 0;
43  const char *buf = bufarg;
44
45  while (nwrite < len) {
46    console_outbyte_polled( minor, *buf++ );
47    nwrite++;
48  }
49  return nwrite;
50}
51
52/*
53 *  Console Device Driver Entry Points
54 *
55 */
56
57rtems_device_driver console_initialize(
58  rtems_device_major_number  major,
59  rtems_device_minor_number  minor,
60  void                      *arg
61)
62{
63  rtems_status_code status;
64
65  /*
66   *  Ensure Termios is initialized
67   */
68  rtems_termios_initialize();
69
70  /*
71   *  Make sure the hardware is initialized.
72   */
73  console_initialize_hardware();
74
75  /*
76   *  Register Device Names
77   */
78  status = rtems_io_register_name( "/dev/console", major, 0 );
79  if (status != RTEMS_SUCCESSFUL)
80    rtems_fatal_error_occurred(status);
81
82  return RTEMS_SUCCESSFUL;
83}
84
85rtems_device_driver console_open(
86  rtems_device_major_number major,
87  rtems_device_minor_number minor,
88  void                    * arg
89)
90{
91  rtems_status_code sc;
92  static const rtems_termios_callbacks pollCallbacks = {
93    NULL,                        /* firstOpen */
94    NULL,                        /* lastClose */
95    console_inbyte_nonblocking,  /* pollRead */
96    console_write_support,       /* write */
97    NULL,                        /* setAttributes */
98    NULL,                        /* stopRemoteTx */
99    NULL,                        /* startRemoteTx */
100    0                            /* outputUsesInterrupts */
101  };
102
103  assert( minor <= 1 );
104  if ( minor > 1 )
105    return RTEMS_INVALID_NUMBER;
106
107  sc = rtems_termios_open( major, minor, arg, &pollCallbacks );
108
109  return RTEMS_SUCCESSFUL;
110}
111
112rtems_device_driver console_close(
113  rtems_device_major_number major,
114  rtems_device_minor_number minor,
115  void                    * arg
116)
117{
118  return rtems_termios_close( arg );
119}
120
121rtems_device_driver console_read(
122  rtems_device_major_number major,
123  rtems_device_minor_number minor,
124  void                    * arg
125)
126{
127  return rtems_termios_read( arg );
128}
129
130rtems_device_driver console_write(
131  rtems_device_major_number major,
132  rtems_device_minor_number minor,
133  void                    * arg
134)
135{
136  return rtems_termios_write( arg );
137}
138
139rtems_device_driver console_control(
140  rtems_device_major_number major,
141  rtems_device_minor_number minor,
142  void                    * arg
143)
144{
145  return rtems_termios_ioctl( arg );
146}
Note: See TracBrowser for help on using the repository browser.