Changeset 12407

Show
Ignore:
Timestamp:
06/30/2009 12:16:23 AM (4 months ago)
Author:
BrainSlayer
Message:

fixes firmware check

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • ar5315_microredboot/microredboot/ecos/packages/redboot/current/src/net/tftp_client.c

    r12388 r12407  
    223223                                if (ntohs(hdr->th_opcode) == DATA) { 
    224224                                        if (ntohs(hdr->th_block) == 
    225                                             (cyg_uint16) ((tftp_stream. 
    226                                                            last_good_block + 
    227                                                            1) & 0xFFFF)) { 
     225                                            (cyg_uint16) ((tftp_stream.last_good_block + 1) & 0xFFFF)) { 
    228226                                                // Consume this data 
    229227                                                data_len -= 4;  /* Sizeof TFTP header */ 
  • ar5315_microredboot/microredboot/ecos/packages/redboot/current/src/net/tftp_server.c

    r12388 r12407  
    233233                        diag_printf("Checking uploaded file...\n"); 
    234234 
    235                         int detect = 0
     235                        int detect = -1
    236236                        int i; 
    237237                        for (i = 0; 
     
    239239                             sizeof(fw_formats) / 
    240240                             sizeof(struct firmware_formats); i++) { 
    241                                 int v = 
    242                                     fw_formats[i].fw_check_image((char *) 
    243                                                                  BASE_ADDR, 
    244                                                                  ptr - 
    245                                                                  BASE_ADDR, 
    246                                                                  0) == 0; 
    247                                 if (v) { 
     241                                int v = fw_formats[i].fw_check_image((char *)BASE_ADDR,ptr - BASE_ADDR,0); 
     242//                              diag_printf("%s returns %d\n",fw_formats[i].name,v); 
     243                                if (!v) { 
    248244                                        detect = i; 
    249245                                        break; 
     
    251247                        } 
    252248 
    253                         if (detect)   /* third parameter 0 - do not write to flash */ 
     249                        if (detect!=-1)       /* third parameter 0 - do not write to flash */ 
    254250                                tftpd_send(ACK, block, src_route, src_port);    // crc ok 
    255251                        else {