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
RevLine 
[ee3b242b]1/*
2 *  This file contains the TTY driver table definition
3 *
4 *  This driver uses the termios pseudo driver.
5 *
[08311cc3]6 *  COPYRIGHT (c) 1989-1999.
[009c235]7 *  On-Line Applications Research Corporation (OAR).
[ee3b242b]8 *
[009c235]9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
[94365d9]11 *  http://www.rtems.com/license/LICENSE.
[ee3b242b]12 *
13 *  $Id$
14 */
15
16#ifndef __LIBCHIP_SERIAL_h
17#define __LIBCHIP_SERIAL_h
18
[e97e0e0]19#include <stdint.h>
20#include <stdbool.h>
[5ae415b]21#include <termios.h>
[ee3b242b]22
[7e72d51]23#ifdef __cplusplus
24extern "C" {
25#endif
26
[36152b0e]27/*
28 *  Types for get and set register routines
29 */
30
[642c500]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);
[36152b0e]35
[ee3b242b]36typedef struct _console_fns {
[6640459d]37  bool    (*deviceProbe)(int minor);
[58b1e95]38  int     (*deviceFirstOpen)(int major, int minor, void *arg);
39  int     (*deviceLastClose)(int major, int minor, void *arg);
40  int     (*deviceRead)(int minor);
[3ed964f9]41  ssize_t (*deviceWrite)(int minor, const char *buf, size_t len);
[58b1e95]42  void    (*deviceInitialize)(int minor);
43  void    (*deviceWritePolled)(int minor, char cChar);
[8a2d4f2b]44  int     (*deviceSetAttributes)(int minor, const struct termios *t);
[6640459d]45  bool      deviceOutputUsesInterrupts;
[ee3b242b]46} console_fns;
47
48typedef struct _console_flow {
[424e23ee]49  int (*deviceStopRemoteTx)(int minor);
50  int (*deviceStartRemoteTx)(int minor);
[ee3b242b]51} console_flow;
52
[c0573d7]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
[5ae415b]60/*
61 * Each field is interpreted thus:
[a3d3d9a]62 *
63 * sDeviceName  This is the name of the device.
[5ae415b]64 *
[c0573d7]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 *
[5ae415b]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
[a3d3d9a]83 *              receiver.
[5ae415b]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
[a3d3d9a]98 *              not provided in this table.
[5ae415b]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
[ee3b242b]122typedef struct _console_tbl {
[58b1e95]123  char          *sDeviceName;
[c0573d7]124  console_devs   deviceType;
[58b1e95]125  console_fns   *pDeviceFns;
[6640459d]126  bool         (*deviceProbe)(int minor);
[424e23ee]127  console_flow  *pDeviceFlow;
[ee4f57d]128  uint32_t       ulMargin;
129  uint32_t       ulHysteresis;
[58b1e95]130  void          *pDeviceParams;
[ee4f57d]131  uint32_t       ulCtrlPort1;
132  uint32_t       ulCtrlPort2;
133  uint32_t       ulDataPort;
[36152b0e]134  getRegister_f  getRegister;
135  setRegister_f  setRegister;
136  getData_f      getData;
137  setData_f      setData;
[ee4f57d]138  uint32_t       ulClock;
[58b1e95]139  unsigned int   ulIntVector;
[ee3b242b]140} console_tbl;
141
142typedef struct _console_data {
[58b1e95]143  void                   *termios_data;
[6640459d]144  volatile bool           bActive;
[424e23ee]145  /*
146   * This field may be used for any purpose required by the driver
147   */
[58b1e95]148  void                   *pDeviceContext;
[ee3b242b]149} console_data;
150
[424e23ee]151extern console_tbl  Console_Port_Tbl[];
152extern console_data Console_Port_Data[];
153extern unsigned long  Console_Port_Count;
[ee3b242b]154
[7e72d51]155#ifdef __cplusplus
156}
157#endif
158
[ee3b242b]159#endif
Note: See TracBrowser for help on using the repository browser.