MCPcopy Create free account
hub / github.com/coreboot/coreboot / in_byte

Function in_byte

src/device/software_i2c.c:212–231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210}
211
212static int in_byte(unsigned int bus, int ack)
213{
214 u8 byte = 0;
215 int i, ret;
216 for (i = 0; i < 8; ++i) {
217 int bit = in_bit(bus);
218 if (bit < 0)
219 return bit;
220 byte = (byte << 1) | bit;
221 }
222
223 if ((ret = out_bit(bus, !ack)) < 0)
224 return ret;
225
226 if (DEBUG)
227 printk(BIOS_DEBUG, "software_i2c(%d): read byte 0x%02x, "
228 "sent %s\n", bus, byte, ack ? "ACK" : "NAK");
229
230 return byte;
231}
232
233int software_i2c_transfer(unsigned int bus, struct i2c_msg *segments, int count)
234{

Callers 1

software_i2c_transferFunction · 0.85

Calls 3

in_bitFunction · 0.85
out_bitFunction · 0.85
printkFunction · 0.50

Tested by

no test coverage detected