1 1.6 jdolecek /* $NetBSD: ugvar.h,v 1.6 2020/06/24 19:24:44 jdolecek Exp $ */ 2 1.1 xtraeme 3 1.1 xtraeme /* 4 1.1 xtraeme * Copyright (c) 2007 Mihai Chelaru <kefren (at) netbsd.ro> 5 1.1 xtraeme * All rights reserved. 6 1.1 xtraeme * 7 1.1 xtraeme * Redistribution and use in source and binary forms, with or without 8 1.1 xtraeme * modification, are permitted provided that the following conditions 9 1.1 xtraeme * are met: 10 1.1 xtraeme * 1. Redistributions of source code must retain the above copyright 11 1.1 xtraeme * notice, this list of conditions and the following disclaimer. 12 1.1 xtraeme * 2. The name of the author may not be used to endorse or promote products 13 1.1 xtraeme * derived from this software without specific prior written permission. 14 1.1 xtraeme * 15 1.1 xtraeme * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 1.1 xtraeme * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 1.1 xtraeme * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 1.1 xtraeme * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 1.1 xtraeme * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20 1.1 xtraeme * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 1.1 xtraeme * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 1.1 xtraeme * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 1.1 xtraeme * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 1.1 xtraeme * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 1.1 xtraeme * SUCH DAMAGE. 26 1.1 xtraeme */ 27 1.1 xtraeme 28 1.1 xtraeme #ifndef _UGVAR_H_ 29 1.1 xtraeme #define _UGVAR_H_ 30 1.1 xtraeme 31 1.1 xtraeme struct ug_softc { 32 1.1 xtraeme bus_space_tag_t sc_iot; 33 1.1 xtraeme bus_space_handle_t sc_ioh; 34 1.1 xtraeme 35 1.3 xtraeme struct sysmon_envsys *sc_sme; 36 1.3 xtraeme envsys_data_t sc_sensor[UG_MAX_SENSORS]; 37 1.1 xtraeme uint8_t version; 38 1.5 maxv const void *mbsens; 39 1.1 xtraeme }; 40 1.1 xtraeme 41 1.1 xtraeme struct ug2_sensor_info { 42 1.1 xtraeme const char *name; 43 1.1 xtraeme int port; 44 1.1 xtraeme int type; 45 1.1 xtraeme int multiplier; 46 1.1 xtraeme int divisor; 47 1.1 xtraeme int offset; 48 1.1 xtraeme }; 49 1.1 xtraeme 50 1.1 xtraeme struct ug2_motherboard_info { 51 1.1 xtraeme uint16_t id; 52 1.1 xtraeme const char *name; 53 1.1 xtraeme struct ug2_sensor_info sensors[UG2_MAX_NO_SENSORS + 1]; 54 1.1 xtraeme }; 55 1.1 xtraeme 56 1.1 xtraeme /* driver internal functions */ 57 1.1 xtraeme int ug_reset(struct ug_softc *); 58 1.1 xtraeme uint8_t ug_read(struct ug_softc *, unsigned short); 59 1.1 xtraeme int ug_waitfor(struct ug_softc *, uint16_t, uint8_t); 60 1.1 xtraeme void ug_setup_sensors(struct ug_softc *); 61 1.4 xtraeme void ug2_attach(device_t); 62 1.6 jdolecek int ug2_sync(bus_space_tag_t, bus_space_handle_t); 63 1.1 xtraeme int ug2_read(struct ug_softc *, uint8_t, uint8_t, uint8_t, uint8_t*); 64 1.1 xtraeme 65 1.1 xtraeme /* Envsys */ 66 1.3 xtraeme void ug_refresh(struct sysmon_envsys *, envsys_data_t *); 67 1.3 xtraeme void ug2_refresh(struct sysmon_envsys *, envsys_data_t *); 68 1.1 xtraeme 69 1.1 xtraeme #endif /* _UGVAR_H_ */ 70