comparison packages/redboot/current/src/flash.c @ 171:42f843b391aa

Merge from eCos master repository on 2001-07-18-03:13:25-BST
author jlarmour
date Wed, 18 Jul 2001 11:38:39 +0000
parents d63db767121d
children cd45958b28ff
comparison
equal deleted inserted replaced
170:f664e0b5f88b 171:42f843b391aa
1002 printf("Error unlocking at %p: 0x%x(%s)\n", err_addr, stat, flash_errmsg(stat)); 1002 printf("Error unlocking at %p: 0x%x(%s)\n", err_addr, stat, flash_errmsg(stat));
1003 } 1003 }
1004 } 1004 }
1005 #endif 1005 #endif
1006 1006
1007 static int __flash_init = 0;
1008
1009 void
1010 _flash_info(void)
1011 {
1012 if (!__flash_init) return;
1013 printf("FLASH: %p - %p, %d blocks of %p bytes each.\n",
1014 flash_start, flash_end, blocks, (void *)block_size);
1015 }
1016
1007 static bool 1017 static bool
1008 do_flash_init(void) 1018 do_flash_init(void)
1009 { 1019 {
1010 int stat; 1020 int stat;
1011 static int init = 0; 1021
1012 1022 if (!__flash_init) {
1013 if (!init) { 1023 __flash_init = 1;
1014 init = 1;
1015 if ((stat = flash_init((void *)(workspace_end-FLASH_MIN_WORKSPACE), 1024 if ((stat = flash_init((void *)(workspace_end-FLASH_MIN_WORKSPACE),
1016 FLASH_MIN_WORKSPACE, printf)) != 0) { 1025 FLASH_MIN_WORKSPACE, printf)) != 0) {
1017 printf("FLASH: driver init failed!, status: 0x%x\n", stat); 1026 printf("FLASH: driver init failed!, status: 0x%x\n", stat);
1018 return false; 1027 return false;
1019 } 1028 }
1020 flash_get_limits((void *)0, (void **)&flash_start, (void **)&flash_end); 1029 flash_get_limits((void *)0, (void **)&flash_start, (void **)&flash_end);
1021 flash_get_block_info(&block_size, &blocks); 1030 flash_get_block_info(&block_size, &blocks);
1022 printf("FLASH: %p - %p, %d blocks of %p bytes each.\n",
1023 flash_start, flash_end, blocks, (void *)block_size);
1024 fis_work_block = (unsigned char *)(workspace_end-FLASH_MIN_WORKSPACE-block_size); 1031 fis_work_block = (unsigned char *)(workspace_end-FLASH_MIN_WORKSPACE-block_size);
1025 workspace_end = fis_work_block; 1032 workspace_end = fis_work_block;
1033 _flash_info();
1026 } 1034 }
1027 return true; 1035 return true;
1028 } 1036 }
1029 1037
1030 static void 1038 static void