comparison packages/devs/flash/intel/bootblock/current/src/bootblock_flash.c @ 162:2395031e7a66

Merge from eCos master repository on 2001-06-15-06:43:03-BST
author jlarmour
date Fri, 15 Jun 2001 22:45:04 +0000
parents 6b5f480c6929
children e0c0827131d1
comparison
equal deleted inserted replaced
161:ac086aa3217e 162:2395031e7a66
69 memcpy(_flash_query, &flash_query, code_len); 69 memcpy(_flash_query, &flash_query, code_len);
70 HAL_DCACHE_SYNC(); // Should guarantee this code will run 70 HAL_DCACHE_SYNC(); // Should guarantee this code will run
71 HAL_ICACHE_INVALIDATE_ALL(); // is also required to avoid old contents 71 HAL_ICACHE_INVALIDATE_ALL(); // is also required to avoid old contents
72 stat = (*_flash_query)(data); 72 stat = (*_flash_query)(data);
73 #if DEBUG 73 #if DEBUG
74 printf("stat = %x\n", stat); 74 (*flash_info.pf)("stat = %x\n", stat);
75 dump_buf(data, sizeof(data)); 75 dump_buf(data, sizeof(data));
76 #endif 76 #endif
77 77
78 if (data[0] != FLASH_Intel_code) { 78 if (data[0] != FLASH_Intel_code) {
79 printf("Not Intel = %x\n", data[0]); 79 (*flash_info.pf)("Not Intel = %x\n", data[0]);
80 return FLASH_ERR_HWR; 80 return FLASH_ERR_HWR;
81 } 81 }
82 82
83 // FIXME: More devices, comments, etc 83 // FIXME: More devices, comments, etc
84 if (data[1] == (unsigned short)0x8897) { 84 if (data[1] == (unsigned short)0x8897) {
86 region_size = 0x20000; 86 region_size = 0x20000;
87 } else if (data[1] == (unsigned short)0x88f4) { 87 } else if (data[1] == (unsigned short)0x88f4) {
88 num_regions = 32; // (only use one for now)*4; // 4 devices in serial, each having 32 regions 88 num_regions = 32; // (only use one for now)*4; // 4 devices in serial, each having 32 regions
89 region_size = 0x10000; 89 region_size = 0x10000;
90 } else { 90 } else {
91 printf("Unknown device type: %x\n", data[1]); 91 (*flash_info.pf)("Unknown device type: %x\n", data[1]);
92 return FLASH_ERR_HWR; 92 return FLASH_ERR_HWR;
93 } 93 }
94 94
95 // Hard wired for now FIXME 95 // Hard wired for now FIXME
96 flash_info.block_size = region_size; 96 flash_info.block_size = region_size;
109 // Map a hardware status to a package error 109 // Map a hardware status to a package error
110 int 110 int
111 flash_hwr_map_error(int err) 111 flash_hwr_map_error(int err)
112 { 112 {
113 if (err & 0x007E007E) { 113 if (err & 0x007E007E) {
114 printf("Err = %x\n", err); 114 (*flash_info.pf)("Err = %x\n", err);
115 if (err & 0x00400040) { 115 if (err & 0x00400040) {
116 return FLASH_ERR_ERASE_SUSPEND; 116 return FLASH_ERR_ERASE_SUSPEND;
117 } else 117 } else
118 if (err & 0x00040004) { 118 if (err & 0x00040004) {
119 return FLASH_ERR_PROGRAM_SUSPEND; 119 return FLASH_ERR_PROGRAM_SUSPEND;