ugvar.h revision 1.3 1 1.3 xtraeme /* $NetBSD: ugvar.h,v 1.3 2007/11/16 08:00:15 xtraeme 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 struct device sc_dev;
33 1.1 xtraeme
34 1.1 xtraeme bus_space_tag_t sc_iot;
35 1.1 xtraeme bus_space_handle_t sc_ioh;
36 1.1 xtraeme
37 1.3 xtraeme struct sysmon_envsys *sc_sme;
38 1.3 xtraeme envsys_data_t sc_sensor[UG_MAX_SENSORS];
39 1.1 xtraeme uint8_t version;
40 1.1 xtraeme void *mbsens;
41 1.1 xtraeme };
42 1.1 xtraeme
43 1.1 xtraeme struct ug2_sensor_info {
44 1.1 xtraeme const char *name;
45 1.1 xtraeme int port;
46 1.1 xtraeme int type;
47 1.1 xtraeme int multiplier;
48 1.1 xtraeme int divisor;
49 1.1 xtraeme int offset;
50 1.1 xtraeme };
51 1.1 xtraeme
52 1.1 xtraeme struct ug2_motherboard_info {
53 1.1 xtraeme uint16_t id;
54 1.1 xtraeme const char *name;
55 1.1 xtraeme struct ug2_sensor_info sensors[UG2_MAX_NO_SENSORS + 1];
56 1.1 xtraeme };
57 1.1 xtraeme
58 1.1 xtraeme /* driver internal functions */
59 1.1 xtraeme int ug_reset(struct ug_softc *);
60 1.1 xtraeme uint8_t ug_read(struct ug_softc *, unsigned short);
61 1.1 xtraeme int ug_waitfor(struct ug_softc *, uint16_t, uint8_t);
62 1.1 xtraeme void ug_setup_sensors(struct ug_softc *);
63 1.1 xtraeme void ug2_attach(struct ug_softc *);
64 1.1 xtraeme int ug2_wait_ready(struct ug_softc *);
65 1.1 xtraeme int ug2_wait_readable(struct ug_softc *);
66 1.1 xtraeme int ug2_sync(struct ug_softc *);
67 1.1 xtraeme int ug2_read(struct ug_softc *, uint8_t, uint8_t, uint8_t, uint8_t*);
68 1.1 xtraeme
69 1.1 xtraeme /* Envsys */
70 1.3 xtraeme void ug_refresh(struct sysmon_envsys *, envsys_data_t *);
71 1.3 xtraeme void ug2_refresh(struct sysmon_envsys *, envsys_data_t *);
72 1.1 xtraeme
73 1.1 xtraeme #endif /* _UGVAR_H_ */
74