]> git.proxmox.com Git - mirror_qemu.git/blob - include/hw/misc/max111x.h
Merge remote-tracking branch 'remotes/philmd-gitlab/tags/fw_cfg-20200704' into staging
[mirror_qemu.git] / include / hw / misc / max111x.h
1 /*
2 * Maxim MAX1110/1111 ADC chip emulation.
3 *
4 * Copyright (c) 2006 Openedhand Ltd.
5 * Written by Andrzej Zaborowski <balrog@zabor.org>
6 *
7 * This code is licensed under the GNU GPLv2.
8 *
9 * Contributions after 2012-01-13 are licensed under the terms of the
10 * GNU GPL, version 2 or (at your option) any later version.
11 */
12
13 #ifndef HW_MISC_MAX111X_H
14 #define HW_MISC_MAX111X_H
15
16 #include "hw/ssi/ssi.h"
17
18 /*
19 * This is a model of the Maxim MAX1110/1111 ADC chip, which for QEMU
20 * is an SSI slave device. It has either 4 (max1110) or 8 (max1111)
21 * 8-bit ADC channels.
22 *
23 * QEMU interface:
24 * + GPIO inputs 0..3 (for max1110) or 0..7 (for max1111): set the value
25 * of each ADC input, as an unsigned 8-bit value
26 * + GPIO output 0: interrupt line
27 * + Properties "input0" to "input3" (max1110) or "input0" to "input7"
28 * (max1111): initial reset values for ADC inputs.
29 *
30 * Known bugs:
31 * + the interrupt line is not correctly implemented, and will never
32 * be lowered once it has been asserted.
33 */
34 typedef struct {
35 SSISlave parent_obj;
36
37 qemu_irq interrupt;
38 /* Values of inputs at system reset (settable by QOM property) */
39 uint8_t reset_input[8];
40
41 uint8_t tb1, rb2, rb3;
42 int cycle;
43
44 uint8_t input[8];
45 int inputs, com;
46 } MAX111xState;
47
48 #define TYPE_MAX_111X "max111x"
49
50 #define MAX_111X(obj) \
51 OBJECT_CHECK(MAX111xState, (obj), TYPE_MAX_111X)
52
53 #define TYPE_MAX_1110 "max1110"
54 #define TYPE_MAX_1111 "max1111"
55
56 #endif