/*
* Copyright (c) 1999
* Chris D. Faulhaber <jedgar@fxp.org>. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer as
* the first lines of this file unmodified.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY CHRIS D. FAULHABER ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL CHRIS D. FAULHABER BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Portions of this software derived from examples (c) 1998 Takanori Watanabe.
*
* $Id: lmmon.h,v 1.21 2000/03/08 17:41:28 jedgar Exp $
*/
#define LMMON_VERSION "0.65"
/* Interface types */
#define INTERFACE_IO 0
#define INTERFACE_SMB 1
/* Devices to use */
#define IO_DEV "/dev/io"
#define SMB_DEV "/dev/smb0"
/* Addresses to use for /dev/io */
#define WBIO1 0x295
#define WBIO2 0x296
/* Delay between refreshes (in sec) */
#ifndef DELAY
#define DELAY 1
#endif
/* Temperatures scales */
#define TEMP_C 0
#define TEMP_F 1
#define TEMP_K 2
/* LM78/79 addresses */
#define LM78_FANDIV 0x47
#define LM78_FAN(val) (0x28 + (val))
#define LM78_TEMP 0x27
#define LM78_VOLT(val) (0x20 + (val))
/* LM78/79 conversions */
#define LM78_DIV_FROM_DATA(val) (1 << (val))
#define LM78_FAN_FROM_DATA(val, div) ((val)==0?-1:(val)==255?0:1.35E6/((val)*(div)))
#define LM78_TEMP_FROM_DATA(val, scale) ((scale)==0?(val):(scale)==1?(((val)*9/5)+32):((val)+273))
extern inline double LM78_VOLT_FROM_DATA(val, ref)
{
const double vfactor[] = {1,1,1,1.67,4,-4,-1.67};
return ((val) * vfactor[ref] / 64.0);
}
syntax highlighted by Code2HTML, v. 0.9.1