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/mips/include/defs.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) 1996, 2001-2003, 2005, Juniper Networks, Inc.
    3  * All rights reserved.
    4  *
    5  * defs.h -- Simple universal types and definitions for use by the microkernel
    6  * Jim Hayes, November 1996
    7  *
    8  *      JNPR: defs.h,v 1.3.2.1 2007/09/10 08:16:32 girish
    9  * $FreeBSD: releng/8.0/sys/mips/include/defs.h 178172 2008-04-13 07:27:37Z imp $
   10  */
   11 
   12 #ifndef __DEFS_H__
   13 #define __DEFS_H__
   14 
   15 /*
   16  * Paranoid compilation. If defined, the PARANOID flag will enable asserts,
   17  * data structure magic stamping and a suite of other debug tools. To disable
   18  * it, comment out its definition.
   19  */
   20 #define PARANOID
   21 
   22 /*
   23  * This is the ONLY place you should see hardware specific information
   24  * encoded as #ifdefs. (Well, except for stdarg.h, perhaps.)
   25  * I apologize in advance!
   26  */
   27 #include <machine/defs_mips.h>
   28 #define CPU_GOT_ONE
   29 
   30 #if !defined(CPU_GOT_ONE)
   31 #error "YOU NEED TO SPECIFY ONE CPU TYPE TO USE THIS FILE"
   32 #endif
   33 
   34 #ifdef  TRUE
   35 #undef  TRUE
   36 #endif
   37 
   38 #ifdef  FALSE
   39 #undef  FALSE
   40 #endif
   41 
   42 typedef enum boolean_
   43 {
   44         FALSE = 0,
   45         TRUE = 1
   46 } boolean;
   47 
   48 /*
   49  * Make NULL a pointer within the microkernel environment to catch
   50  * pointer semantic miscreants.
   51  *
   52  * The reason it's conditional here is that some of the BSD includes
   53  * define it multiple times as a straight integer and GCC barfs on
   54  * the alternative prototypes.
   55  */
   56 
   57 #ifndef NULL
   58 #define NULL (void *)0
   59 #endif
   60 
   61 /*
   62  * Define some standard sized types.  (Defined in cpu-specific type files
   63  * included above.)
   64  */
   65 
   66 #define MAX_U8  255
   67 #define MAX_S8  128
   68 #define MIN_S8 -127
   69 
   70 #define MAX_U16  0xffff
   71 #define MIN_S16  ((int16_t)(1 << 15))
   72 #define MAX_S16  ((int16_t)~MIN_S16)
   73 
   74 #define MAX_U32  0xffffffff
   75 #define MIN_S32  ((int32_t)(1 << 31))
   76 #define MAX_S32  ((int32_t)~MIN_S32)
   77 
   78 #define MAX_U64  ((u_int64_t)0 - 1)
   79 #define MAX_S64  ((int64_t)(MAX_U64 >> 1))
   80 #define MIN_S64  (-MAX_S64-1)
   81 
   82 /*
   83  * Solaris uses _SIZE_T to mark the fact that "size_t" has already
   84  * been defined.  _SYS_TYPES_H_ is used by BSD.
   85  * 
   86  */
   87 #if !defined(_SYS_TYPES_H_) && !defined(_SIZE_T)
   88 typedef UNSIGNED_32  size_t;
   89 #define _SIZE_T
   90 #endif
   91 
   92 #if !defined(_SYS_TYPES_H_)
   93 typedef char *          caddr_t;
   94 
   95 typedef UNSIGNED_8      u_int8_t;
   96 typedef SIGNED_8        int8_t;
   97 
   98 typedef UNSIGNED_16     u_int16_t;
   99 typedef SIGNED_16       int16_t;
  100 
  101 typedef UNSIGNED_32     u_int32_t;
  102 typedef SIGNED_32       int32_t;
  103 
  104 typedef UNSIGNED_64     u_int64_t;
  105 typedef SIGNED_64       int64_t;
  106 
  107 typedef UNSIGNED_32     u_long;
  108 typedef UNSIGNED_16     u_short;
  109 typedef UNSIGNED_8      u_char;
  110 
  111 
  112 /*
  113  * Define the standard terminology used in the diag software
  114  * with regards to bytes, words, etc.
  115  * BYTE = 8 bits
  116  * HWORD (halfword) = 2 bytes or 16 bits
  117  * WORD = 4 bytes or 32 bits
  118  * QUAD = 8 bytes or 64 bits
  119  *
  120  * (The term QUAD seems less-than-intuitive here, but it is
  121  * derived from BSD sources where it is defined as int64_t.)
  122  *
  123  * For consistency use the following defines wherever appropriate.
  124  */
  125 
  126 typedef enum {
  127         NBI_BYTE  = (sizeof(u_int8_t) * 8),
  128         NBI_HWORD = (sizeof(u_int16_t) * 8),
  129         NBI_WORD  = (sizeof(u_int32_t) * 8),
  130         NBI_QUAD  = (sizeof(u_int64_t) * 8)
  131 } num_bits_t;
  132 
  133 typedef enum {
  134         NBY_BYTE  = sizeof(u_int8_t),
  135         NBY_HWORD = sizeof(u_int16_t),
  136         NBY_WORD  = sizeof(u_int32_t),
  137         NBY_QUAD  = sizeof(u_int64_t)
  138 } num_bytes_t;
  139 
  140 /*
  141  * We assume that pid values are 16 bit integers
  142  */
  143 
  144 typedef u_int16_t pid_t;
  145 
  146 #endif /* _SYS_TYPES_H_ */
  147 
  148 typedef UNSIGNED_32     magic_t;
  149 typedef int             status_t;
  150 
  151 #define BITS_IN_BYTE    8
  152 
  153 /*
  154  * Packed definition. We use this for fields in network frames where we
  155  * don't want the compiler to pack out to even alignment
  156  */
  157 
  158 #ifdef PACKED
  159 #undef PACKED
  160 #endif
  161 #define PACKED(x)       x __attribute__ ((packed))
  162 
  163 /*
  164  * __unused is a FreeBSDism that prevents the compiler from choking
  165  * on function parameters that remain unused through the life of a
  166  * function.  This is not an issue for the Cygnus toolchain.  In general
  167  * it SHOULD NOT BE USED in the martini embedded software repository.
  168  * It should only be used inside of shared code.
  169  */
  170 #ifndef __unused
  171 #define __unused        __attribute__ ((__unused__))
  172 #endif
  173 
  174 /*
  175  * Basic memory multiples
  176  */
  177 
  178 #define SIZE_1K         0x00000400
  179 #define SIZE_2K         0x00000800
  180 #define SIZE_4K         0x00001000
  181 #define SIZE_8K         0x00002000
  182 #define SIZE_16K        0x00004000
  183 #define SIZE_32K        0x00008000
  184 #define SIZE_64K        0x00010000
  185 #define SIZE_128K       0x00020000
  186 #define SIZE_256K       0x00040000
  187 #define SIZE_512K       0x00080000
  188 #define SIZE_1M         0x00100000
  189 #define SIZE_2M         0x00200000
  190 #define SIZE_4M         0x00400000
  191 #define SIZE_8M         0x00800000
  192 #define SIZE_16M        0x01000000
  193 #define SIZE_32M        0x02000000
  194 #define SIZE_64M        0x04000000
  195 #define SIZE_128M       0x08000000
  196 #define SIZE_256M       0x10000000
  197 #define SIZE_512M       0x20000000
  198 #define SIZE_1G         0x40000000
  199 #define SIZE_2G         0x80000000
  200 
  201 /*
  202  * swap16_inline
  203  * swap32_inline
  204  *
  205  * Byteswap a 16 and 32 bit quantities
  206  */
  207 
  208 static inline u_int16_t
  209 swap16_inline(u_int16_t data)
  210 {
  211         return(((data & 0x00ff) << 8) |
  212                ((data & 0xff00) >> 8));
  213 }
  214 
  215 static inline u_int32_t
  216 swap32_inline(u_int32_t data)
  217 {
  218         return(((data & 0x000000ff) << 24) |
  219                ((data & 0x0000ff00) << 8) |
  220                ((data & 0x00ff0000) >> 8) |
  221                ((data & 0xff000000) >> 24));
  222 }
  223 
  224 /*
  225  * Define errno_t here as it is needed by the rom and ukernel
  226  */
  227 typedef u_int32_t errno_t;
  228 
  229 #define EOK     0
  230 
  231 /*
  232  * Define the main communication structure used for passing
  233  * information from the rom to the ukernel (done here as it is
  234  * used by them both)
  235  */
  236 typedef struct rom_info_ rom_info_t;
  237 
  238 /*
  239  * Typedef the return code from the ukernel to the ROM
  240  */
  241 typedef u_int32_t rom_return_t;
  242 
  243 /*
  244  * Pull in the relevant global environment header file
  245  *
  246  * This file is shared by the uKernel and the system simulation effort.
  247  */
  248 #if defined(ENV_UKERN) || defined (ENV_SYS_SIM)
  249 #include "ukern.h"
  250 #endif /* ENV_UKERN */
  251 
  252 #if defined(ENV_ROM)
  253 #include "rom.h"
  254 #endif
  255  
  256 #endif /* __DEFS_H__ */

Cache object: f11e4699bca007f23d8d51aa13d3f049


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