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

4.104.114.84.95
Last change on this file since 7220103f was 7220103f, checked in by Joel Sherrill <joel.sherrill@…>, on 12/05/00 at 16:38:08

2000-12-01 Joel Sherrill <joel@…>

  • console-polled.c: Remove warnings.
  • Property mode set to 100644
File size: 2.9 KB
Line 
1/*
2 *  This file contains the hardware specific portions of the TTY driver
3 *  for the serial ports on the erc32.
4 *
5 *  COPYRIGHT (c) 1989-1997.
6 *  On-Line Applications Research Corporation (OAR).
7 *  Copyright assigned to U.S. Government, 1994.
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.OARcorp.com/rtems/license.html.
12 *
13 *  $Id$
14 */
15
16#include <bsp.h>
17#include <rtems/libio.h>
18#include <stdlib.h>
19#include <assert.h>
20
21/* external prototypes for monitor interface routines */
22
23void console_outbyte_polled(
24  int  port,
25  char ch
26);
27
28int console_inbyte_nonblocking(
29  int port
30);
31
32/*
33 *  Console Termios Support Entry Points
34 *
35 */
36
37int console_write_support (
38  int minor,
39  const char *bufarg,
40  int len
41)
42{
43  int nwrite = 0;
44  const char *buf = bufarg;
45
46  while (nwrite < len) {
47    console_outbyte_polled( minor, *buf++ );
48    nwrite++;
49  }
50  return nwrite;
51}
52
53/*
54 *  Console Device Driver Entry Points
55 *
56 */
57 
58rtems_device_driver console_initialize(
59  rtems_device_major_number  major,
60  rtems_device_minor_number  minor,
61  void                      *arg
62)
63{
64  rtems_status_code status;
65
66  rtems_termios_initialize();
67
68  /*
69   *  Register Device Names
70   */
71
72  status = rtems_io_register_name( "/dev/console", major, 0 );
73  if (status != RTEMS_SUCCESSFUL)
74    rtems_fatal_error_occurred(status);
75
76  return RTEMS_SUCCESSFUL;
77}
78
79rtems_device_driver console_open(
80  rtems_device_major_number major,
81  rtems_device_minor_number minor,
82  void                    * arg
83)
84{
85  rtems_status_code sc;
86  static const rtems_termios_callbacks pollCallbacks = {
87    NULL,                        /* firstOpen */
88    NULL,                        /* lastClose */
89    console_inbyte_nonblocking,  /* pollRead */
90    console_write_support,       /* write */
91    NULL,                        /* setAttributes */
92    NULL,                        /* stopRemoteTx */
93    NULL,                        /* startRemoteTx */
94    0                            /* outputUsesInterrupts */
95  };
96
97
98  assert( minor <= 1 );
99  if ( minor > 2 )
100    return RTEMS_INVALID_NUMBER;
101 
102  sc = rtems_termios_open (major, minor, arg, &pollCallbacks );
103
104  return RTEMS_SUCCESSFUL;
105}
106 
107rtems_device_driver console_close(
108  rtems_device_major_number major,
109  rtems_device_minor_number minor,
110  void                    * arg
111)
112{
113  return rtems_termios_close (arg);
114}
115 
116rtems_device_driver console_read(
117  rtems_device_major_number major,
118  rtems_device_minor_number minor,
119  void                    * arg
120)
121{
122  return rtems_termios_read (arg);
123}
124 
125rtems_device_driver console_write(
126  rtems_device_major_number major,
127  rtems_device_minor_number minor,
128  void                    * arg
129)
130{
131  return rtems_termios_write (arg);
132}
133 
134rtems_device_driver console_control(
135  rtems_device_major_number major,
136  rtems_device_minor_number minor,
137  void                    * arg
138)
139{
140  return rtems_termios_ioctl (arg);
141}
142
Note: See TracBrowser for help on using the repository browser.