Ignore:
Timestamp:
May 22, 2008, 8:16:08 PM (14 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.9, 5, master
Children:
adaf33af
Parents:
aefbb57
Message:

2008-05-22 Joel Sherrill <joel.sherrill@…>

  • libcsupport/Makefile.am, libcsupport/preinstall.am, libcsupport/include/rtems/termiostypes.h: Move termios helper routines from libchip to libcsupport. Add routine which makes it easy for a termios device driver to inform termios of its default baud rate. This avoids inconsistencies in later termios settings changes.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libcsupport/include/rtems/termiostypes.h

    raefbb57 rb6be4217  
    66 *  RTEMS termios device support internal data structures
    77 *
    8  *  COPYRIGHT (c) 1989-2000.
     8 *  COPYRIGHT (c) 1989-2008.
    99 *  On-Line Applications Research Corporation (OAR).
    1010 *
     
    1616 */
    1717
    18 #ifndef TERMIOSTYPES_H
    19 #define TERMIOSTYPES_H
     18#ifndef  __TERMIOSTYPES_H
     19#define  __TERMIOSTYPES_H
    2020
    2121#include <rtems.h>
     
    3939struct rtems_termios_rawbuf {
    4040  char *theBuf;
    41   volatile unsigned int Head;
    42   volatile unsigned int Tail;
    43   volatile unsigned int Size;
    44   rtems_id              Semaphore;
     41  volatile unsigned int  Head;
     42  volatile unsigned int  Tail;
     43  volatile unsigned int  Size;
     44  rtems_id    Semaphore;
    4545};
    4646/*
     
    4949 */
    5050struct rtems_termios_tty {
    51         /*
    52          * Linked-list of active TERMIOS devices
    53          */
    54         struct rtems_termios_tty        *forw;
    55         struct rtems_termios_tty        *back;
    56 
    57         /*
    58          * How many times has this device been opened
    59          */
    60         int             refcount;
    61 
    62         /*
    63          * This device
    64          */
    65         rtems_device_major_number       major;
    66         rtems_device_major_number       minor;
    67 
    68         /*
    69          * Mutual-exclusion semaphores
    70          */
    71         rtems_id        isem;
    72         rtems_id        osem;
    73 
    74         /*
    75          * The canonical (cooked) character buffer
    76          */
    77         char            *cbuf;
    78         int             ccount;
    79         int             cindex;
    80 
    81         /*
    82          * Keep track of cursor (printhead) position
    83          */
    84         int             column;
    85         int             read_start_column;
    86 
    87         /*
    88          * The ioctl settings
    89          */
    90         struct termios  termios;
    91         rtems_interval  vtimeTicks;
    92 
    93         /*
    94          * Raw input character buffer
    95          */
    96         struct rtems_termios_rawbuf rawInBuf;
    97         uint32_t        rawInBufSemaphoreOptions;
    98         rtems_interval          rawInBufSemaphoreTimeout;
    99         rtems_interval          rawInBufSemaphoreFirstTimeout;
    100         unsigned int            rawInBufDropped;        /* Statistics */
    101 
    102         /*
    103          * Raw output character buffer
    104          */
    105         struct rtems_termios_rawbuf rawOutBuf;
    106         int  t_dqlen; /* count of characters dequeued from device */
    107         enum {rob_idle, rob_busy, rob_wait }    rawOutBufState;
    108 
    109         /*
    110          * Callbacks to device-specific routines
    111          */
    112         rtems_termios_callbacks device;
    113         volatile unsigned int   flow_ctrl;
    114         unsigned int            lowwater,highwater;
    115 
    116         /*
    117          * I/O task IDs (for task-driven drivers)
    118          */
    119         rtems_id                rxTaskId;
    120         rtems_id                txTaskId;
    121         /*
    122          * line discipline related stuff
    123          */
    124         int t_line;   /* id of line discipline                       */
    125         void *t_sc;   /* hook for discipline-specific data structure */
    126         /*
    127          * Wakeup callback variables
    128          */
    129         struct ttywakeup tty_snd;
    130         struct ttywakeup tty_rcv;
    131         int              tty_rcvwakeup;
     51  /*
     52   * Linked-list of active TERMIOS devices
     53   */
     54  struct rtems_termios_tty  *forw;
     55  struct rtems_termios_tty  *back;
     56
     57  /*
     58   * How many times has this device been opened
     59   */
     60  int    refcount;
     61
     62  /*
     63   * This device
     64   */
     65  rtems_device_major_number  major;
     66  rtems_device_major_number  minor;
     67
     68  /*
     69   * Mutual-exclusion semaphores
     70   */
     71  rtems_id  isem;
     72  rtems_id  osem;
     73
     74  /*
     75   * The canonical (cooked) character buffer
     76   */
     77  char    *cbuf;
     78  int    ccount;
     79  int    cindex;
     80
     81  /*
     82   * Keep track of cursor (printhead) position
     83   */
     84  int    column;
     85  int    read_start_column;
     86
     87  /*
     88   * The ioctl settings
     89   */
     90  struct termios  termios;
     91  rtems_interval  vtimeTicks;
     92
     93  /*
     94   * Raw input character buffer
     95   */
     96  struct rtems_termios_rawbuf rawInBuf;
     97  uint32_t                    rawInBufSemaphoreOptions;
     98  rtems_interval              rawInBufSemaphoreTimeout;
     99  rtems_interval              rawInBufSemaphoreFirstTimeout;
     100  unsigned int                rawInBufDropped;  /* Statistics */
     101
     102  /*
     103   * Raw output character buffer
     104   */
     105  struct rtems_termios_rawbuf rawOutBuf;
     106  int  t_dqlen; /* count of characters dequeued from device */
     107  enum {rob_idle, rob_busy, rob_wait }  rawOutBufState;
     108
     109  /*
     110   * Callbacks to device-specific routines
     111   */
     112  rtems_termios_callbacks  device;
     113  volatile unsigned int    flow_ctrl;
     114  unsigned int             lowwater,highwater;
     115
     116  /*
     117   * I/O task IDs (for task-driven drivers)
     118   */
     119  rtems_id                rxTaskId;
     120  rtems_id                txTaskId;
     121
     122  /*
     123   * line discipline related stuff
     124   */
     125  int t_line;   /* id of line discipline                       */
     126  void *t_sc;   /* hook for discipline-specific data structure */
     127
     128  /*
     129   * Wakeup callback variables
     130   */
     131  struct ttywakeup tty_snd;
     132  struct ttywakeup tty_rcv;
     133  int              tty_rcvwakeup;
    132134};
    133135
     
    151153#define TERMIOS_TASK_DRIVEN 2
    152154
    153 
    154155/*
    155156 * FIXME: this should move to termios.h!
    156157 */
    157158void rtems_termios_rxirq_occured(struct rtems_termios_tty *tty);
     159
    158160/*
    159161 * FIXME: this should move to termios.h!
    160162 * put a string to output ring buffer
    161163 */
    162 void rtems_termios_puts (const void *buf,
    163                          int len,
    164                          struct rtems_termios_tty *tty);
     164void rtems_termios_puts (
     165  const void               *buf,
     166  int                       len,
     167  struct rtems_termios_tty *tty
     168);
     169
    165170/*
    166171 * global hooks for line disciplines
    167172 */
    168173extern struct rtems_termios_linesw rtems_termios_linesw[];
    169 extern int rtems_termios_nlinesw;
    170 
    171 #define TTYDISC         0               /* termios tty line discipline */
    172 #define TABLDISC        3               /* tablet discipline */
    173 #define SLIPDISC        4               /* serial IP discipline */
    174 #define PPPDISC         5               /* PPP discipline */
    175 #define MAXLDISC        8
     174extern int   rtems_termios_nlinesw;
     175
     176#define TTYDISC   0    /* termios tty line discipline */
     177#define TABLDISC  3    /* tablet discipline */
     178#define SLIPDISC  4    /* serial IP discipline */
     179#define PPPDISC   5    /* PPP discipline */
     180#define MAXLDISC  8
     181
     182/* convert xxx integer to equivalent Bxxx constant */
     183int  termios_number_to_baud(int baud);
     184/* convert Bxxx constant to xxx integer */
     185int  termios_baud_to_number(int termios_baud);
     186/* convert Bxxx constant to index */
     187int  termios_baud_to_index(int termios_baud);
     188
     189/*
     190 *  This method is used by a driver to tell termios its
     191 *  initial baud rate.  This is especially important when
     192 *  the device driver does not set the baud to the default
     193 *  of B9600.
     194 */
     195int  rtems_termios_set_initial_baud(
     196  struct rtems_termios_tty *ttyp,
     197  int                       baud
     198);
    176199
    177200#ifdef __cplusplus
     
    179202#endif
    180203
    181 #endif  /* TERMIOSTYPES_H */
     204#endif  /* TERMIOSTYPES_H */
Note: See TracChangeset for help on using the changeset viewer.