This is the mail archive of the ecos-patches@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

flash/am29xxxxx flash_program_buf length fix


Hi,

This patch fixes an issue with writing the last word when length is
not a multiple of the flash width (causing verify errors).

Index: packages/devs/flash/amd/am29xxxxx/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/amd/am29xxxxx/current/ChangeLog,v
retrieving revision 1.35
diff -u -5 -p -r1.35 ChangeLog
--- packages/devs/flash/amd/am29xxxxx/current/ChangeLog	12 Jun 2005 13:41:11 -0000	1.35
+++ packages/devs/flash/amd/am29xxxxx/current/ChangeLog	31 Aug 2005 20:19:57 -0000
@@ -1,5 +1,10 @@
+2005-08-31  Peter Korsgaard  <jacmet@sunsite.dk>
+
+	* include/flash_am29xxxxx.inl (flash_program_buf): Round up length
+	to next multiple of flash word size.
+
 2005-04-17  David Vrabel  <dvrabel@arcom.com>
 
 	* include/flash_am29xxxxx_parts.inl [CYGHWR_DEVS_FLASH_AMD_AM29F002T]:
 	* cdl/flash_amd_am29xxxxx.cdl: Add AMD AM29F002T part.
 
Index: packages/devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx.inl
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx.inl,v
retrieving revision 1.22
diff -u -5 -p -r1.22 flash_am29xxxxx.inl
--- packages/devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx.inl	23 Apr 2004 20:50:32 -0000	1.22
+++ packages/devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx.inl	31 Aug 2005 20:19:58 -0000
@@ -452,11 +452,11 @@ flash_program_buf(void* addr, void* data
     BANK = find_bank(ROM, addr, &bank_offset);
 
     f_s1 = FLASH_P2V(BANK + FLASH_Setup_Addr1);
     f_s2 = FLASH_P2V(BANK + FLASH_Setup_Addr2);
     rem_sect_size = 0;
-    len /= sizeof (flash_data_t);
+    len = (len + sizeof(flash_data_t)-1)/sizeof(flash_data_t);
 
     while (len > 0) {
         flash_data_t state;
         unsigned int nwords;
 


-- 
Bye, Peter Korsgaard

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]