cleanup
authorlothar <lothar>
Wed, 8 Jul 2009 10:51:04 +0000 (10:51 +0000)
committerlothar <lothar>
Wed, 8 Jul 2009 10:51:04 +0000 (10:51 +0000)
packages/redboot/v2_0/src/wince.c

index 23cda48..5d91d83 100755 (executable)
@@ -11,9 +11,9 @@ cmd_fun do_go;
 // Local macro
 
 // Memory macro
-#define CE_RAM_BASE                    CYGMEM_REGION_ram
-#define CE_RAM_SIZE                    CYGMEM_REGION_ram_SIZE
-#define CE_RAM_END                     (CE_RAM_BASE + CE_RAM_SIZE)
+#define CE_RAM_BASE                            CYGMEM_REGION_ram
+#define CE_RAM_SIZE                            CYGMEM_REGION_ram_SIZE
+#define CE_RAM_END                             (CE_RAM_BASE + CE_RAM_SIZE)
 #define CE_WINCE_VRAM_BASE             0x80000000
 #define CE_FIX_ADDRESS(a)              (((a) - CE_WINCE_VRAM_BASE) + CE_RAM_BASE)
 
@@ -25,7 +25,7 @@ static inline int is_rom_addr(void *addr)
        return addr >= flash_start && addr <= flash_end;
 }
 #else
-#define is_rom_addr(p)         0
+#define is_rom_addr(p)                 0
 #endif
 
 static inline int is_ram_addr(unsigned long addr)
@@ -37,7 +37,7 @@ static inline int is_ram_addr(unsigned long addr)
 #define CE_PS_RTI_ADDR                 0
 #define CE_PS_RTI_LEN                  1
 #define CE_PS_E_ADDR                   2
-#define CE_PS_E_LEN                    3
+#define CE_PS_E_LEN                            3
 #define CE_PS_E_CHKSUM                 4
 #define CE_PS_E_DATA                   5
 
@@ -46,8 +46,8 @@ static inline int is_ram_addr(unsigned long addr)
 #define CE_MAX(a, b)                   (((a) > (b)) ? (a) : (b))
 
 // Macro string
-#define _STRMAC(s)                     #s
-#define STRMAC(s)                      _STRMAC(s)
+#define _STRMAC(s)                             #s
+#define STRMAC(s)                              _STRMAC(s)
 
 ///////////////////////////////////////////////////////////////////////////////////////////////
 // Local types
@@ -273,7 +273,7 @@ int ce_parse_bin(ce_bin *bin)
                                                }
                                        }
 
-                                       bin->parseState ++;
+                                       bin->parseState++;
                                        bin->parseLen = 0;
                                        bin->parsePtr += sizeof(unsigned int);
                                        if (bin->parseState == CE_PS_E_DATA) {
@@ -309,7 +309,7 @@ int ce_parse_bin(ce_bin *bin)
                                        } else {
                                                while (copyLen--) {
                                                        bin->parseChkSum += *pbData;
-                                                       *bin->parsePtr ++ = *pbData ++;
+                                                       *bin->parsePtr++ = *pbData++;
                                                }
                                        }
                                        if (bin->parseLen == bin->ePhysLen) {
@@ -321,15 +321,14 @@ int ce_parse_bin(ce_bin *bin)
 
                                                if (bin->eChkSum != bin->parseChkSum) {
                                                        // Checksum error!
-
                                                        diag_printf("Error: Checksum error, corrupted .BIN file!\n");
-
+                                                       diag_printf("checksum calculated: 0x%08lx from file: 0x%08lx\n",
+                                                                               bin->parseChkSum, bin->eChkSum);
                                                        bin->binLen = 0;
-
                                                        return CE_PR_ERROR;
                                                }
 
-                                               bin->section ++;
+                                               bin->section++;
                                                bin->parseState = CE_PS_E_ADDR;
                                                bin->parseLen = 0;
                                                bin->parsePtr = (unsigned char*)(&bin->ePhysAddr);
@@ -392,7 +391,7 @@ bool ce_lookup_ep_bin(ce_bin *bin)
                                                              sizeof(unsigned int)));
        tentry = (ce_toc_entry*)(header + 1);
 
-       for (i = 0; i < header->nummods; i ++) {
+       for (i = 0; i < header->nummods; i++) {
                // Look for 'nk.exe' module
                if (strcmp((char*)CE_FIX_ADDRESS(tentry[ i ].fileName), "nk.exe") == 0) {
                        // Save entry point and RAM addresses
@@ -781,7 +780,7 @@ int ce_send_bootme(ce_net *net)
        header->id = EDBG_ID;
        header->service = EDBG_SVC_ADMIN;
        header->flags = EDBG_FL_FROM_DEV;
-       header->seqNum = net->secNum ++;
+       header->seqNum = net->secNum++;
        header->cmd = EDBG_CMD_BOOTME;
 
        // Get RedBoot version
@@ -910,7 +909,7 @@ int ce_process_download(ce_net *net, ce_bin *bin)
 
                        // Request next block
                        if (ret != CE_PR_ERROR) {
-                               net->blockNum ++;
+                               net->blockNum++;
 
                                ce_send_write_ack(net);
                        }