source: rtems/c/src/libchip/serial/serial.h @ 642c500

4.104.115
Last change on this file since 642c500 was 642c500, checked in by Joel Sherrill <joel.sherrill@…>, on 04/26/10 at 00:58:39

2010-04-25 Joel Sherrill <joel.sherrilL@…>

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