The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/i386/include/cserial.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Ioctl interface to Cronyx serial drivers.
    3  *
    4  * Copyright (C) 1997-2002 Cronyx Engineering.
    5  * Author: Serge Vakulenko, <vak@cronyx.ru>
    6  *
    7  * Copyright (C) 2001-2005 Cronyx Engineering.
    8  * Author: Roman Kurakin, <rik@FreeBSD.org>
    9  *
   10  * Copyright (C) 2004-2005 Cronyx Engineering.
   11  * Author: Leo Yuriev, <ly@cronyx.ru>
   12  *
   13  * This software is distributed with NO WARRANTIES, not even the implied
   14  * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
   15  *
   16  * Authors grant any other persons or organisations permission to use
   17  * or modify this software as long as this message is kept with the software,
   18  * all derivative works or modified versions.
   19  *
   20  * Cronyx Id: cserial.h,v 1.4.2.2 2005/11/09 13:01:35 rik Exp $
   21  * $FreeBSD: releng/9.0/sys/i386/include/cserial.h 155049 2006-01-30 13:34:57Z rik $
   22  */
   23 
   24 /*
   25  * General channel statistics.
   26  */
   27 struct serial_statistics {
   28         unsigned long rintr;            /* receive interrupts */
   29         unsigned long tintr;            /* transmit interrupts */
   30         unsigned long mintr;            /* modem interrupts */
   31         unsigned long ibytes;           /* input bytes */
   32         unsigned long ipkts;            /* input packets */
   33         unsigned long ierrs;            /* input errors */
   34         unsigned long obytes;           /* output bytes */
   35         unsigned long opkts;            /* output packets */
   36         unsigned long oerrs;            /* output errors */
   37 };
   38 
   39 /*
   40  * Statistics for E1/G703 channels.
   41  */
   42 struct e1_counters {
   43         unsigned long bpv;              /* bipolar violations */
   44         unsigned long fse;              /* frame sync errors */
   45         unsigned long crce;             /* CRC errors */
   46         unsigned long rcrce;            /* remote CRC errors (E-bit) */
   47         unsigned long uas;              /* unavailable seconds */
   48         unsigned long les;              /* line errored seconds */
   49         unsigned long es;               /* errored seconds */
   50         unsigned long bes;              /* bursty errored seconds */
   51         unsigned long ses;              /* severely errored seconds */
   52         unsigned long oofs;             /* out of frame seconds */
   53         unsigned long css;              /* controlled slip seconds */
   54         unsigned long dm;               /* degraded minutes */
   55 };
   56 
   57 struct e1_statistics {
   58         unsigned long status;           /* line status bit mask */
   59         unsigned long cursec;           /* seconds in current interval */
   60         unsigned long totsec;           /* total seconds elapsed */
   61         struct e1_counters currnt;      /* current 15-min interval data */
   62         struct e1_counters total;       /* total statistics data */
   63         struct e1_counters interval [48]; /* 12 hour period data */
   64 };
   65 
   66 struct e3_statistics {
   67         unsigned long status;
   68         unsigned long cursec;
   69         unsigned long totsec;
   70         unsigned long ccv;
   71         unsigned long tcv;
   72         unsigned long icv[48];
   73 };
   74 
   75 #define M_ASYNC         0               /* asynchronous mode */
   76 #define M_HDLC          1               /* bit-sync mode (HDLC) */
   77 #define M_G703          2
   78 #define M_E1            3
   79 
   80 /*
   81  * Receive error codes.
   82  */
   83 #define ER_FRAMING      1               /* framing error */
   84 #define ER_CHECKSUM     2               /* parity/CRC error */
   85 #define ER_BREAK        3               /* break state */
   86 #define ER_OVERFLOW     4               /* receive buffer overflow */
   87 #define ER_OVERRUN      5               /* receive fifo overrun */
   88 #define ER_UNDERRUN     6               /* transmit fifo underrun */
   89 #define ER_SCC_FRAMING  7               /* subchannel framing error */
   90 #define ER_SCC_OVERFLOW 8               /* subchannel receive buffer overflow */
   91 #define ER_SCC_OVERRUN  9               /* subchannel receiver overrun */
   92 #define ER_SCC_UNDERRUN 10              /* subchannel transmiter underrun */
   93 #define ER_BUS          11              /* system bus is too busy (e.g PCI) */
   94 
   95 /*
   96  * E1 channel status.
   97  */
   98 #define E1_NOALARM      0x0001          /* no alarm present */
   99 #define E1_FARLOF       0x0002          /* receiving far loss of framing */
  100 #define E1_CRC4E        0x0004          /* crc4 errors */
  101 #define E1_AIS          0x0008          /* receiving all ones */
  102 #define E1_LOF          0x0020          /* loss of framing */
  103 #define E1_LOS          0x0040          /* loss of signal */
  104 #define E1_AIS16        0x0100          /* receiving all ones in timeslot 16 */
  105 #define E1_FARLOMF      0x0200          /* receiving alarm in timeslot 16 */
  106 #define E1_LOMF         0x0400          /* loss of multiframe sync */
  107 #define E1_TSTREQ       0x0800          /* test code detected */
  108 #define E1_TSTERR       0x1000          /* test error */
  109 
  110 #define E3_LOS          0x00000002      /* Lost of synchronization */
  111 #define E3_TXE          0x00000004      /* Transmit error */
  112 
  113 /*
  114  * Query the mask of all registered channels, max 128.
  115  */
  116 #define SERIAL_GETREGISTERED    _IOR ('x', 0, char[16])
  117 
  118 /*
  119  * Attach/detach the protocol to the channel.
  120  * The protocol is given by it's name, char[8].
  121  * For example "async", "hdlc", "cisco", "fr", "ppp".
  122  */
  123 #define SERIAL_GETPROTO         _IOR ('x', 1, char [8])
  124 #define SERIAL_SETPROTO         _IOW ('x', 1, char [8])
  125 
  126 /*
  127  * Query/set the hardware mode for the channel.
  128  */
  129 #define SERIAL_GETMODE          _IOR ('x', 2, int)
  130 #define SERIAL_SETMODE          _IOW ('x', 2, int)
  131 
  132 #define SERIAL_ASYNC            1
  133 #define SERIAL_HDLC             2
  134 #define SERIAL_RAW              3
  135 
  136 /*
  137  * Get/clear the channel statistics.
  138  */
  139 #define SERIAL_GETSTAT          _IOR ('x', 3, struct serial_statistics)
  140 #define SERIAL_GETESTAT         _IOR ('x', 3, struct e1_statistics)
  141 #define SERIAL_GETE3STAT        _IOR ('x', 3, struct e3_statistics)
  142 #define SERIAL_CLRSTAT          _IO  ('x', 3)
  143 
  144 /*
  145  * Query/set the synchronization mode and baud rate.
  146  * If baud==0 then the external clock is used.
  147  */
  148 #define SERIAL_GETBAUD          _IOR ('x', 4, long)
  149 #define SERIAL_SETBAUD          _IOW ('x', 4, long)
  150 
  151 /*
  152  * Query/set the internal loopback mode,
  153  * useful for debugging purposes.
  154  */
  155 #define SERIAL_GETLOOP          _IOR ('x', 5, int)
  156 #define SERIAL_SETLOOP          _IOW ('x', 5, int)
  157 
  158 /*
  159  * Query/set the DPLL mode, commonly used with NRZI
  160  * for channels lacking synchro signals.
  161  */
  162 #define SERIAL_GETDPLL          _IOR ('x', 6, int)
  163 #define SERIAL_SETDPLL          _IOW ('x', 6, int)
  164 
  165 /*
  166  * Query/set the NRZI encoding (default is NRZ).
  167  */
  168 #define SERIAL_GETNRZI          _IOR ('x', 7, int)
  169 #define SERIAL_SETNRZI          _IOW ('x', 7, int)
  170 
  171 /*
  172  * Invert receive and transmit clock.
  173  */
  174 #define SERIAL_GETINVCLK        _IOR ('x', 8, int)
  175 #define SERIAL_SETINVCLK        _IOW ('x', 8, int)
  176 
  177 /*
  178  * Query/set the E1/G703 synchronization mode.
  179  */
  180 #define SERIAL_GETCLK           _IOR ('x', 9, int)
  181 #define SERIAL_SETCLK           _IOW ('x', 9, int)
  182 
  183 #define E1CLK_RECOVERY          -1
  184 #define E1CLK_INTERNAL          0
  185 #define E1CLK_RECEIVE           1
  186 #define E1CLK_RECEIVE_CHAN0     2
  187 #define E1CLK_RECEIVE_CHAN1     3
  188 #define E1CLK_RECEIVE_CHAN2     4
  189 #define E1CLK_RECEIVE_CHAN3     5
  190 
  191 /*
  192  * Query/set the E1 timeslot mask.
  193  */
  194 #define SERIAL_GETTIMESLOTS     _IOR ('x', 10, long)
  195 #define SERIAL_SETTIMESLOTS     _IOW ('x', 10, long)
  196 
  197 /*
  198  * Query/set the E1 subchannel timeslot mask.
  199  */
  200 #define SERIAL_GETSUBCHAN       _IOR ('x', 11, long)
  201 #define SERIAL_SETSUBCHAN       _IOW ('x', 11, long)
  202 
  203 /*
  204  * Query/set the high input sensitivity mode (E1).
  205  */
  206 #define SERIAL_GETHIGAIN        _IOR ('x', 12, int)
  207 #define SERIAL_SETHIGAIN        _IOW ('x', 12, int)
  208 
  209 /*
  210  * Query the input signal level in santibells.
  211  */
  212 #define SERIAL_GETLEVEL         _IOR ('x', 13, int)
  213 
  214 /*
  215  * Get the channel name.
  216  */
  217 #define SERIAL_GETNAME          _IOR ('x', 14, char [32])
  218 
  219 /*
  220  * Get version string.
  221  */
  222 #define SERIAL_GETVERSIONSTRING _IOR ('x', 15, char [256])
  223 
  224 /*
  225  * Query/set master channel.
  226  */
  227 #define SERIAL_GETMASTER        _IOR ('x', 16, char [16])
  228 #define SERIAL_SETMASTER        _IOW ('x', 16, char [16])
  229 
  230 /*
  231  * Query/set keepalive.
  232  */
  233 #define SERIAL_GETKEEPALIVE     _IOR ('x', 17, int)
  234 #define SERIAL_SETKEEPALIVE     _IOW ('x', 17, int)
  235 
  236 /*
  237  * Query/set E1 configuration.
  238  */
  239 #define SERIAL_GETCFG           _IOR ('x', 18, char)
  240 #define SERIAL_SETCFG           _IOW ('x', 18, char)
  241 
  242 /*
  243  * Query/set debug.
  244  */
  245 #define SERIAL_GETDEBUG         _IOR ('x', 19, int)
  246 #define SERIAL_SETDEBUG         _IOW ('x', 19, int)
  247 
  248 /*
  249  * Query/set phony mode (E1).
  250  */
  251 #define SERIAL_GETPHONY         _IOR ('x', 20, int)
  252 #define SERIAL_SETPHONY         _IOW ('x', 20, int)
  253 
  254 /*
  255  * Query/set timeslot 16 usage mode (E1).
  256  */
  257 #define SERIAL_GETUSE16         _IOR ('x', 21, int)
  258 #define SERIAL_SETUSE16         _IOW ('x', 21, int)
  259 
  260 /*
  261  * Query/set crc4 mode (E1).
  262  */
  263 #define SERIAL_GETCRC4          _IOR ('x', 22, int)
  264 #define SERIAL_SETCRC4          _IOW ('x', 22, int)
  265 
  266 /*
  267  * Query/set the timeout to recover after transmit interrupt loss.
  268  * If timo==0 recover will be disabled.
  269  */
  270 #define SERIAL_GETTIMO          _IOR ('x', 23, long)
  271 #define SERIAL_SETTIMO          _IOW ('x', 23, long)
  272 
  273 /*
  274  * Query/set port type for old models of Sigma
  275  * -1 Fixed or cable select
  276  * 0  RS-232
  277  * 1  V35
  278  * 2  RS-449
  279  * 3  E1        (only for Windows 2000)
  280  * 4  G.703     (only for Windows 2000)
  281  * 5  DATA      (only for Windows 2000)
  282  * 6  E3        (only for Windows 2000)
  283  * 7  T3        (only for Windows 2000)
  284  * 8  STS1      (only for Windows 2000)
  285  */
  286 #define SERIAL_GETPORT          _IOR ('x', 25, int)
  287 #define SERIAL_SETPORT          _IOW ('x', 25, int)
  288 
  289 /*
  290  * Add the virtual channel DLCI (Frame Relay).
  291  */
  292 #define SERIAL_ADDDLCI          _IOW ('x', 26, int)
  293 
  294 /*
  295  * Invert receive clock.
  296  */
  297 #define SERIAL_GETINVRCLK       _IOR ('x', 27, int)
  298 #define SERIAL_SETINVRCLK       _IOW ('x', 27, int)
  299 
  300 /*
  301  * Invert transmit clock.
  302  */
  303 #define SERIAL_GETINVTCLK       _IOR ('x', 28, int)
  304 #define SERIAL_SETINVTCLK       _IOW ('x', 28, int)
  305 
  306 /*
  307  * Unframed E1 mode.
  308  */
  309 #define SERIAL_GETUNFRAM        _IOR ('x', 29, int)
  310 #define SERIAL_SETUNFRAM        _IOW ('x', 29, int)
  311 
  312 /*
  313  * E1 monitoring mode.
  314  */
  315 #define SERIAL_GETMONITOR       _IOR ('x', 30, int)
  316 #define SERIAL_SETMONITOR       _IOW ('x', 30, int)
  317 
  318 /*
  319  * Interrupt number.
  320  */
  321 #define SERIAL_GETIRQ           _IOR ('x', 31, int)
  322 
  323 /*
  324  * Reset.
  325  */
  326 #define SERIAL_RESET            _IO ('x', 32)
  327 
  328 /*
  329  * Hard reset.
  330  */
  331 #define SERIAL_HARDRESET        _IO ('x', 33)
  332 
  333 /*
  334  * Query cable type.
  335  */
  336 #define SERIAL_GETCABLE         _IOR ('x', 34, int)
  337 
  338 /*
  339  * Assignment of HDLC ports to E1 channels.
  340  */
  341 #define SERIAL_GETDIR           _IOR ('x', 35, int)
  342 #define SERIAL_SETDIR           _IOW ('x', 35, int)
  343 
  344 struct dxc_table {                      /* cross-connector parameters */
  345         unsigned char ts [32];          /* timeslot number */
  346         unsigned char link [32];        /* E1 link number */
  347 };
  348 
  349 /*
  350  * DXC cross-connector settings for E1 channels.
  351  */
  352 #define SERIAL_GETDXC           _IOR ('x', 36, struct dxc_table)
  353 #define SERIAL_SETDXC           _IOW ('x', 36, struct dxc_table)
  354 
  355 /*
  356  * Scrambler for G.703.
  357  */
  358 #define SERIAL_GETSCRAMBLER     _IOR ('x', 37, int)
  359 #define SERIAL_SETSCRAMBLER     _IOW ('x', 37, int)
  360 
  361 /*
  362  * Length of cable for T3 and STS-1.
  363  */
  364 #define SERIAL_GETCABLEN        _IOR ('x', 38, int)
  365 #define SERIAL_SETCABLEN        _IOW ('x', 38, int)
  366 
  367 /*
  368  * Remote loopback for E3, T3 and STS-1.
  369  */
  370 #define SERIAL_GETRLOOP         _IOR ('x', 39, int)
  371 #define SERIAL_SETRLOOP         _IOW ('x', 39, int)
  372 
  373 /*
  374  * G.703 line code
  375  */
  376 #define SERIAL_GETLCODE         _IOR ('x', 40, int)
  377 #define SERIAL_SETLCODE         _IOW ('x', 40, int)
  378 
  379 /*
  380  * MTU
  381  */
  382 #define SERIAL_GETMTU           _IOR ('x', 41, int)
  383 #define SERIAL_SETMTU           _IOW ('x', 41, int)
  384 
  385 /*
  386  * Receive Queue Length
  387  */
  388 #define SERIAL_GETRQLEN         _IOR ('x', 42, int)
  389 #define SERIAL_SETRQLEN         _IOW ('x', 42, int)
  390 
  391 #ifdef __KERNEL__
  392 #ifdef CRONYX_LYSAP
  393 #       define LYSAP_PEER_ADD           _IOWR('x', 101, lysap_peer_config_t)
  394 #       define LYSAP_PEER_REMOVE        _IOW('x', 102, unsigned)
  395 #       define LYSAP_PEER_INFO          _IOWR('x', 103, lysap_peer_info_t)
  396 #       define LYSAP_PEER_COUNT         _IOR('x', 104, unsigned)
  397 #       define LYSAP_PEER_ENUM          _IOWR('x', 105, unsigned)
  398 #       define LYSAP_PEER_CLEAR         _IOW('x', 106, unsigned)
  399 
  400 #       define LYSAP_CHAN_ADD           _IOWR('x', 111, lysap_channel_config_t)
  401 #       define LYSAP_CHAN_REMOVE        _IO('x', 112)
  402 #       define LYSAP_CHAN_INFO          _IOR('x', 113, lysap_channel_info_t)
  403 #       define LYSAP_CHAN_COUNT         _IOR('x', 114, unsigned)
  404 #       define LYSAP_CHAN_ENUM          _IOWR('x', 115, unsigned)
  405 #       define LYSAP_CHAN_CLEAR         _IO('x', 116)
  406 #       include "lysap-linux.h"
  407 #else /* CRONYX_LYSAP */
  408         typedef struct _lysap_channel_t lysap_channel_t;
  409         typedef struct _lysap_channel_config_t lysap_channel_config_t;
  410         typedef struct _LYSAP_DeviceInterfaceConfig LYSAP_DeviceInterfaceConfig;
  411         typedef struct _LYSAP_ChannelConfig LYSAP_ChannelConfig;
  412         typedef struct _lysap_buf_t lysap_buf_t;
  413 #endif /* !CRONYX_LYSAP */
  414 
  415 /*
  416  * Dynamic binder interface.
  417  */
  418 typedef struct _chan_t chan_t;
  419 typedef struct _proto_t proto_t;
  420 
  421 void binder_register_protocol (proto_t *p);
  422 void binder_unregister_protocol (proto_t *p);
  423 
  424 int binder_register_channel (chan_t *h, char *prefix, int minor);
  425 void binder_unregister_channel (chan_t *h);
  426 
  427 /*
  428  * Hardware channel driver structure.
  429  */
  430 struct sk_buff;
  431 
  432 struct _chan_t {
  433         char name [16];
  434         int mtu;                        /* max packet size */
  435         int fifosz;                     /* total hardware i/o buffer size */
  436         int port;                       /* hardware base i/o port */
  437         int irq;                        /* hardware interrupt line */
  438         int minor;                      /* minor number 0..127, assigned by binder */
  439         int debug;                      /* debug level, 0..2 */
  440         int running;                    /* running, 0..1 */
  441         struct _proto_t *proto;         /* protocol interface data */
  442         void *sw;                       /* protocol private data */
  443         void *hw;                       /* hardware layer private data */
  444 
  445         /* Interface to protocol */
  446         int (*up) (chan_t *h);
  447         void (*down) (chan_t *h);
  448         int (*transmit) (chan_t *h, struct sk_buff *skb);
  449         void (*set_dtr) (chan_t *h, int val);
  450         void (*set_rts) (chan_t *h, int val);
  451         int (*query_dtr) (chan_t *h);
  452         int (*query_rts) (chan_t *h);
  453         int (*query_dsr) (chan_t *h);
  454         int (*query_cts) (chan_t *h);
  455         int (*query_dcd) (chan_t *h);
  456 
  457         /* Interface to async protocol */
  458         void (*set_async_param) (chan_t *h, int baud, int bits, int parity,
  459                 int stop2, int ignpar, int rtscts,
  460                 int ixon, int ixany, int symstart, int symstop);
  461         void (*send_break) (chan_t *h, int msec);
  462         void (*send_xon) (chan_t *h);
  463         void (*send_xoff) (chan_t *h);
  464         void (*start_transmitter) (chan_t *h);
  465         void (*stop_transmitter) (chan_t *h);
  466         void (*flush_transmit_buffer) (chan_t *h);
  467 
  468         /* Control interface */
  469         int (*control) (chan_t *h, unsigned int cmd, unsigned long arg);
  470 
  471         /* LYSAP interface */
  472         struct lysap_t
  473         {
  474                 lysap_channel_t *link;
  475                 int (*inspect_config)(chan_t *h, lysap_channel_config_t *,
  476                         LYSAP_DeviceInterfaceConfig *, LYSAP_ChannelConfig *);
  477                 unsigned long (*probe_freq)(chan_t *h, unsigned long freq);
  478                 unsigned long (*set_freq)(chan_t *h, unsigned long freq);
  479                 unsigned (*get_status)(chan_t *h);
  480                 int (*transmit) (chan_t *h, lysap_buf_t *b);
  481                 lysap_buf_t* (*alloc_buf) (chan_t *h, unsigned len);
  482                 int (*set_clock_master)(chan_t *h, int enable);
  483                 unsigned long (*get_master_freq)(chan_t *h);
  484         } lysap;
  485 };
  486 
  487 /*
  488  * Protocol driver structure.
  489  */
  490 struct _proto_t {
  491         char *name;
  492         struct _proto_t *next;
  493 
  494         /* Interface to channel */
  495         void (*receive) (chan_t *h, struct sk_buff *skb);
  496         void (*receive_error) (chan_t *h, int errcode);
  497         void (*transmit) (chan_t *h);
  498         void (*modem_event) (chan_t *h);
  499 
  500         /* Interface to binder */
  501         int (*open) (chan_t *h);
  502         void (*close) (chan_t *h);
  503         int (*read) (chan_t *h, unsigned short flg, char *buf, int len);
  504         int (*write) (chan_t *h, unsigned short flg, const char *buf, int len);
  505         int (*select) (chan_t *h, int type, void *st, struct file *filp);
  506         struct fasync_struct *fasync;
  507 
  508         /* Control interface */
  509         int (*attach) (chan_t *h);
  510         int (*detach) (chan_t *h);
  511         int (*control) (chan_t *h, unsigned int cmd, unsigned long arg);
  512 
  513         /* LYSAP interface */
  514         void (*transmit_error) (chan_t *h, int errcode);
  515         void (*lysap_notify_receive) (chan_t *h, lysap_buf_t *b);
  516         void (*lysap_notify_transmit) (chan_t *h);
  517         lysap_buf_t* (*lysap_get_data)(chan_t *h);
  518 };
  519 #endif /* KERNEL */

Cache object: a09fcdcae31c8f99ab767c317f9b8829


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.