Revision b246eebb
b/hw/pm_smbus.c | ||
---|---|---|
37 | 37 |
#define SMBHSTDAT1 0x06 |
38 | 38 |
#define SMBBLKDAT 0x07 |
39 | 39 |
|
40 |
//#define DEBUG |
|
41 |
|
|
42 |
#ifdef DEBUG |
|
43 |
# define SMBUS_DPRINTF(format, ...) printf(format, ## __VA_ARGS__) |
|
44 |
#else |
|
45 |
# define SMBUS_DPRINTF(format, ...) do { } while (0) |
|
46 |
#endif |
|
47 |
|
|
48 |
|
|
40 | 49 |
static void smb_transaction(PMSMBus *s) |
41 | 50 |
{ |
42 | 51 |
uint8_t prot = (s->smb_ctl >> 2) & 0x07; |
... | ... | |
45 | 54 |
uint8_t addr = s->smb_addr >> 1; |
46 | 55 |
i2c_bus *bus = s->smbus; |
47 | 56 |
|
48 |
#ifdef DEBUG |
|
49 |
printf("SMBus trans addr=0x%02x prot=0x%02x\n", addr, prot); |
|
50 |
#endif |
|
57 |
SMBUS_DPRINTF("SMBus trans addr=0x%02x prot=0x%02x\n", addr, prot); |
|
51 | 58 |
switch(prot) { |
52 | 59 |
case 0x0: |
53 | 60 |
smbus_quick_command(bus, addr, read); |
... | ... | |
96 | 103 |
{ |
97 | 104 |
PMSMBus *s = opaque; |
98 | 105 |
addr &= 0x3f; |
99 |
#ifdef DEBUG |
|
100 |
printf("SMB writeb port=0x%04x val=0x%02x\n", addr, val); |
|
101 |
#endif |
|
106 |
SMBUS_DPRINTF("SMB writeb port=0x%04x val=0x%02x\n", addr, val); |
|
102 | 107 |
switch(addr) { |
103 | 108 |
case SMBHSTSTS: |
104 | 109 |
s->smb_stat = 0; |
... | ... | |
166 | 171 |
val = 0; |
167 | 172 |
break; |
168 | 173 |
} |
169 |
#ifdef DEBUG |
|
170 |
printf("SMB readb port=0x%04x val=0x%02x\n", addr, val); |
|
171 |
#endif |
|
174 |
SMBUS_DPRINTF("SMB readb port=0x%04x val=0x%02x\n", addr, val); |
|
172 | 175 |
return val; |
173 | 176 |
} |
174 | 177 |
|
Also available in: Unified diff