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

Function out_bit

src/device/software_i2c.c:133–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133static int out_bit(unsigned int bus, int bit)
134{
135 spew("software_i2c(%d): Sending a %d bit... ", bus, bit);
136
137 software_i2c[bus]->set_sda(bus, bit);
138 wait(bus);
139
140 if (bit && !software_i2c[bus]->get_sda(bus)) {
141 printk(BIOS_ERR, "software_i2c(%d): ERROR: SDA wedged low "
142 "by slave before clock pulse on transmit!\n", bus);
143 return ERR_WEDGE;
144 }
145
146 /* Clock stretching */
147 assert(!software_i2c[bus]->get_scl(bus));
148 software_i2c[bus]->set_scl(bus, 1);
149 if (wait_for_scl(bus, "on transmit"))
150 return ERR_TIMEOUT;
151 wait(bus);
152
153 if (bit && !software_i2c[bus]->get_sda(bus)) {
154 printk(BIOS_ERR, "software_i2c(%d): ERROR: SDA wedged low "
155 "by slave after clock pulse on transmit!\n", bus);
156 return ERR_WEDGE;
157 }
158
159 assert(software_i2c[bus]->get_scl(bus));
160 software_i2c[bus]->set_scl(bus, 0);
161
162 spew("%d bit sent!\n", bit);
163 return 0;
164}
165
166static int in_bit(unsigned int bus)
167{

Callers 4

out_byteFunction · 0.85
in_byteFunction · 0.85
software_i2c_wedge_ackFunction · 0.85
software_i2c_wedge_writeFunction · 0.85

Calls 3

waitFunction · 0.85
wait_for_sclFunction · 0.85
printkFunction · 0.50

Tested by

no test coverage detected