source: rtems/cpukit/libcsupport/include/rtems/termiostypes.h @ 21242c2

4.115
Last change on this file since 21242c2 was 21242c2, checked in by Joel Sherrill <joel.sherrill@…>, on Jun 24, 2011 at 5:52:58 PM

2011-06-24 Joel Sherrill <joel.sherrill@…>

  • include/rtems/bspIo.h, include/rtems/concat.h, include/rtems/endian.h, include/rtems/fs.h, include/rtems/irq.h, include/rtems/pci.h, include/rtems/userenv.h, libblock/include/rtems/flashdisk.h, libblock/include/rtems/nvdisk-sram.h, libblock/include/rtems/nvdisk.h, libcsupport/include/clockdrv.h, libcsupport/include/console.h, libcsupport/include/iosupp.h, libcsupport/include/spurious.h, libcsupport/include/motorola/mc68230.h, libcsupport/include/rtems/assoc.h, libcsupport/include/rtems/error.h, libcsupport/include/rtems/framebuffer.h, libcsupport/include/rtems/gxx_wrappers.h, libcsupport/include/rtems/libcsupport.h, libcsupport/include/rtems/libio_.h, libcsupport/include/rtems/malloc.h, libcsupport/include/rtems/termiostypes.h, libcsupport/include/sys/statvfs.h, libcsupport/include/sys/termios.h, libcsupport/include/sys/utsname.h, libcsupport/include/zilog/z8036.h, libcsupport/include/zilog/z8530.h, libcsupport/include/zilog/z8536.h, libfs/src/imfs/imfs.h, libfs/src/pipe/pipe.h, libmisc/capture/capture-cli.h, libmisc/capture/capture.h, libmisc/cpuuse/cpuuse.h, libmisc/devnull/devnull.h, libmisc/devnull/devzero.h, libmisc/dumpbuf/dumpbuf.h, libmisc/fb/fb.h, libmisc/fb/mw_uid.h, libmisc/mouse/mouse_parser.h, libmisc/shell/shellconfig.h, libmisc/stringto/stringto.h, libmisc/untar/untar.h, libnetworking/memory.h, posix/include/aio.h, posix/include/mqueue.h, posix/include/semaphore.h, posix/include/rtems/posix/aio_misc.h, posix/include/rtems/posix/barrier.h, posix/include/rtems/posix/cond.h, posix/include/rtems/posix/config.h, posix/include/rtems/posix/key.h, posix/include/rtems/posix/mqueue.h, posix/include/rtems/posix/mutex.h, posix/include/rtems/posix/posixapi.h, posix/include/rtems/posix/priority.h, posix/include/rtems/posix/psignal.h, posix/include/rtems/posix/pthread.h, posix/include/rtems/posix/ptimer.h, posix/include/rtems/posix/rwlock.h, posix/include/rtems/posix/semaphore.h, posix/include/rtems/posix/sigset.h, posix/include/rtems/posix/spinlock.h, posix/include/rtems/posix/threadsup.h, posix/include/rtems/posix/time.h, posix/include/rtems/posix/timer.h, posix/inline/rtems/posix/barrier.inl, posix/inline/rtems/posix/cond.inl, posix/inline/rtems/posix/mqueue.inl, posix/inline/rtems/posix/mutex.inl, posix/inline/rtems/posix/priority.inl, posix/inline/rtems/posix/pthread.inl, posix/inline/rtems/posix/rwlock.inl, posix/inline/rtems/posix/semaphore.inl, posix/inline/rtems/posix/spinlock.inl, posix/inline/rtems/posix/timer.inl, rtems/mainpage.h, rtems/include/rtems/rtems/barrier.h, rtems/include/rtems/rtems/object.h, rtems/include/rtems/rtems/timer.h, rtems/inline/rtems/rtems/barrier.inl, rtems/inline/rtems/rtems/timer.inl, rtems/src/semtranslatereturncode.c, sapi/include/rtems/config.h, sapi/include/rtems/fatal.h, sapi/include/rtems/mptables.h, score/include/rtems/score/object.h, score/include/rtems/score/priority.h, score/inline/rtems/score/object.inl, score/inline/rtems/score/priority.inl: Add @file Doxygen directives and descriptions to files which originated with RTEMS. This improves the file list page generated by Doxygen.
  • Property mode set to 100644
File size: 4.9 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 *  $Id$
16 */
17
18#ifndef  __TERMIOSTYPES_H
19#define  __TERMIOSTYPES_H
20
21#include <rtems.h>
22#include <rtems/libio.h>
23#include <stdint.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  int                       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 int32_t rtems_termios_baud_t;
185
186/* convert xxx integer to equivalent Bxxx constant */
187int  rtems_termios_number_to_baud(rtems_termios_baud_t baud);
188
189/* convert Bxxx constant to xxx integer */
190rtems_termios_baud_t rtems_termios_baud_to_number(int termios_baud);
191
192/* convert Bxxx constant to index */
193int  rtems_termios_baud_to_index(rtems_termios_baud_t termios_baud);
194
195/*
196 *  This method is used by a driver to tell termios its
197 *  initial baud rate.  This is especially important when
198 *  the device driver does not set the baud to the default
199 *  of B9600.
200 */
201int  rtems_termios_set_initial_baud(
202  struct rtems_termios_tty *ttyp,
203  rtems_termios_baud_t      baud
204);
205
206#ifdef __cplusplus
207}
208#endif
209
210#endif  /* TERMIOSTYPES_H */
Note: See TracBrowser for help on using the repository browser.