source: rtems/c/src/libchip/serial/serial.h @ 38e717f

4.104.114.84.95
Last change on this file since 38e717f was c0573d7, checked in by Joel Sherrill <joel.sherrill@…>, on 07/15/98 at 21:40:42

Added comment to remove use of TxBuffer? ring buffer in all libchip drivers.
The scheme used in the mc68681 is the one to follow.

  • Property mode set to 100644
File size: 5.7 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) 1998 by Radstone Technology
7 *
8 *
9 * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY
10 * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
11 * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK
12 * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU.
13 *
14 * You are hereby granted permission to use, copy, modify, and distribute
15 * this file, provided that this notice, plus the above copyright notice
16 * and disclaimer, appears in all copies. Radstone Technology will provide
17 * no support for this code.
18 *
19 *  $Id$
20 */
21
22#ifndef __LIBCHIP_SERIAL_h
23#define __LIBCHIP_SERIAL_h
24
25#include <termios.h>
26#include <ringbuf.h>
27
28/*
29 *  Types for get and set register routines
30 */
31
32typedef unsigned8 (*getRegister_f)(unsigned32 port, unsigned8 register);
33typedef void      (*setRegister_f)(
34                            unsigned32 port, unsigned8 reg, unsigned8 value);
35typedef unsigned8 (*getData_f)(unsigned32 port);
36typedef void      (*setData_f)(unsigned32 port, unsigned8 value);
37
38typedef struct _console_fns {
39  boolean (*deviceProbe)(int minor);
40  int     (*deviceFirstOpen)(int major, int minor, void *arg);
41  int     (*deviceLastClose)(int major, int minor, void *arg);
42  int     (*deviceRead)(int minor);
43  int     (*deviceWrite)(int minor, const char *buf, int len);
44  void    (*deviceInitialize)(int minor);
45  void    (*deviceWritePolled)(int minor, char cChar);
46  int     (*deviceSetAttributes)(int minor, const struct termios *t);
47  int       deviceOutputUsesInterrupts;
48} console_fns;
49
50typedef struct _console_flow {
51  int (*deviceStopRemoteTx)(int minor);
52  int (*deviceStartRemoteTx)(int minor);
53} console_flow;
54
55typedef enum {
56  SERIAL_MC68681,              /* Motorola MC68681 or Exar 88681 */
57  SERIAL_NS16550,              /* National Semiconductor NS16550 */
58  SERIAL_Z85C30,               /* Zilog Z85C30 */
59  SERIAL_CUSTOM                /* BSP specific driver */
60
61} console_devs;
62
63/*
64 * Each field is interpreted thus:
65 *
66 * sDeviceName  This is the name of the device.
67 *
68 * deviceType   This indicates the chip type.  It is especially important when
69 *              multiple devices share the same interrupt vector and must be
70 *              distinguished.
71 *
72 * pDeviceFns   This is a pointer to the set of driver routines to use.
73 *
74 * pDeviceFlow  This is a pointer to the set of flow control routines to
75 *              use. Serial device drivers will typically supply RTSCTS
76 *              and DTRCTS handshake routines for DCE to DCE communication,
77 *              however for DCE to DTE communication, no such routines
78 *              should be necessary as RTS will be driven automatically
79 *              when the transmitter is active.
80 *
81 * ulMargin     The high water mark in the input buffer is set to the buffer
82 *              size less ulMargin. Once this level is reached, the driver's
83 *              flow control routine used to stop the remote transmitter will
84 *              be called. This figure should be greater than or equal to
85 *              the number of stages of FIFO between the transmitter and
86 *              receiver.
87 *
88 *              NOTE: At the current time, this parameter is hard coded
89 *                    in termios and this number is ignored.
90 *
91 * ulHysteresis After the high water mark specified by ulMargin has been
92 *              reached, the driver's routine to re-start the remote
93 *              transmitter will be called once the level in the input
94 *              buffer has fallen by ulHysteresis bytes.
95 *
96 *              NOTE: At the current time, this parameter is hard coded
97 *                    in termios and this number is ignored.
98 *
99 * pDeviceParams This contains either device specific data or a pointer to a
100 *              device specific structure containing additional information
101 *              not provided in this table.
102 *
103 * ulCtrlPort1  This is the primary control port number for the device. This
104 *              may be used to specify different instances of the same device
105 *              type.
106 *
107 * ulCtrlPort2  This is the secondary control port number, of use when a given
108 *              device has more than one available channel.
109 *
110 * ulDataPort   This is the port number for the data port of the device
111 *
112 * getRegister  This is the routine used to read register values.
113 *
114 * setRegister  This is the routine used to write register values.
115 *
116 * getData      This is the routine used to read the data register (RX).
117 *
118 * setData      This is the routine used to write the data register (TX).
119 *
120 * ulClock      This is the baud rate clock speed.
121 *
122 * ulIntVector  This encodes the interrupt vector of the device.
123 */
124
125typedef struct _console_tbl {
126  char          *sDeviceName;
127  console_devs   deviceType;
128  console_fns   *pDeviceFns;
129  boolean      (*deviceProbe)(int minor);
130  console_flow  *pDeviceFlow;
131  unsigned32     ulMargin;
132  unsigned32     ulHysteresis;
133  void          *pDeviceParams;
134  unsigned32     ulCtrlPort1;
135  unsigned32     ulCtrlPort2;
136  unsigned32     ulDataPort;
137  getRegister_f  getRegister;
138  setRegister_f  setRegister;
139  getData_f      getData;
140  setData_f      setData;
141  unsigned32     ulClock;
142  unsigned int   ulIntVector;
143} console_tbl;
144
145typedef struct _console_data {
146  void                   *termios_data;
147  volatile boolean        bActive;
148  volatile Ring_buffer_t  TxBuffer;  /* XXX remove from other drivers */
149  /*
150   * This field may be used for any purpose required by the driver
151   */
152  void                   *pDeviceContext;
153} console_data;
154
155extern console_tbl  Console_Port_Tbl[];
156extern console_data Console_Port_Data[];
157extern unsigned long  Console_Port_Count;
158
159#endif
160/* end of include file */
Note: See TracBrowser for help on using the repository browser.