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/i4b/include/i4b_global.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  * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
    3  *
    4  * Redistribution and use in source and binary forms, with or without
    5  * modification, are permitted provided that the following conditions
    6  * are met:
    7  * 1. Redistributions of source code must retain the above copyright
    8  *    notice, this list of conditions and the following disclaimer.
    9  * 2. Redistributions in binary form must reproduce the above copyright
   10  *    notice, this list of conditions and the following disclaimer in the
   11  *    documentation and/or other materials provided with the distribution.
   12  *
   13  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   14  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   16  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   17  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   18  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   19  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   20  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   21  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   22  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   23  * SUCH DAMAGE.
   24  *
   25  *---------------------------------------------------------------------------
   26  *
   27  *      i4b_global.h - i4b global include file
   28  *      --------------------------------------
   29  *
   30  * $FreeBSD$
   31  *
   32  *      last edit-date: [Sun Jul  7 12:11:35 2002]
   33  *
   34  *---------------------------------------------------------------------------*/
   35 
   36 #ifndef _I4B_GLOBAL_H_
   37 #define _I4B_GLOBAL_H_
   38 
   39 /*---------------------------------------------------------------------------*
   40  *      hiding OS differences in the kernel
   41  *---------------------------------------------------------------------------*/ 
   42 
   43 /*-------------------------------------------------*/
   44 /* hide SMP changes in FreeBSD 5.x-current for 4.x */
   45 /*-------------------------------------------------*/
   46 
   47 #if defined(__FreeBSD__) && __FreeBSD__ <= 4
   48 
   49 #define IF_LOCK(a)
   50 #define IF_UNLOCK(a)
   51 
   52 #ifndef _IF_QFULL
   53 #define _IF_QFULL(a)            IF_QFULL((a))
   54 #endif
   55 
   56 #define _IF_ENQUEUE(a, b)       IF_ENQUEUE((a), (b))
   57 #define _IF_DEQUEUE(a, b)       IF_DEQUEUE((a), (b))
   58 #define _IF_PREPEND(a, b)       IF_PREPEND((a), (b))
   59 
   60 /* get back DELAY() */
   61 
   62 #include <machine/clock.h>
   63 
   64 #endif
   65 
   66 #if defined(__FreeBSD__) && __FreeBSD__ >= 5
   67 /*
   68  * Deprecated LKM interface.
   69  */
   70 #include <sys/module.h>
   71 #define PSEUDO_SET(sym, name) \
   72         static int name ## _modevent(module_t mod, int type, void *data) \
   73         { \
   74                 void (*initfunc)(void *) = (void (*)(void *))data; \
   75                 switch (type) { \
   76                 case MOD_LOAD: \
   77                         /* printf(#name " module load\n"); */ \
   78                         initfunc(NULL); \
   79                         break; \
   80                 case MOD_UNLOAD: \
   81                         printf(#name " module unload - not possible for this module type\n"); \
   82                         return EINVAL; \
   83                 } \
   84                 return 0; \
   85         } \
   86         static moduledata_t name ## _mod = { \
   87                 #name, \
   88                 name ## _modevent, \
   89                 (void *)sym \
   90         }; \
   91         DECLARE_MODULE(name, name ## _mod, SI_SUB_PSEUDO, SI_ORDER_ANY)
   92 #endif
   93 
   94 /*---------------*/
   95 /* time handling */
   96 /*---------------*/
   97 
   98 #ifdef __FreeBSD__
   99 #include <sys/param.h>
  100 
  101 #if defined(__FreeBSD_version) && __FreeBSD_version >= 400000 && __FreeBSD_version < 400011
  102 #error "Unsupported FreeBSD-current version,"
  103 #error "you need a FreeBSD-current >= 400011"
  104 #endif
  105 
  106 #if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
  107 
  108 #define TIMEOUT_FUNC_T  timeout_t *
  109 #define SECOND          time_second
  110 #define MICROTIME(x)    getmicrotime(&(x))
  111 
  112 #else /* FreeBSD < 3 */
  113 
  114 #define TIMEOUT_FUNC_T  timeout_func_t
  115 #define SECOND          time.tv_sec
  116 #define MICROTIME(x)    microtime(&(x))
  117 
  118 #endif /* >= 3 */
  119 #endif /* __FreeBSD__ */
  120 
  121 #if defined(__NetBSD__) || defined (__OpenBSD__) || defined(__bsdi__)
  122 
  123 #define TIMEOUT_FUNC_T  void *
  124 #define SECOND          time.tv_sec
  125 #define MICROTIME(x)    (x) = time
  126 
  127 #endif /* __NetBSD__ */
  128 
  129 /*----------------*/
  130 /* timer handling */
  131 /*----------------*/
  132 
  133 #if defined(__NetBSD__)
  134 
  135 #if __NetBSD_Version__ >= 104230000
  136 #define START_TIMER(XHANDLE, XF, XSC, XTIME) callout_reset(&XHANDLE, XTIME, (TIMEOUT_FUNC_T)XF, (void*)XSC)
  137 #define STOP_TIMER(XHANDLE, XF, XSC) callout_stop(&XHANDLE)
  138 #else
  139 #define START_TIMER(XHANDLE, XF, XSC, XTIME) timeout((TIMEOUT_FUNC_T)XF, (void*)XSC, XTIME)
  140 #define STOP_TIMER(XHANDLE, XF, XSC)    untimeout((TIMEOUT_FUNC_T)XF, (void*)XSC)
  141 #endif
  142 
  143 #else
  144 #define START_TIMER(XHANDLE, XF, XSC, XTIME) XHANDLE = timeout((TIMEOUT_FUNC_T)XF, (void*)XSC, XTIME)
  145 #ifdef __FreeBSD__
  146 #define STOP_TIMER(XHANDLE, XF, XSC)    untimeout((TIMEOUT_FUNC_T)XF, (void*)XSC, XHANDLE)
  147 #else
  148 #define STOP_TIMER(XHANDLE, XF, XSC)    untimeout((TIMEOUT_FUNC_T)XF, (void*)XSC)
  149 #endif
  150 #endif
  151 
  152 /*----------------------*/
  153 /* poll/select handling */
  154 /*----------------------*/
  155 
  156 #if (defined(__FreeBSD__) && \
  157         (!defined(__FreeBSD_version) || (__FreeBSD_version < 300001))) \
  158                 || defined (__OpenBSD__) || defined(__bsdi__)
  159 #define OS_USES_SELECT
  160 #else
  161 #define OS_USES_POLL
  162 #endif
  163 
  164 /*---------------------------------------------------------------------------*
  165  *      misc globally used things in the kernel
  166  *---------------------------------------------------------------------------*/ 
  167 
  168 /* timer states */
  169 
  170 #define TIMER_IDLE      1               /* a timer is running   */
  171 #define TIMER_ACTIVE    2               /* a timer is idle      */
  172 
  173 /* i4b's spl */
  174 
  175 #define SPLI4B()        splimp()        /* spl for i4b          */
  176 
  177 /* critial code region handling macros */
  178 
  179 #define CRIT_VAR        int _svd_spl_   /* declare variable     */
  180 #define CRIT_BEG        _svd_spl_ = SPLI4B()    /* save spl     */
  181 #define CRIT_END        splx(_svd_spl_) /* restore spl          */
  182 
  183 /* definitions for the STATUS indications L1 -> L2 -> L3 */
  184 
  185 #define STI_ATTACH      0       /* attach at boot time                  */
  186 #define STI_L1STAT      1       /* layer 1 status                       */
  187 #define STI_L2STAT      2       /* layer 2 status                       */
  188 #define STI_TEIASG      3       /* TEI assignments                      */
  189 #define STI_PDEACT      4       /* Layer 1 T4 expired = persistent deactivation */
  190 #define STI_NOL1ACC     5       /* no outgoing L1 access possible       */
  191 
  192 /* definitions for the COMMAND requests L3 -> L2 -> L1 */
  193 
  194 #define CMR_DOPEN       0       /* daemon opened /dev/i4b               */
  195 #define CMR_DCLOSE      1       /* daemon closed /dev/i4b               */
  196 #define CMR_SETTRACE    2       /* set D-channel and B-channel trace    */
  197 #define CMR_GCST        3       /* get chipset statistics               */
  198 #define CMR_CCST        4       /* clear chipset statistics             */
  199 
  200 #endif /* _I4B_GLOBAL_H_ */

Cache object: 04d81acd0899bdf9dcb0a1cdfb913403


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