source: rtems/c/src/lib/libchip/serial/serial.h @ 5ae415b

4.104.114.84.95
Last change on this file since 5ae415b was 5ae415b, checked in by Joel Sherrill <joel.sherrill@…>, on 07/05/98 at 11:04:31

Added include of termios.h.

Also added a block of comments above the console_tbl structure to explain
each entry.

  • Property mode set to 100644
File size: 5.2 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
55/*
56 * Each field is interpreted thus:
57 *
58 * sDeviceName  This is the name of the device.
59 *
60 * pDeviceFns   This is a pointer to the set of driver routines to use.
61 *
62 * pDeviceFlow  This is a pointer to the set of flow control routines to
63 *              use. Serial device drivers will typically supply RTSCTS
64 *              and DTRCTS handshake routines for DCE to DCE communication,
65 *              however for DCE to DTE communication, no such routines
66 *              should be necessary as RTS will be driven automatically
67 *              when the transmitter is active.
68 *
69 * ulMargin     The high water mark in the input buffer is set to the buffer
70 *              size less ulMargin. Once this level is reached, the driver's
71 *              flow control routine used to stop the remote transmitter will
72 *              be called. This figure should be greater than or equal to
73 *              the number of stages of FIFO between the transmitter and
74 *              receiver.
75 *
76 *              NOTE: At the current time, this parameter is hard coded
77 *                    in termios and this number is ignored.
78 *
79 * ulHysteresis After the high water mark specified by ulMargin has been
80 *              reached, the driver's routine to re-start the remote
81 *              transmitter will be called once the level in the input
82 *              buffer has fallen by ulHysteresis bytes.
83 *
84 *              NOTE: At the current time, this parameter is hard coded
85 *                    in termios and this number is ignored.
86 *
87 * pDeviceParams This contains either device specific data or a pointer to a
88 *              device specific structure containing additional information
89 *              not provided in this table.
90 *
91 * ulCtrlPort1  This is the primary control port number for the device. This
92 *              may be used to specify different instances of the same device
93 *              type.
94 *
95 * ulCtrlPort2  This is the secondary control port number, of use when a given
96 *              device has more than one available channel.
97 *
98 * ulDataPort   This is the port number for the data port of the device
99 *
100 * getRegister  This is the routine used to read register values.
101 *
102 * setRegister  This is the routine used to write register values.
103 *
104 * getData      This is the routine used to read the data register (RX).
105 *
106 * setData      This is the routine used to write the data register (TX).
107 *
108 * ulClock      This is the baud rate clock speed.
109 *
110 * ulIntVector  This encodes the interrupt vector of the device.
111 */
112
113typedef struct _console_tbl {
114  char          *sDeviceName;
115  console_fns   *pDeviceFns;
116  boolean      (*deviceProbe)(int minor);
117  console_flow  *pDeviceFlow;
118  unsigned32     ulMargin;
119  unsigned32     ulHysteresis;
120  void          *pDeviceParams;
121  unsigned32     ulCtrlPort1;
122  unsigned32     ulCtrlPort2;
123  unsigned32     ulDataPort;
124  getRegister_f  getRegister;
125  setRegister_f  setRegister;
126  getData_f      getData;
127  setData_f      setData;
128  unsigned32     ulClock;
129  unsigned int   ulIntVector;
130} console_tbl;
131
132typedef struct _console_data {
133  void                   *termios_data;
134  volatile boolean        bActive;
135  volatile Ring_buffer_t  TxBuffer;
136  /*
137   * This field may be used for any purpose required by the driver
138   */
139  void                   *pDeviceContext;
140} console_data;
141
142extern console_tbl  Console_Port_Tbl[];
143extern console_data Console_Port_Data[];
144extern unsigned long  Console_Port_Count;
145
146#endif
147/* end of include file */
Note: See TracBrowser for help on using the repository browser.