freemyipod r598 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r597‎ | r598 | r599 >
Date:20:42, 12 February 2011
Author:theseven
Status:new
Tags:
Comment:
emCORE: Rework yield vs. sleep usage a bit
Modified paths:
  • /emcore/trunk/target/ipodnano2g/hwkeyaes.c (modified) (history)
  • /emcore/trunk/target/ipodnano2g/pmu.c (modified) (history)
  • /emcore/trunk/target/ipodnano3g/hwkeyaes.c (modified) (history)
  • /emcore/trunk/target/ipodnano3g/pmu.c (modified) (history)

Diff [purge]

Index: emcore/trunk/target/ipodnano2g/pmu.c
@@ -61,7 +61,7 @@
6262 pmu_write(0x54, 5 | (adc << 4));
6363 while ((data & 0x80) == 0)
6464 {
65 - yield();
 65+ sleep(1000);
6666 data = pmu_read(0x57);
6767 }
6868 int value = (pmu_read(0x55) << 2) | (data & 3);
Index: emcore/trunk/target/ipodnano2g/hwkeyaes.c
@@ -62,7 +62,7 @@
6363 AESSTATUS = 6;
6464 AESGO = go;
6565 go = 3;
66 - while ((AESSTATUS & 6) == 0) yield();
 66+ while ((AESSTATUS & 6) == 0);
6767 invalidate_dcache();
6868 if (direction == HWKEYAES_DECRYPT)
6969 {
Index: emcore/trunk/target/ipodnano3g/pmu.c
@@ -63,7 +63,7 @@
6464 pmu_write(0x54, 5 | (adc << 4));
6565 while ((data & 0x80) == 0)
6666 {
67 - yield();
 67+ sleep(1000);
6868 data = pmu_read(0x57);
6969 }
7070 int value = (pmu_read(0x55) << 2) | (data & 3);
Index: emcore/trunk/target/ipodnano3g/hwkeyaes.c
@@ -54,7 +54,7 @@
5555 clean_dcache();
5656 AESGO = 1;
5757 invalidate_dcache();
58 - while (!(AESSTATUS & 0xf)) sleep(100);
 58+ while (!(AESSTATUS & 0xf)) sleep(MIN(10000, size >> 4));
5959 clockgate_enable(10, false);
6060 mutex_unlock(&hwkeyaes_mutex);
6161 }