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/dev/ic/isic_l1.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 /* $NetBSD: isic_l1.h,v 1.18 2005/02/27 00:27:01 perry Exp $ */
    2 
    3 /*
    4  * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
    5  *
    6  * Redistribution and use in source and binary forms, with or without
    7  * modification, are permitted provided that the following conditions
    8  * are met:
    9  * 1. Redistributions of source code must retain the above copyright
   10  *    notice, this list of conditions and the following disclaimer.
   11  * 2. Redistributions in binary form must reproduce the above copyright
   12  *    notice, this list of conditions and the following disclaimer in the
   13  *    documentation and/or other materials provided with the distribution.
   14  *
   15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   25  * SUCH DAMAGE.
   26  *
   27  */
   28 
   29 #ifndef _ISIC_L1_H
   30 #define _ISIC_L1_H
   31 
   32 #include <netisdn/i4b_l3l4.h>
   33 
   34 /*---------------------------------------------------------------------------
   35  *      kernel config file flags definition
   36  *---------------------------------------------------------------------------*/
   37 #define FLAG_TELES_S0_8         1
   38 #define FLAG_TELES_S0_16        2
   39 #define FLAG_TELES_S0_163       3
   40 #define FLAG_AVM_A1             4
   41 #define FLAG_TELES_S0_163_PnP   5
   42 #define FLAG_CREATIX_S0_PnP     6
   43 #define FLAG_USR_ISDN_TA_INT    7
   44 #define FLAG_DRN_NGO            8
   45 #define FLAG_SWS                9
   46 #define FLAG_AVM_A1_PCMCIA      10
   47 #define FLAG_DYNALINK           11
   48 #define FLAG_BLMASTER           12
   49 #define FLAG_ELSA_QS1P_ISA      13
   50 #define FLAG_ELSA_QS1P_PCI      14
   51 #define FLAG_SIEMENS_ITALK      15
   52 #define FLAG_ELSA_MLIMC         16
   53 #define FLAG_ELSA_MLMCALL       17
   54 #define FLAG_ITK_IX1            18
   55 #define FLAG_AVMA1PCI           19
   56 #define FLAG_ELSA_PCC16         20
   57 #define FLAG_AVM_PNP            21
   58 #define FLAG_SIEMENS_ISURF2     22
   59 #define FLAG_ASUSCOM_IPAC       23
   60 
   61 #define SEC_DELAY               1000000 /* one second DELAY for DELAY*/
   62 
   63 #define MAX_DFRAME_LEN          264     /* max length of a D frame */
   64 
   65 #ifndef __bsdi__
   66 #define min(a,b)                ((a)<(b)?(a):(b))
   67 #endif
   68 
   69 /* We try to map as few as possible as small as possible io and/or
   70    memory regions. Each card defines its own interpretation of this
   71    mapping array. At probe time we have a fixed size array, later
   72    (when the card type is known) we allocate a minimal array
   73    dynamically. */
   74 
   75 #define ISIC_MAX_IO_MAPS        49      /* no cardtype needs more yet */
   76 
   77 /* one entry in mapping array */
   78 struct isic_io_map {
   79         bus_space_tag_t t;      /* which bus-space is this? */
   80         bus_space_handle_t h;   /* handle of mapped bus space region */
   81         bus_size_t offset;      /* offset into region */
   82         bus_size_t size;        /* size of region, zero if not ours
   83                                    (i.e.: don't ever unmap it!) */
   84 };
   85 
   86 /* this is passed around at probe time (no struct isic_softc yet) */
   87 struct isic_attach_args {
   88         int ia_flags;                   /* flags from config file */
   89         int ia_num_mappings;            /* number of io mappings provided */
   90         struct isic_io_map ia_maps[ISIC_MAX_IO_MAPS];
   91 };
   92 
   93 /*---------------------------------------------------------------------------*
   94  *      isic_Bchan: the state of one B channel
   95  *---------------------------------------------------------------------------*/
   96 typedef struct
   97 {
   98         int             channel;        /* which channel is this*/
   99 
  100         u_char          hscx_mask;      /* HSCX interrupt mask  */
  101 
  102         int             bprot;          /* B channel protocol   */
  103 
  104         int             state;          /* this channels state  */
  105 #define HSCX_IDLE       0x00            /* channel idle         */
  106 #define HSCX_TX_ACTIVE  0x01            /* tx running           */
  107 
  108         /* receive data from ISDN */
  109 
  110         struct ifqueue  rx_queue;       /* receiver queue       */
  111 
  112         int             rxcount;        /* rx statistics counter*/
  113 
  114         struct  mbuf    *in_mbuf;       /* rx input buffer      */
  115         u_char          *in_cbptr;      /* curr buffer pointer  */
  116         int             in_len;         /* rx input buffer len  */
  117 
  118         /* transmit data to ISDN */
  119 
  120         struct ifqueue  tx_queue;       /* transmitter queue    */
  121 
  122         int             txcount;        /* tx statistics counter*/
  123 
  124         struct mbuf     *out_mbuf_head; /* first mbuf in possible chain */
  125         struct mbuf     *out_mbuf_cur;  /* current mbuf in possbl chain */
  126         unsigned char   *out_mbuf_cur_ptr; /* data pointer into mbuf    */
  127         int             out_mbuf_cur_len; /* remaining bytes in mbuf    */
  128 
  129         /* link between b channel and driver */
  130 
  131         isdn_link_t     isdn_linktab;           /* b channel driver data        */
  132         const struct isdn_l4_driver_functions
  133                         *l4_driver;             /* layer 4 driver               */
  134         void            *l4_driver_softc;       /* layer 4 driver instance      */
  135 
  136         /* statistics */
  137 
  138         /* RSTA */
  139 
  140         int             stat_VFR;       /* HSCX RSTA Valid FRame */
  141         int             stat_RDO;       /* HSCX RSTA Rx Data Overflow */
  142         int             stat_CRC;       /* HSCX RSTA CRC */
  143         int             stat_RAB;       /* HSCX RSTA Rx message ABorted */
  144 
  145         /* EXIR */
  146 
  147         int             stat_XDU;       /* HSCX EXIR tx data underrun */
  148         int             stat_RFO;       /* HSCX EXIR rx frame overflow */
  149 
  150 } l1_bchan_state_t;
  151 
  152 /*---------------------------------------------------------------------------*
  153  *      isic_softc: the state of the layer 1 of the D channel
  154  *---------------------------------------------------------------------------*/
  155 struct isic_softc
  156 {
  157         struct device   sc_dev;
  158         void            *sc_l3token;    /* pointer to registered L3 instance */
  159         struct l2_softc sc_l2;          /* D-channel variables */
  160 
  161         int             sc_irq;         /* interrupt vector     */
  162         int             sc_intr_valid;  /* set when card is detached or disable */
  163 #define ISIC_INTR_VALID         0       /* normal operation */
  164 #define ISIC_INTR_DISABLED      1       /* ISDN subsystem not opened */
  165 #define ISIC_INTR_DYING         2       /* card is detaching */
  166 
  167         int sc_num_mappings;            /* number of io mappings provided */
  168         struct isic_io_map *sc_maps;
  169 
  170 #define MALLOC_MAPS(sc) \
  171         (sc)->sc_maps = (struct isic_io_map*)malloc(sizeof((sc)->sc_maps[0])*(sc)->sc_num_mappings, M_DEVBUF, 0)
  172 
  173         int             sc_cardtyp;     /* only needed for some cards   */
  174 #define CARD_TYPEP_UNK          0       /* unknown                      */
  175 #define CARD_TYPEP_8            1       /* Teles, S0/8                  */
  176 #define CARD_TYPEP_16           2       /* Teles, S0/16                 */
  177 #define CARD_TYPEP_16_3         3       /* Teles, S0/16.3               */
  178 #define CARD_TYPEP_AVMA1        4       /* AVM A1 or AVM Fritz!Card     */
  179 #define CARD_TYPEP_163P         5       /* Teles, S0/16.3 PnP           */
  180 #define CARD_TYPEP_CS0P         6       /* Creatix, S0 PnP              */
  181 #define CARD_TYPEP_USRTA        7       /* US Robotics ISDN TA internal */
  182 #define CARD_TYPEP_DRNNGO       8       /* Dr. Neuhaus Niccy GO@        */
  183 #define CARD_TYPEP_SWS          9       /* Sedlbauer Win Speed          */
  184 #define CARD_TYPEP_DYNALINK     10      /* Dynalink IS64PH              */
  185 #define CARD_TYPEP_BLMASTER     11      /* ISDN Blaster / ISDN Master   */
  186 #define CARD_TYPEP_PCFRITZ      12      /* AVM PCMCIA Fritz!Card        */
  187 #define CARD_TYPEP_ELSAQS1ISA   13      /* ELSA QuickStep 1000pro ISA   */
  188 #define CARD_TYPEP_ELSAQS1PCI   14      /* ELSA QuickStep 1000pro PCI   */
  189 #define CARD_TYPEP_SIEMENSITALK 15      /* Siemens I-Talk               */
  190 #define CARD_TYPEP_ELSAMLIMC    16      /* ELSA MicroLink ISDN/MC       */
  191 #define CARD_TYPEP_ELSAMLMCALL  17      /* ELSA MicroLink MCall         */
  192 #define CARD_TYPEP_ITKIX1       18      /* ITK ix1 micro                */
  193 #define CARD_TYPEP_AVMA1PCI     19      /* AVM FRITZ!CARD PCI           */
  194 #define CARD_TYPEP_PCC16        20      /* ELSA PCC-16                  */
  195 #define CARD_TYPEP_AVM_PNP      21      /* AVM FRITZ!CARD PnP           */
  196 #define CARD_TYPEP_SIE_ISURF2   22      /* Siemens I-Surf 2 PnP         */
  197 #define CARD_TYPEP_ASUSCOMIPAC  23      /* Asuscom ISDNlink 128 K PnP   */
  198 #define CARD_TYPEP_AVMA1PCIV2   24      /* AVM FRITZ!CARD V2 PCI        */
  199 
  200         int             sc_bustyp;      /* IOM1 or IOM2         */
  201 #define BUS_TYPE_IOM1  0x01
  202 #define BUS_TYPE_IOM2  0x02
  203 
  204         int             sc_trace;       /* output protocol data for tracing */
  205         unsigned int    sc_trace_dcount;/* d channel trace frame counter */
  206         unsigned int    sc_trace_bcount;/* b channel trace frame counter */
  207 
  208         int             sc_state;       /* ISAC state flag      */
  209 #define ISAC_IDLE       0x00            /* state = idle */
  210 #define ISAC_TX_ACTIVE  0x01            /* state = transmitter active */
  211 
  212         int             sc_init_tries;  /* no of out tries to access S0 */
  213         int             sc_maddr;       /* some stupid ISA cards need this */
  214 
  215         u_char          sc_isac_mask;   /* ISAC IRQ mask        */
  216 #define ISAC_IMASK      (sc->sc_isac_mask)
  217 
  218         l1_bchan_state_t        sc_chan[2];     /* B-channel state      */
  219 #define HSCX_A_BASE     (sc->sc_chan[0].hscx)
  220 #define HSCX_A_IMASK    (sc->sc_chan[0].hscx_mask)
  221 #define HSCX_B_BASE     (sc->sc_chan[1].hscx)
  222 #define HSCX_B_IMASK    (sc->sc_chan[1].hscx_mask)
  223 
  224         struct mbuf     *sc_ibuf;       /* input buffer mgmt    */
  225         u_short         sc_ilen;
  226         u_char          *sc_ib;
  227                                         /* this is for the irq TX routine */
  228         struct mbuf     *sc_obuf;       /* pointer to an mbuf with TX frame */
  229         u_char          *sc_op;         /* ptr to next chunk of frame to tx */
  230         int             sc_ol;          /* length of remaining frame to tx */
  231         int             sc_freeflag;    /* m_freem mbuf if set */
  232 
  233         struct mbuf     *sc_obuf2;      /* pointer to an mbuf with TX frame */
  234         int             sc_freeflag2;   /* m_freem mbuf if set */
  235 
  236         int             sc_isac_version;        /* version number of ISAC */
  237         int             sc_hscx_version;        /* version number of HSCX */
  238         int             sc_ipac_version;        /* version number of IPAC */
  239 
  240         int             sc_I430state;   /* I.430 state F3 .... F8 */
  241 
  242         int             sc_I430T3;      /* I.430 Timer T3 running */
  243         struct callout sc_T3_callout;
  244 
  245         int             sc_I430T4;      /* Timer T4 running */
  246         struct callout sc_T4_callout;
  247 
  248         int             sc_driver_specific;     /* used for LED values */
  249         struct callout  sc_driver_callout;      /* used for LED timer */
  250 
  251         /*
  252          * byte fields for the AVM Fritz!Card PCI. These are packed into
  253          * a u_int in the driver.
  254          */
  255         u_char          avma1pp_cmd;
  256         u_char          avma1pp_txl;
  257         u_char          avma1pp_prot;
  258 
  259         int             sc_ipac;        /* flag, running on ipac */
  260         int             sc_bfifolen;    /* length of b channel fifos */
  261 
  262 #define ISIC_WHAT_ISAC  0
  263 #define ISIC_WHAT_HSCXA 1
  264 #define ISIC_WHAT_HSCXB 2
  265 #define ISIC_WHAT_IPAC  3
  266 
  267         u_int8_t        (*readreg)(struct isic_softc *, int, bus_size_t);
  268         void            (*writereg)(struct isic_softc *, int, bus_size_t, u_int8_t);
  269         void            (*readfifo)(struct isic_softc *, int, void *, size_t);
  270         void            (*writefifo)(struct isic_softc *, int what,
  271                             const void *, size_t);
  272         void            (*clearirq)(struct isic_softc *);
  273 
  274         void            (*drv_command)(struct isic_softc *, int, void *);
  275 
  276 #define ISAC_READ(r)            (*sc->readreg)(sc, ISIC_WHAT_ISAC, (r))
  277 #define ISAC_WRITE(r,v)         (*sc->writereg)(sc, ISIC_WHAT_ISAC, (r), (v))
  278 #define ISAC_RDFIFO(b,s)        (*sc->readfifo)(sc, ISIC_WHAT_ISAC, (b), (s))
  279 #define ISAC_WRFIFO(b,s)        (*sc->writefifo)(sc, ISIC_WHAT_ISAC, (b), (s))
  280 
  281 #define HSCX_READ(n,r)          (*sc->readreg)(sc, ISIC_WHAT_HSCXA+(n), (r))
  282 #define HSCX_WRITE(n,r,v)       (*sc->writereg)(sc, ISIC_WHAT_HSCXA+(n), (r), (v))
  283 #define HSCX_RDFIFO(n,b,s)      (*sc->readfifo)(sc, ISIC_WHAT_HSCXA+(n), (b), (s))
  284 #define HSCX_WRFIFO(n,b,s)      (*sc->writefifo)(sc, ISIC_WHAT_HSCXA+(n), (b), (s))
  285 
  286 #define IPAC_READ(r)            (*sc->readreg)(sc, ISIC_WHAT_IPAC, (r))
  287 #define IPAC_WRITE(r, v)        (*sc->writereg)(sc, ISIC_WHAT_IPAC, (r), (v))
  288 
  289 };
  290 
  291 /*---------------------------------------------------------------------------*
  292  *      possible I.430/ISAC states
  293  *---------------------------------------------------------------------------*/
  294 enum I430states {
  295         ST_F3,          /* F3 Deactivated       */
  296         ST_F4,          /* F4 Awaiting Signal   */
  297         ST_F5,          /* F5 Identifying Input */
  298         ST_F6,          /* F6 Synchronized      */
  299         ST_F7,          /* F7 Activated         */
  300         ST_F8,          /* F8 Lost Framing      */
  301         ST_ILL,         /* Illegal State        */
  302         N_STATES
  303 };
  304 
  305 /*---------------------------------------------------------------------------*
  306  *      possible I.430/ISAC events
  307  *---------------------------------------------------------------------------*/
  308 enum I430events {
  309         EV_PHAR,        /* PH ACTIVATE REQUEST          */
  310         EV_T3,          /* Timer 3 expired              */
  311         EV_INFO0,       /* receiving INFO0              */
  312         EV_RSY,         /* receiving any signal         */
  313         EV_INFO2,       /* receiving INFO2              */
  314         EV_INFO48,      /* receiving INFO4 pri 8/9      */
  315         EV_INFO410,     /* receiving INFO4 pri 10/11    */
  316         EV_DR,          /* Deactivate Request           */
  317         EV_PU,          /* Power UP                     */
  318         EV_DIS,         /* Disconnected (only 2085)     */
  319         EV_EI,          /* Error Indication             */
  320         EV_ILL,         /* Illegal Event                */
  321         N_EVENTS
  322 };
  323 
  324 enum I430commands {
  325         CMD_TIM,        /*      Timing                          */
  326         CMD_RS,         /*      Reset                           */
  327         CMD_AR8,        /*      Activation request pri 8        */
  328         CMD_AR10,       /*      Activation request pri 10       */
  329         CMD_DIU,        /*      Deactivate Indication Upstream  */
  330         CMD_ILL         /*      Illegal command                 */
  331 };
  332 
  333 #define N_COMMANDS CMD_ILL
  334 
  335 extern void isic_recover(struct isic_softc *);
  336 extern int isicintr(void *);
  337 extern int isicprobe(struct isic_attach_args *);
  338 extern int isic_attach_avma1(struct isic_softc *);
  339 extern int isic_attach_s016(struct isic_softc *);
  340 extern int isic_attach_s0163(struct isic_softc *);
  341 extern int isic_attach_s08(struct isic_softc *);
  342 extern int isic_attach_usrtai(struct isic_softc *);
  343 extern int isic_attach_itkix1(struct isic_softc *);
  344 extern void isic_bchannel_setup(void *, int, int, int);
  345 extern void isic_hscx_init(struct isic_softc *, int, int);
  346 extern void isic_hscx_irq(struct isic_softc *, u_char ista, int, u_char);
  347 extern void isic_hscx_cmd( struct isic_softc *, int, unsigned char);
  348 extern void isic_hscx_waitxfw( struct isic_softc *, int);
  349 extern void isic_init_linktab(struct isic_softc *);
  350 extern int isic_isac_init(struct isic_softc *);
  351 extern void isic_isac_irq(struct isic_softc *, int);
  352 extern void isic_isac_l1_cmd(struct isic_softc *, int);
  353 extern void isic_next_state(struct isic_softc *, int);
  354 extern char * isic_printstate(struct isic_softc *);
  355 extern int isic_probe_avma1(struct isic_attach_args *);
  356 extern int isic_probe_s016(struct isic_attach_args *);
  357 extern int isic_probe_s0163(struct isic_attach_args *);
  358 extern int isic_probe_s08(struct isic_attach_args *ia);
  359 extern int isic_probe_usrtai(struct isic_attach_args *ia);
  360 extern int isic_probe_itkix1(struct isic_attach_args *ia);
  361 extern int isic_attach_bri(struct isic_softc *sc, const char *cardname, const struct isdn_layer1_isdnif_driver *dchan_driver);
  362 extern int isic_detach_bri(struct isic_softc *sc);
  363 
  364 extern void isic_isacsx_disable_intr(struct isic_softc *sc);
  365 extern void isic_isacsx_recover(struct isic_softc *sc);
  366 extern void isic_isacsx_irq(struct isic_softc *sc, int r);
  367 extern void isic_isacsx_l1_cmd(struct isic_softc *sc, int command);
  368 extern int isic_isacsx_init(struct isic_softc *sc);
  369 
  370 #endif /* !_ISIC_L1_H */
  371 

Cache object: 36fa555a34e9683b95bfc4be44e32949


[ 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.