/*****************************************************************************

 @(#) sdti_ioctl.h,v 0.7 2000/11/15 10:53:30 brian Exp

 -----------------------------------------------------------------------------

     Copyright (C) 2000  Brian Bidulock.  All Rights Reserved.


                                  PUBLIC LICENSE

     This license is provided without fee, provided that the above copy-
     right notice and this public license must be retained on all copies,
     extracts, compilations and derivative works.  Use or distribution of
     this work in a manner that restricts its use except as provided here
     will render this license void.

     The author(s) hereby waive any and all other restrictions in respect
     of their copyright in this software and its associated documentation.
     The authors(s) of this software place in the public domain any novel
     methods or processes which are embodied in this software.

     The author(s) undertook to write it for the sake of the advancement
     of the Arts and Sciences, but it is provided as is, and the author(s)
     will not take any responsibility in it.

 -----------------------------------------------------------------------------

 Last Modified 2000/11/15 10:53:30 by brian

 sdti_ioctl.h,v
 Revision 0.7  2000/11/15 10:53:30  brian
 Added sdti files.

 *****************************************************************************/

#ident @(#) sdti_ioctl.h,v 0.7 2000/11/15 10:53:30 brian Exp

#ifndef __SDTI_IOCTL_H__
#define __SDTI_IOCTL_H__

#include <linux/ioctl.h>

/*
 *  This file is rather Linux specific for new.  Linux encodes direction and
 *  sizer in upper 16 bits of 32 bit ioctl command.  This should make
 *  transparent ioctl in STREAMS easier for Linux (i.e., all transparent
 *  ioctls could be converted to I_STR types because size is known).
 *
 *  If using SVR4.2, perhaps these macros should be redefined to something
 *  which does not accept size and transparent ioctls would have to be
 *  provided for in the STREAMS code anyways.  They it would work either way.
 *
 *  Following defines should do the job...
 *
 *  #define _IO(magic,nr)        ((magic<<8)+nr)
 *  #define _IOR(magic,nr,size)  ((magic<<8)+nr)
 *  #define _IOW(magic,nr,size)  ((magic<<8)+nr)
 *  #define _IOWR(magic,nr,size) ((magic<<8)+nr)
 */

#define SDT_IOC_MAGIC 't'
#define SDT_IOCRESET        _IO(  SDT_IOC_MAGIC,  0 )

#define SDT_IOCSIFMODE      _IO(  SDT_IOC_MAGIC,  1 )
#define SDT_IOCGIFMODE      _IO(  SDT_IOC_MAGIC,  2 )

#   define SDT_MODE_DCE     0   /* for V.35 interface, DCE mode              */
#   define SDT_MODE_DTE     1   /* for V.35 interface, DTE mode              */
#   define SDT_MODE_LOOP    2   /* for V.35 interface, remote loopback       */
#   define SDT_MODE_JACK    3   /* for V.35 interface, loopback jack         */
#   define SDT_MODE_ECHO    4   /* for V.35 interface, local loopback        */
#   define SDT_MODE_TEST    5   /* for V.35 interface, local/remote loopback */

#define SDT_IOCSIFCLOCK     _IO(  SDT_IOC_MAGIC,  3 )
#define SDT_IOCGIFCLOCK     _IO(  SDT_IOC_MAGIC,  4 )

#   define SDT_CLOCK_EXT    0   /* for V.35 interface, external clock       */
#   define SDT_CLOCK_INT    1   /* for V.35 interface, internal clock       */
#   define SDT_CLOCK_DPLL   2   /* for V.35 interface, phase lock loop      */
#   define SDT_CLOCK_SLAVE  4   /* for E1/T1/J1 interface, external clock   */
#   define SDT_CLOCK_MASTER 5   /* for E1/T1/J1 interface, internal clock   */
#   define SDT_CLOCK_LOOP   6   /* for E1/T1/J1 interface, phase lock loop  */

#define SDT_IOCSIFLEAD      _IO(  SDT_IOC_MAGIC,  5 )
#define SDT_IOCGIFLEAD      _IO(  SDT_IOC_MAGIC,  6 )

#   define SDT_LEAD_DTR     0x01 /* for V.35 interface, set or clear DTR lead */
#   define SDT_LEAD_RTS     0x02 /* for V.35 interface, set or clear RTS lead */
#   define SDT_LEAD_DCD     0x04 /* for V.35 interface, get DCD lead */
#   define SDT_LEAD_CTS     0x08 /* for V.35 interface, get CTS lead */
#   define SDT_LEAD_DSR     0x10 /* for V.35 interface, get DSR lead */

#define SDT_IOCCBRKTXLINE   _IO(  SDT_IOC_MAGIC,  7 ) /* for automated testing only */
#define SDT_IOCCCONTXLINE   _IO(  SDT_IOC_MAGIC,  8 ) /* for automated testing only */

#define SDT_IOCCIFSTATS     _IO(  SDT_IOC_MAGIC,  9 ) /* clear statistics */
#define SDT_IOCSIFSTATSP    _IO(  SDT_IOC_MAGIC, 10 ) /* set stats collection period */
#define SDT_IOCGIFSTATS     _IOR( SDT_IOC_MAGIC, 11, sl_stats_t )

#define SDT_IOC_MAXNR 11

/*
 *  A note on stats:
 *
 *  The SDT_IOCCIFSTATS has one argument: the time (in ticks/jiffies) which the
 *  driver is to use to synchronize accumlators for accumulated statistics
 *  reports. All accumulated reports will be generated a time (sync + N *
 *  period), where sync is the value provided in SDT_IOCCIFSTATS and period is
 *  the value provided in SDT_IOCSIFSTATSP.  A subsequent call to
 *  SDT_IOCGIFSTATS will return the last (N) period's statistics with the value
 *  of N in the returned statistics structure.  The statistics in the
 *  structure represent the accumulated values for the last period N.  It is
 *  the responsibility of the user to collect.
 */

#endif  __SDTI_IOCTL_H__
