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/sys/envsys.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: envsys.h,v 1.7 2003/02/20 20:57:56 christos Exp $ */
    2 
    3 /*-
    4  * Copyright (c) 1999 The NetBSD Foundation, Inc.
    5  * All rights reserved.
    6  *
    7  * This code is derived from software contributed to The NetBSD Foundation
    8  * by Tim Rightnour and Bill Squier.
    9  *
   10  * Redistribution and use in source and binary forms, with or without
   11  * modification, are permitted provided that the following conditions
   12  * are met:
   13  * 1. Redistributions of source code must retain the above copyright
   14  *    notice, this list of conditions and the following disclaimer.
   15  * 2. Redistributions in binary form must reproduce the above copyright
   16  *    notice, this list of conditions and the following disclaimer in the
   17  *    documentation and/or other materials provided with the distribution.
   18  * 3. All advertising materials mentioning features or use of this software
   19  *    must display the following acknowledgement:
   20  *      This product includes software developed by the NetBSD
   21  *      Foundation, Inc. and its contributors.
   22  * 4. Neither the name of The NetBSD Foundation nor the names of its
   23  *    contributors may be used to endorse or promote products derived
   24  *    from this software without specific prior written permission.
   25  *
   26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   36  * POSSIBILITY OF SUCH DAMAGE.
   37  */
   38 
   39 #ifndef _SYS_ENVSYS_H_
   40 #define _SYS_ENVSYS_H_
   41 
   42 #include <sys/ioccom.h>
   43 
   44 /* Returns API Version * 1000 */
   45 
   46 #define ENVSYS_VERSION _IOR('E', 0, int32_t)
   47 
   48 /* returns the range for a particular sensor */
   49 
   50 struct envsys_range {
   51         u_int low;
   52         u_int high;
   53         u_int units;                    /* see GTREDATA */
   54 };
   55 typedef struct envsys_range envsys_range_t;
   56 
   57 #define ENVSYS_GRANGE _IOWR('E', 1, envsys_range_t)
   58 
   59 /* get sensor data */
   60 
   61 struct envsys_tre_data {
   62         u_int sensor;
   63         union {                         /* all data is given */
   64                 u_int32_t data_us;      /* in microKelvins, */
   65                 int32_t data_s;         /* rpms, volts, amps, */
   66         } cur, min, max, avg;           /* ohms, watts, etc */
   67                                         /* see units below */
   68 
   69         u_int32_t       warnflags;      /* warning flags */
   70         u_int32_t       validflags;     /* sensor valid flags */
   71         u_int           units;          /* type of sensor */
   72 };
   73 typedef struct envsys_tre_data envsys_temp_data_t;
   74 typedef struct envsys_tre_data envsys_rpm_data_t;
   75 typedef struct envsys_tre_data envsys_electrical_data_t;
   76 typedef struct envsys_tre_data envsys_tre_data_t;
   77 
   78 /* flags for warnflags */
   79 #define ENVSYS_WARN_OK          0x00000000  /* All is well */
   80 #define ENVSYS_WARN_UNDER       0x00000001  /* an under condition */
   81 #define ENVSYS_WARN_CRITUNDER   0x00000002  /* a critical under condition */
   82 #define ENVSYS_WARN_OVER        0x00000004  /* an over condition */
   83 #define ENVSYS_WARN_CRITOVER    0x00000008  /* a critical over condition */
   84 
   85 /* type of sensor for units */
   86 enum envsys_units {
   87         ENVSYS_STEMP            = 0,
   88         ENVSYS_SFANRPM,
   89         ENVSYS_SVOLTS_AC,
   90         ENVSYS_SVOLTS_DC,
   91         ENVSYS_SOHMS,
   92         ENVSYS_SWATTS,
   93         ENVSYS_SAMPS,
   94         ENVSYS_SWATTHOUR,
   95         ENVSYS_SAMPHOUR,
   96         ENVSYS_INDICATOR,       /* boolean indicator */
   97         ENVSYS_INTEGER,         /* generic integer return */
   98         ENVSYS_NSENSORS
   99 };
  100 
  101 #ifdef ENVSYSUNITNAMES
  102 static const char *envsysunitnames[] = {
  103     "degC", "RPM", "VAC", "V", "Ohms", "W",
  104     "A", "Wh", "Ah", "bool", "integer", "Unk"
  105 };
  106 #endif
  107 
  108 /* flags for validflags */
  109 #define ENVSYS_FVALID           0x00000001  /* sensor is valid */
  110 #define ENVSYS_FCURVALID        0x00000002  /* cur for this sens is valid */
  111 #define ENVSYS_FMINVALID        0x00000004  /* min for this sens is valid */
  112 #define ENVSYS_FMAXVALID        0x00000008  /* max for this sens is valid */
  113 #define ENVSYS_FAVGVALID        0x00000010  /* avg for this sens is valid */
  114 #define ENVSYS_FFRACVALID       0x00000020  /* display fraction of max */
  115 
  116 #define ENVSYS_GTREDATA _IOWR('E', 2, envsys_temp_data_t)
  117 
  118 /* set and check sensor info */
  119 
  120 struct envsys_basic_info {
  121         u_int   sensor;         /* sensor number */
  122         u_int   units;          /* type of sensor */
  123         char    desc[33];       /* sensor description */
  124         u_int   rfact;          /* for volts, (int)(factor x 10^4) */
  125         u_int   rpms;           /* for fans, set nominal RPMs */
  126         u_int32_t validflags;   /* sensor valid flags */
  127 };
  128 typedef struct envsys_basic_info envsys_temp_info_t;
  129 typedef struct envsys_basic_info envsys_rpm_info_t;
  130 typedef struct envsys_basic_info envsys_electrical_info_t;
  131 typedef struct envsys_basic_info envsys_basic_info_t;
  132 
  133 #define ENVSYS_STREINFO _IOWR('E', 3, envsys_temp_info_t)
  134 #define ENVSYS_GTREINFO _IOWR('E', 4, envsys_temp_info_t)
  135 
  136 #endif /* _SYS_ENVSYS_H_ */

Cache object: 838847b2431d800a8646d80d67c006fb


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