comparison packages/redboot/current/src/flash.c @ 191:678094f34118

Merge from eCos master repository on 2001-10-19-06:43:02-BST
author jlarmour
date Fri, 19 Oct 2001 07:02:26 +0000
parents 022f1e506033
children 67850532eebb
comparison
equal deleted inserted replaced
190:7e4874fa4fbe 191:678094f34118
1074 do_flash_init(void) 1074 do_flash_init(void)
1075 { 1075 {
1076 int stat; 1076 int stat;
1077 1077
1078 if (!__flash_init) { 1078 if (!__flash_init) {
1079 __flash_init = 1;
1080 if ((stat = flash_init((void *)(workspace_end-FLASH_MIN_WORKSPACE), 1079 if ((stat = flash_init((void *)(workspace_end-FLASH_MIN_WORKSPACE),
1081 FLASH_MIN_WORKSPACE, diag_printf)) != 0) { 1080 FLASH_MIN_WORKSPACE, diag_printf)) != 0) {
1082 diag_printf("FLASH: driver init failed: %s\n", flash_errmsg(stat)); 1081 diag_printf("FLASH: driver init failed: %s\n", flash_errmsg(stat));
1083 return false; 1082 return false;
1084 } 1083 }
1090 #ifdef CYGOPT_REDBOOT_FIS 1089 #ifdef CYGOPT_REDBOOT_FIS
1091 workspace_end = (unsigned char *)(workspace_end-block_size); 1090 workspace_end = (unsigned char *)(workspace_end-block_size);
1092 fis_work_block = workspace_end; 1091 fis_work_block = workspace_end;
1093 fisdir_size = block_size; 1092 fisdir_size = block_size;
1094 #endif 1093 #endif
1094 __flash_init = 1;
1095 } 1095 }
1096 return true; 1096 return true;
1097 } 1097 }
1098 1098
1099 // Wrapper to avoid compiler warnings
1100 static void
1101 _do_flash_init(void)
1102 {
1103 do_flash_init();
1104 }
1105
1099 #ifndef CYGOPT_REDBOOT_FLASH_CONFIG 1106 #ifndef CYGOPT_REDBOOT_FLASH_CONFIG
1100 RedBoot_init(do_flash_init, RedBoot_INIT_FIRST); 1107 RedBoot_init(_do_flash_init, RedBoot_INIT_FIRST);
1101 #endif 1108 #endif
1102 1109
1103 static void 1110 static void
1104 do_fis(int argc, char *argv[]) 1111 do_fis(int argc, char *argv[])
1105 { 1112 {
1689 offset = alias_len-strlen(ms)-2; // Number of bytes being inserted 1696 offset = alias_len-strlen(ms)-2; // Number of bytes being inserted
1690 ep = &lp[strlen(lp)-1]; 1697 ep = &lp[strlen(lp)-1];
1691 if (offset > 1) { 1698 if (offset > 1) {
1692 ep[offset] = '\0'; 1699 ep[offset] = '\0';
1693 while (ep != (lp-1)) { 1700 while (ep != (lp-1)) {
1694 ep[offset-1] = *ep--; 1701 ep[offset-1] = *ep;
1702 ep--;
1695 } 1703 }
1696 } else { 1704 } else {
1697 if (offset <=0) { 1705 if (offset <=0) {
1698 while ((lp-1) != ep) { 1706 while ((lp-1) != ep) {
1699 lp[offset-1] = *lp++; 1707 lp[offset-1] = *lp;
1708 lp++;
1700 } 1709 }
1701 lp[offset-1]='\0'; 1710 lp[offset-1]='\0';
1702 } 1711 }
1703 } 1712 }
1704 // Insert the macro/alias data 1713 // Insert the macro/alias data