xref: /qemu/include/hw/gpio/pca9554.h (revision 1d2f2b35)
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 typedef struct PCA9554State PCA9554State;
16 DECLARE_INSTANCE_CHECKER(PCA9554State, PCA9554,
17                          TYPE_PCA9554)
18 
19 #define PCA9554_NR_REGS 4
20 #define PCA9554_PIN_COUNT 8
21 
22 struct PCA9554State {
23     /*< private >*/
24     I2CSlave i2c;
25     /*< public >*/
26 
27     uint8_t len;
28     uint8_t pointer;
29 
30     uint8_t regs[PCA9554_NR_REGS];
31     qemu_irq gpio_out[PCA9554_PIN_COUNT];
32     uint8_t ext_state[PCA9554_PIN_COUNT];
33     char *description; /* For debugging purpose only */
34 };
35 
36 #endif
37