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

Function stop_cond

src/device/software_i2c.c:104–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104static int stop_cond(unsigned int bus)
105{
106 spew("software_i2c(%d): Sending stop condition... ", bus);
107
108 /* SDA is unknown, set it to low. SCL must be low. */
109 software_i2c[bus]->set_sda(bus, 0);
110 wait(bus);
111
112 /* Clock stretching */
113 assert(!software_i2c[bus]->get_scl(bus));
114 software_i2c[bus]->set_scl(bus, 1);
115 if (wait_for_scl(bus, "before stop condition"))
116 return ERR_TIMEOUT;
117 wait(bus); /* Stop bit setup time, minimum 4us */
118
119 /* SCL is high, transition SDA high to signal stop condition. */
120 software_i2c[bus]->set_sda(bus, 1);
121 wait(bus);
122 if (!software_i2c[bus]->get_sda(bus)) {
123 printk(BIOS_WARNING, "software_i2c(%d): WARNING: SDA low after "
124 "stop condition... access by another master or line "
125 "stuck from faulty slave?\n", bus);
126 /* Could theoretically happen with multi-master, so no -1. */
127 }
128
129 spew("Stop condition transmitted\n");
130 return 0;
131}
132
133static int out_bit(unsigned int bus, int bit)
134{

Callers 1

software_i2c_transferFunction · 0.85

Calls 3

waitFunction · 0.85
wait_for_sclFunction · 0.85
printkFunction · 0.50

Tested by

no test coverage detected