OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [c/] [src/] [libchip/] [serial/] [serial.h] - Blame information for rev 1780

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.