master
h 39 lines 827 Bytes
Raw
1 /*
2 * PCA9554 I/O port
3 *
4 * Copyright (c) 2023, IBM Corporation.
5 *
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8 #ifndef PCA9554_H
9 #define PCA9554_H
10
11 #include "hw/i2c/i2c.h"
12 #include "qom/object.h"
13
14 #define TYPE_PCA9554 "pca9554"
15 #define TYPE_PCA9536 "pca9536"
16 typedef struct PCA9554State PCA9554State;
17 DECLARE_INSTANCE_CHECKER(PCA9554State, PCA9554,
18 TYPE_PCA9554)
19
20 #define PCA9554_NR_REGS 4
21 #define PCA9554_PIN_COUNT 8
22 #define PCA9536_PIN_COUNT 4
23
24 struct PCA9554State {
25 /*< private >*/
26 I2CSlave i2c;
27 /*< public >*/
28
29 uint8_t len;
30 uint8_t pointer;
31
32 uint8_t regs[PCA9554_NR_REGS];
33 qemu_irq gpio_out[PCA9554_PIN_COUNT];
34 uint8_t ext_state[PCA9554_PIN_COUNT];
35 char *description; /* For debugging purpose only */
36 bool hw_dir; /* Honor pin direction */
37 };
38
39 #endif