source: rtems/cpukit/libcsupport/include/rtems/termiostypes.h @ 9b4422a2

4.11
Last change on this file since 9b4422a2 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on May 3, 2012 at 3:09:24 PM

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 5.3 KB
Line 
1/**
2 * @file rtems/termiostypes.h
3 *
4 * RTEMS termios device support internal data structures
5 */
6
7/*
8 *  COPYRIGHT (c) 1989-2011.
9 *  On-Line Applications Research Corporation (OAR).
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *  http://www.rtems.com/license/LICENSE.
14 */
15
16#ifndef  __TERMIOSTYPES_H
17#define  __TERMIOSTYPES_H
18
19#include <rtems.h>
20#include <rtems/libio.h>
21#include <rtems/assoc.h>
22#include <stdint.h>
23#include <termios.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29/*
30 * Wakeup callback data structure
31 */
32struct ttywakeup {
33  void      (*sw_pfn)(struct termios *tty, void *arg);
34  void      *sw_arg;
35};
36
37/*
38 * Variables associated with the character buffer
39 */
40struct rtems_termios_rawbuf {
41  char *theBuf;
42  volatile unsigned int  Head;
43  volatile unsigned int  Tail;
44  volatile unsigned int  Size;
45  rtems_id    Semaphore;
46};
47/*
48 * Variables associated with each termios instance.
49 * One structure for each hardware I/O device.
50 */
51struct rtems_termios_tty {
52  /*
53   * Linked-list of active TERMIOS devices
54   */
55  struct rtems_termios_tty  *forw;
56  struct rtems_termios_tty  *back;
57
58  /*
59   * How many times has this device been opened
60   */
61  int    refcount;
62
63  /*
64   * This device
65   */
66  rtems_device_major_number  major;
67  rtems_device_minor_number  minor;
68
69  /*
70   * Mutual-exclusion semaphores
71   */
72  rtems_id  isem;
73  rtems_id  osem;
74
75  /*
76   * The canonical (cooked) character buffer
77   */
78  char    *cbuf;
79  int    ccount;
80  int    cindex;
81
82  /*
83   * Keep track of cursor (printhead) position
84   */
85  int    column;
86  int    read_start_column;
87
88  /*
89   * The ioctl settings
90   */
91  struct termios  termios;
92  rtems_interval  vtimeTicks;
93
94  /*
95   * Raw input character buffer
96   */
97  struct rtems_termios_rawbuf rawInBuf;
98  uint32_t                    rawInBufSemaphoreOptions;
99  rtems_interval              rawInBufSemaphoreTimeout;
100  rtems_interval              rawInBufSemaphoreFirstTimeout;
101  unsigned int                rawInBufDropped;  /* Statistics */
102
103  /*
104   * Raw output character buffer
105   */
106  struct rtems_termios_rawbuf rawOutBuf;
107  int  t_dqlen; /* count of characters dequeued from device */
108  enum {rob_idle, rob_busy, rob_wait }  rawOutBufState;
109
110  /*
111   * Callbacks to device-specific routines
112   */
113  rtems_termios_callbacks  device;
114  volatile unsigned int    flow_ctrl;
115  unsigned int             lowwater,highwater;
116
117  /*
118   * I/O task IDs (for task-driven drivers)
119   */
120  rtems_id                rxTaskId;
121  rtems_id                txTaskId;
122
123  /*
124   * line discipline related stuff
125   */
126  int t_line;   /* id of line discipline                       */
127  void *t_sc;   /* hook for discipline-specific data structure */
128
129  /*
130   * Wakeup callback variables
131   */
132  struct ttywakeup tty_snd;
133  struct ttywakeup tty_rcv;
134  int              tty_rcvwakeup;
135};
136
137struct rtems_termios_linesw {
138  int (*l_open) (struct rtems_termios_tty *tp);
139  int (*l_close)(struct rtems_termios_tty *tp);
140  int (*l_read )(struct rtems_termios_tty *tp,rtems_libio_rw_args_t *args);
141  int (*l_write)(struct rtems_termios_tty *tp,rtems_libio_rw_args_t *args);
142  int (*l_rint )(int c,struct rtems_termios_tty *tp);
143  int (*l_start)(struct rtems_termios_tty *tp);
144  int (*l_ioctl)(struct rtems_termios_tty *tp,rtems_libio_ioctl_args_t *args);
145  int (*l_modem)(struct rtems_termios_tty *tp,int flags);
146};
147
148/*
149 * FIXME: this should move to libio.h!
150 * values for rtems_termios_callbacks.outputUsesInterrupts
151 */
152#define TERMIOS_POLLED      0
153#define TERMIOS_IRQ_DRIVEN  1
154#define TERMIOS_TASK_DRIVEN 2
155
156/*
157 * FIXME: this should move to termios.h!
158 */
159void rtems_termios_rxirq_occured(struct rtems_termios_tty *tty);
160
161/*
162 * FIXME: this should move to termios.h!
163 * put a string to output ring buffer
164 */
165void rtems_termios_puts (
166  const void               *buf,
167  size_t                    len,
168  struct rtems_termios_tty *tty
169);
170
171/*
172 * global hooks for line disciplines
173 */
174extern struct rtems_termios_linesw rtems_termios_linesw[];
175extern int   rtems_termios_nlinesw;
176
177#define TTYDISC   0    /* termios tty line discipline */
178#define TABLDISC  3    /* tablet discipline */
179#define SLIPDISC  4    /* serial IP discipline */
180#define PPPDISC   5    /* PPP discipline */
181#define MAXLDISC  8
182
183/* baudrate xxx integer type */
184typedef uint32_t rtems_termios_baud_t;
185
186extern const rtems_assoc_t rtems_termios_baud_table [];
187
188/**
189 * @brief Converts the integral baud value @a baud to the Termios control flag
190 * representation.
191 *
192 * @retval B0 Invalid baud value or a baud value of 0.
193 * @retval other Baud constant according to @a baud.
194 */
195tcflag_t rtems_termios_number_to_baud(rtems_termios_baud_t baud);
196
197/**
198 * @brief Converts the baud part of the Termios control flags @a c_cflag to an
199 * integral baud value.
200 *
201 * There is no need to mask the @a c_cflag with @c CBAUD.
202 *
203 * @retval 0 Invalid baud value or a baud value of @c B0.
204 * @retval other Integral baud value.
205 */
206rtems_termios_baud_t rtems_termios_baud_to_number(tcflag_t c_cflag);
207
208/* convert Bxxx constant to index */
209int  rtems_termios_baud_to_index(rtems_termios_baud_t termios_baud);
210
211/**
212 * @brief Sets the initial @a baud in the Termios context @a tty.
213 *
214 * @retval 0 Successful operation.
215 * @retval -1 Invalid baud value.
216 */
217int rtems_termios_set_initial_baud(
218  struct rtems_termios_tty *tty,
219  rtems_termios_baud_t baud
220);
221
222#ifdef __cplusplus
223}
224#endif
225
226#endif  /* TERMIOSTYPES_H */
Note: See TracBrowser for help on using the repository browser.