source: rtems/c/src/lib/libchip/serial/serial.h @ 009c235

4.104.114.84.95
Last change on this file since 009c235 was 009c235, checked in by Joel Sherrill <joel.sherrill@…>, on Jul 28, 1998 at 9:18:17 PM

Corrected spacing.

  • Property mode set to 100644
File size: 5.3 KB
Line 
1/*
2 *  This file contains the TTY driver table definition
3 *
4 *  This driver uses the termios pseudo driver.
5 *
6 *  COPYRIGHT (c) 1989-1998.
7 *  On-Line Applications Research Corporation (OAR).
8 *  Copyright assigned to U.S. Government, 1994.
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.OARcorp.com/rtems/license.html.
13 *
14 *  $Id$
15 */
16
17#ifndef __LIBCHIP_SERIAL_h
18#define __LIBCHIP_SERIAL_h
19
20#include <termios.h>
21
22/*
23 *  Types for get and set register routines
24 */
25
26typedef unsigned8 (*getRegister_f)(unsigned32 port, unsigned8 register);
27typedef void      (*setRegister_f)(
28                            unsigned32 port, unsigned8 reg, unsigned8 value);
29typedef unsigned8 (*getData_f)(unsigned32 port);
30typedef void      (*setData_f)(unsigned32 port, unsigned8 value);
31
32typedef struct _console_fns {
33  boolean (*deviceProbe)(int minor);
34  int     (*deviceFirstOpen)(int major, int minor, void *arg);
35  int     (*deviceLastClose)(int major, int minor, void *arg);
36  int     (*deviceRead)(int minor);
37  int     (*deviceWrite)(int minor, const char *buf, int len);
38  void    (*deviceInitialize)(int minor);
39  void    (*deviceWritePolled)(int minor, char cChar);
40  int     (*deviceSetAttributes)(int minor, const struct termios *t);
41  int       deviceOutputUsesInterrupts;
42} console_fns;
43
44typedef struct _console_flow {
45  int (*deviceStopRemoteTx)(int minor);
46  int (*deviceStartRemoteTx)(int minor);
47} console_flow;
48
49typedef enum {
50  SERIAL_MC68681,              /* Motorola MC68681 or Exar 88681 */
51  SERIAL_NS16550,              /* National Semiconductor NS16550 */
52  SERIAL_Z85C30,               /* Zilog Z85C30 */
53  SERIAL_CUSTOM                /* BSP specific driver */
54} console_devs;
55
56/*
57 * Each field is interpreted thus:
58 *
59 * sDeviceName  This is the name of the device.
60 *
61 * deviceType   This indicates the chip type.  It is especially important when
62 *              multiple devices share the same interrupt vector and must be
63 *              distinguished.
64 *
65 * pDeviceFns   This is a pointer to the set of driver routines to use.
66 *
67 * pDeviceFlow  This is a pointer to the set of flow control routines to
68 *              use. Serial device drivers will typically supply RTSCTS
69 *              and DTRCTS handshake routines for DCE to DCE communication,
70 *              however for DCE to DTE communication, no such routines
71 *              should be necessary as RTS will be driven automatically
72 *              when the transmitter is active.
73 *
74 * ulMargin     The high water mark in the input buffer is set to the buffer
75 *              size less ulMargin. Once this level is reached, the driver's
76 *              flow control routine used to stop the remote transmitter will
77 *              be called. This figure should be greater than or equal to
78 *              the number of stages of FIFO between the transmitter and
79 *              receiver.
80 *
81 *              NOTE: At the current time, this parameter is hard coded
82 *                    in termios and this number is ignored.
83 *
84 * ulHysteresis After the high water mark specified by ulMargin has been
85 *              reached, the driver's routine to re-start the remote
86 *              transmitter will be called once the level in the input
87 *              buffer has fallen by ulHysteresis bytes.
88 *
89 *              NOTE: At the current time, this parameter is hard coded
90 *                    in termios and this number is ignored.
91 *
92 * pDeviceParams This contains either device specific data or a pointer to a
93 *              device specific structure containing additional information
94 *              not provided in this table.
95 *
96 * ulCtrlPort1  This is the primary control port number for the device. This
97 *              may be used to specify different instances of the same device
98 *              type.
99 *
100 * ulCtrlPort2  This is the secondary control port number, of use when a given
101 *              device has more than one available channel.
102 *
103 * ulDataPort   This is the port number for the data port of the device
104 *
105 * getRegister  This is the routine used to read register values.
106 *
107 * setRegister  This is the routine used to write register values.
108 *
109 * getData      This is the routine used to read the data register (RX).
110 *
111 * setData      This is the routine used to write the data register (TX).
112 *
113 * ulClock      This is the baud rate clock speed.
114 *
115 * ulIntVector  This encodes the interrupt vector of the device.
116 */
117
118typedef struct _console_tbl {
119  char          *sDeviceName;
120  console_devs   deviceType;
121  console_fns   *pDeviceFns;
122  boolean      (*deviceProbe)(int minor);
123  console_flow  *pDeviceFlow;
124  unsigned32     ulMargin;
125  unsigned32     ulHysteresis;
126  void          *pDeviceParams;
127  unsigned32     ulCtrlPort1;
128  unsigned32     ulCtrlPort2;
129  unsigned32     ulDataPort;
130  getRegister_f  getRegister;
131  setRegister_f  setRegister;
132  getData_f      getData;
133  setData_f      setData;
134  unsigned32     ulClock;
135  unsigned int   ulIntVector;
136} console_tbl;
137
138typedef struct _console_data {
139  void                   *termios_data;
140  volatile boolean        bActive;
141  /*
142   * This field may be used for any purpose required by the driver
143   */
144  void                   *pDeviceContext;
145} console_data;
146
147extern console_tbl  Console_Port_Tbl[];
148extern console_data Console_Port_Data[];
149extern unsigned long  Console_Port_Count;
150
151#endif
152/* end of include file */
Note: See TracBrowser for help on using the repository browser.