xref: /qemu/include/hw/i2c/pm_smbus.h (revision 38ad4fae43b9c57a4ef3111217b110b25dbd3c50)
1 #ifndef PM_SMBUS_H
2 #define PM_SMBUS_H
3 
4 #define PM_SMBUS_MAX_MSG_SIZE 32
5 
6 typedef struct PMSMBus {
7     I2CBus *smbus;
8     MemoryRegion io;
9 
10     uint8_t smb_stat;
11     uint8_t smb_ctl;
12     uint8_t smb_cmd;
13     uint8_t smb_addr;
14     uint8_t smb_data0;
15     uint8_t smb_data1;
16     uint8_t smb_data[PM_SMBUS_MAX_MSG_SIZE];
17     uint8_t smb_blkdata;
18     uint8_t smb_auxctl;
19     uint32_t smb_index;
20 
21     /* Set by pm_smbus.c */
22     void (*reset)(struct PMSMBus *s);
23 
24     /* Set by the user. */
25     bool i2c_enable;
26 
27     /* Internally used by pm_smbus. */
28 
29     /* Set on block transfers after the last byte has been read, so the
30        INTR bit can be set at the right time. */
31     bool op_done;
32 } PMSMBus;
33 
34 void pm_smbus_init(DeviceState *parent, PMSMBus *smb);
35 
36 #endif /* PM_SMBUS_H */
37