freemyipod r877 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r876‎ | r877 | r878 >
Date:14:09, 1 August 2013
Author:theseven
Status:new
Tags:
Comment:
emCORE: s5l8702: Add missing i2c delay loops
Modified paths:
  • /emcore/trunk/target/ipodnano3g/i2c.c (modified) (history)

Diff [purge]

Index: emcore/trunk/target/ipodnano3g/i2c.c
@@ -70,6 +70,7 @@
7171 IICSTAT(bus) = 0xF0;
7272 while (IIC10(bus));
7373 IICCON(bus) = 0xB7;
 74+ while (IIC10(bus));
7475 while ((IICCON(bus) & 0x10) == 0) yield();
7576 if (address >= 0)
7677 {
@@ -78,6 +79,7 @@
7980 IICDS(bus) = address;
8081 while (IIC10(bus));
8182 IICCON(bus) = 0xB7;
 83+ while (IIC10(bus));
8284 while ((IICCON(bus) & 0x10) == 0) yield();
8385 }
8486 /* write data */
@@ -87,6 +89,7 @@
8890 IICDS(bus) = *data++;
8991 while (IIC10(bus));
9092 IICCON(bus) = 0xB7;
 93+ while (IIC10(bus));
9194 while ((IICCON(bus) & 0x10) == 0) yield();
9295 }
9396 /* STOP */
@@ -112,6 +115,7 @@
113116 IICSTAT(bus) = 0xF0;
114117 while (IIC10(bus));
115118 IICCON(bus) = 0xB7;
 119+ while (IIC10(bus));
116120 while ((IICCON(bus) & 0x10) == 0) yield();
117121 /* write address */
118122 while (IIC10(bus));
@@ -118,6 +122,7 @@
119123 IICDS(bus) = address;
120124 while (IIC10(bus));
121125 IICCON(bus) = 0xB7;
 126+ while (IIC10(bus));
122127 while ((IICCON(bus) & 0x10) == 0) yield();
123128 }
124129 /* (repeated) START */
@@ -127,11 +132,13 @@
128133 IICSTAT(bus) = 0xB0;
129134 while (IIC10(bus));
130135 IICCON(bus) = 0xB7;
 136+ while (IIC10(bus));
131137 while ((IICCON(bus) & 0x10) == 0) yield();
132138 while (length--)
133139 {
134140 while (IIC10(bus));
135141 IICCON(bus) = (length == 0) ? 0x37 : 0xB7; /* NACK or ACK */
 142+ while (IIC10(bus));
136143 while ((IICCON(bus) & 0x10) == 0) yield();
137144 *data++ = IICDS(bus);
138145 }
@@ -140,6 +147,7 @@
141148 IICSTAT(bus) = 0x90;
142149 while (IIC10(bus));
143150 IICCON(bus) = 0xB7;
 151+ while (IIC10(bus));
144152 while ((IICSTAT(bus) & (1 << 5)) != 0) yield();
145153 i2c_off(bus);
146154 mutex_unlock(&i2cmutex);