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