freemyipod r154 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r153‎ | r154 | r155 >
Date:14:13, 18 August 2010
Author:theseven
Status:new
Tags:
Comment:
Fix boot flash writing code on Nano2G
Modified paths:
  • /embios/trunk/target/ipodnano2g/bootflash.c (modified) (history)

Diff [purge]

Index: embios/trunk/target/ipodnano2g/bootflash.c
@@ -108,11 +108,15 @@
109109 norflsh[(offset & ~0xfff) >> 1] = 0x30;
110110 while (norflsh[(offset & ~0xfff) >> 1] != 0xffff);
111111 }
112 - norflsh[0x5555] = 0xaa;
113 - norflsh[0x2aaa] = 0x55;
114 - norflsh[0x5555] = 0xa0;
115 - norflsh[offset >> 1] = ((uint16_t*)addr)[offset >> 1];
116 - while (norflsh[offset >> 1] != ((uint16_t*)addr)[offset >> 1]);
 112+ for (i = 0; i < remainder; i += 2)
 113+ if (norflsh[(offset + i) >> 1] != ((uint16_t*)addr)[i >> 1])
 114+ {
 115+ norflsh[0x5555] = 0xaa;
 116+ norflsh[0x2aaa] = 0x55;
 117+ norflsh[0x5555] = 0xa0;
 118+ norflsh[(offset + i) >> 1] = ((uint16_t*)addr)[i >> 1];
 119+ while (norflsh[(offset + i) >> 1] != ((uint16_t*)addr)[i >> 1]);
 120+ }
117121 }
118122 addr = (void*)(((uint32_t)addr) + remainder);
119123 offset += remainder;