Statistics
| Branch: | Revision:

root / hw / misc / tmp105.h @ a8aec295

History | View | Annotate | Download (1 kB)

1 2915efbf Alex Horn
/*
2 2915efbf Alex Horn
 * Texas Instruments TMP105 Temperature Sensor
3 2915efbf Alex Horn
 *
4 2915efbf Alex Horn
 * Browse the data sheet:
5 2915efbf Alex Horn
 *
6 2915efbf Alex Horn
 *    http://www.ti.com/lit/gpn/tmp105
7 2915efbf Alex Horn
 *
8 2915efbf Alex Horn
 * Copyright (C) 2012 Alex Horn <alex.horn@cs.ox.ac.uk>
9 2915efbf Alex Horn
 * Copyright (C) 2008-2012 Andrzej Zaborowski <balrogg@gmail.com>
10 2915efbf Alex Horn
 *
11 2915efbf Alex Horn
 * This work is licensed under the terms of the GNU GPL, version 2 or
12 2915efbf Alex Horn
 * later. See the COPYING file in the top-level directory.
13 2915efbf Alex Horn
 */
14 2915efbf Alex Horn
#ifndef QEMU_TMP105_H
15 2915efbf Alex Horn
#define QEMU_TMP105_H
16 2915efbf Alex Horn
17 0d09e41a Paolo Bonzini
#include "hw/i2c/i2c.h"
18 0d09e41a Paolo Bonzini
#include "hw/misc/tmp105_regs.h"
19 2915efbf Alex Horn
20 2aad80ee Andreas Färber
#define TYPE_TMP105 "tmp105"
21 2aad80ee Andreas Färber
#define TMP105(obj) OBJECT_CHECK(TMP105State, (obj), TYPE_TMP105)
22 2aad80ee Andreas Färber
23 2aad80ee Andreas Färber
/**
24 2aad80ee Andreas Färber
 * TMP105State:
25 2aad80ee Andreas Färber
 * @config: Bits 5 and 6 (value 32 and 64) determine the precision of the
26 2aad80ee Andreas Färber
 * temperature. See Table 8 in the data sheet.
27 2aad80ee Andreas Färber
 *
28 2aad80ee Andreas Färber
 * @see_also: http://www.ti.com/lit/gpn/tmp105
29 2aad80ee Andreas Färber
 */
30 2aad80ee Andreas Färber
typedef struct TMP105State {
31 2aad80ee Andreas Färber
    /*< private >*/
32 2aad80ee Andreas Färber
    I2CSlave i2c;
33 2aad80ee Andreas Färber
    /*< public >*/
34 2aad80ee Andreas Färber
35 2aad80ee Andreas Färber
    uint8_t len;
36 2aad80ee Andreas Färber
    uint8_t buf[2];
37 2aad80ee Andreas Färber
    qemu_irq pin;
38 2aad80ee Andreas Färber
39 2aad80ee Andreas Färber
    uint8_t pointer;
40 2aad80ee Andreas Färber
    uint8_t config;
41 2aad80ee Andreas Färber
    int16_t temperature;
42 2aad80ee Andreas Färber
    int16_t limit[2];
43 2aad80ee Andreas Färber
    int faults;
44 2aad80ee Andreas Färber
    uint8_t alarm;
45 2aad80ee Andreas Färber
} TMP105State;
46 2aad80ee Andreas Färber
47 2915efbf Alex Horn
#endif