comparison loadtools/flprogbin.c @ 506:0dd2c87c1b63

fc-loadtool flash support overhaul
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 28 May 2019 05:12:47 +0000
parents e7502631a0f9
children 52980e3a51c7
comparison
equal deleted inserted replaced
505:7bf0d909c87e 506:0dd2c87c1b63
36 return(-1); 36 return(-1);
37 } 37 }
38 flashoff = strtoul(argv[2], &strtoul_endp, 16); 38 flashoff = strtoul(argv[2], &strtoul_endp, 16);
39 if (*strtoul_endp) 39 if (*strtoul_endp)
40 goto inv; 40 goto inv;
41 if (flash_get_cfi(bank) < 0) 41 if (flash_detect(bank, 0) < 0)
42 return(-1); 42 return(-1);
43 bi = flash_bank_info + bank; 43 bi = flash_bank_info + bank;
44 if (flashoff >= bi->geom->total_size) { 44 if (flashoff >= bi->geom->total_size) {
45 fprintf(stderr, 45 fprintf(stderr,
46 "error: specified flash offset exceeds bank size (0x%lx)\n", 46 "error: specified flash offset exceeds bank size (0x%lx)\n",
107 fclose(binf); 107 fclose(binf);
108 return(-1); 108 return(-1);
109 } 109 }
110 110
111 /* finally done with the arg parsing etc, can get to work now */ 111 /* finally done with the arg parsing etc, can get to work now */
112 if (flash_id_check(bank, 0) < 0) {
113 fclose(binf);
114 return(-1);
115 }
116 crc_base_addr = bi->base_addr + flashoff; 112 crc_base_addr = bi->base_addr + flashoff;
117 sprintf(shortarg, "%lx", (u_long) bi->base_addr); 113 sprintf(shortarg, "%lx", (u_long) bi->base_addr);
118 targv[0] = bi->ops->loadagent_setbase_cmd; 114 targv[0] = bi->ops->loadagent_setbase_cmd;
119 targv[1] = shortarg; 115 targv[1] = shortarg;
120 targv[2] = 0; 116 targv[2] = 0;