source: rtems/cpukit/libcsupport/include/rtems/termiostypes.h @ 11edb53

4.104.114.84.95
Last change on this file since 11edb53 was a080705, checked in by Joel Sherrill <joel.sherrill@…>, on 11/27/00 at 17:05:41

2000-11-27 Joel Sherrill <joel@…>

  • libc/termiostypes.h: New file -- missed in earlier commits.
  • Property mode set to 100644
File size: 3.7 KB
Line 
1/*
2 *  RTEMS termios device support internal data structures
3 *
4 *  COPYRIGHT (c) 1989-2000.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.OARcorp.com/rtems/license.html.
10 *
11 *  $Id$
12 */
13
14#ifndef TERMIOSTYPES_H
15#define TERMIOSTYPES_H
16
17#include <rtems.h>
18#include <rtems/libio.h>
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24/*
25 * Variables associated with the character buffer
26 */
27struct rtems_termios_rawbuf {
28  volatile char         *theBuf;
29  volatile unsigned int Head;
30  volatile unsigned int Tail;
31  volatile unsigned int Size;
32  rtems_id              Semaphore; 
33};
34/*
35 * Variables associated with each termios instance.
36 * One structure for each hardware I/O device.
37 */
38struct rtems_termios_tty {
39        /*
40         * Linked-list of active TERMIOS devices
41         */
42        struct rtems_termios_tty        *forw;
43        struct rtems_termios_tty        *back;
44
45        /*
46         * How many times has this device been opened
47         */
48        int             refcount;
49
50        /*
51         * This device
52         */
53        rtems_device_major_number       major;
54        rtems_device_major_number       minor;
55
56        /*
57         * Mutual-exclusion semaphores
58         */
59        rtems_id        isem;
60        rtems_id        osem;
61
62        /*
63         * The canonical (cooked) character buffer
64         */
65        char            *cbuf;
66        int             ccount;
67        int             cindex;
68
69        /*
70         * Keep track of cursor (printhead) position
71         */
72        int             column;
73        int             read_start_column;
74
75        /*
76         * The ioctl settings
77         */
78        struct termios  termios;
79        rtems_interval  vtimeTicks;
80
81        /*
82         * Raw input character buffer
83         */
84        struct rtems_termios_rawbuf rawInBuf;
85        rtems_unsigned32        rawInBufSemaphoreOptions;
86        rtems_interval          rawInBufSemaphoreTimeout;
87        rtems_interval          rawInBufSemaphoreFirstTimeout;
88        unsigned int            rawInBufDropped;        /* Statistics */
89
90        /*
91         * Raw output character buffer
92         */
93        struct rtems_termios_rawbuf rawOutBuf;
94        int  t_dqlen; /* count of characters dequeued from device */
95        enum {rob_idle, rob_busy, rob_wait }    rawOutBufState;
96
97        /*
98         * Callbacks to device-specific routines
99         */
100        rtems_termios_callbacks device;
101        volatile unsigned int   flow_ctrl;
102        unsigned int            lowwater,highwater;
103
104        /*
105         * I/O task IDs (for task-driven drivers)
106         */
107        rtems_id                rxTaskId; 
108        rtems_id                txTaskId; 
109        /*
110         * line discipline related stuff
111         */
112        int t_line;   /* id of line discipline                       */
113        void *t_sc;   /* hook for discipline-specific data structure */
114};
115
116struct linesw {
117  int (*l_open) (struct rtems_termios_tty *tp);
118  int (*l_close)(struct rtems_termios_tty *tp);
119  int (*l_read )(struct rtems_termios_tty *tp,rtems_libio_rw_args_t *args);
120  int (*l_write)(struct rtems_termios_tty *tp,rtems_libio_rw_args_t *args);
121  int (*l_rint )(int c,struct rtems_termios_tty *tp);
122  int (*l_start)(struct rtems_termios_tty *tp);
123  int (*l_ioctl)(struct rtems_termios_tty *tp,rtems_libio_ioctl_args_t *args);
124  int (*l_modem)(struct rtems_termios_tty *tp,int flags);
125};
126
127/*
128 * FIXME: this should move to libio.h!
129 * values for rtems_termios_callbacks.outputUsesInterrupts
130 */
131#define TERMIOS_POLLED      0
132#define TERMIOS_IRQ_DRIVEN  1
133#define TERMIOS_TASK_DRIVEN 2
134
135
136/*
137 * FIXME: this should move to termios.h!
138 */
139void rtems_termios_rxirq_occured(struct rtems_termios_tty *tty);
140/*
141 * FIXME: this should move to termios.h!
142 * put a string to output ring buffer
143 */
144void rtems_termios_puts (const char *buf,
145                         int len,
146                         struct rtems_termios_tty *tty);
147/*
148 * global hooks for line disciplines
149 */
150extern struct linesw linesw[];
151extern int nlinesw;
152
153#define TTYDISC         0               /* termios tty line discipline */
154#define TABLDISC        3               /* tablet discipline */
155#define SLIPDISC        4               /* serial IP discipline */
156#define PPPDISC         5               /* PPP discipline */
157#define MAXLDISC        8
158
159#ifdef __cplusplus
160}
161#endif
162
163#endif  /* TERMIOSTYPES_H */
Note: See TracBrowser for help on using the repository browser.