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

Function start_cond

src/device/software_i2c.c:72–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72static int start_cond(unsigned int bus)
73{
74 spew("software_i2c(%d): Sending start condition... ", bus);
75
76 /* SDA might not yet be high if repeated start. */
77 software_i2c[bus]->set_sda(bus, 1);
78 wait(bus);
79
80 /* Might need to wait for clock stretching if repeated start. */
81 software_i2c[bus]->set_scl(bus, 1);
82 if (wait_for_scl(bus, "before start condition"))
83 return ERR_TIMEOUT;
84 wait(bus); /* Repeated start setup time, minimum 4.7us */
85
86 if (!software_i2c[bus]->get_sda(bus)) {
87 printk(BIOS_ERR, "software_i2c(%d): Arbitration lost trying "
88 "to send start condition!\n", bus);
89 return ERR_ARB;
90 }
91
92 /* SCL is high, transition SDA low as first part of start condition. */
93 software_i2c[bus]->set_sda(bus, 0);
94 wait(bus);
95 assert(software_i2c[bus]->get_scl(bus));
96
97 /* Pull SCL low to finish start condition (next pulse will be data). */
98 software_i2c[bus]->set_scl(bus, 0);
99
100 spew("Start condition transmitted!\n");
101 return 0;
102}
103
104static int stop_cond(unsigned int bus)
105{

Callers 4

software_i2c_transferFunction · 0.85
software_i2c_wedge_ackFunction · 0.85
software_i2c_wedge_readFunction · 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