Read about our upcoming Code of Conduct on this issue

Commit 63c8f03c authored by alex@thinkpad's avatar alex@thinkpad
Browse files

Recovery tool: fix model ID autodetection for EOS R / DIGIC 8

- model ID may be with MSB set (EOS R) or without it (all other models so far)
- don't try to read from serial flash
- use main address (0xE1FF9014), rather than a mirrored copy (0xE9FF9014)

--HG--
branch : recovery
parent 1ff7677fcaba
......@@ -213,39 +213,47 @@ static const struct model_data_s model_data[] =
uint32_t get_model_id()
{
uint32_t *model_ptr = (uint32_t *)0xF8002014;
uint32_t * model_ptr = NULL;
if(*model_ptr && *model_ptr < 0x00000FFF)
if (ml_loaded_as_thumb)
{
return *model_ptr;
/* DIGIC 7/8 */
model_ptr = (uint32_t *)0xE1FF9014;
uint32_t model_id = (*model_ptr) & ~0x80000000;
if(*model_ptr && model_id < 0x00000FFF)
{
return model_id;
}
}
/* newer models */
model_ptr = (uint32_t *)0xF8020014;
if(*model_ptr && *model_ptr < 0x00000FFF)
else
{
return *model_ptr;
}
/* DIGIC 4 */
model_ptr = (uint32_t *)0xF8002014;
if(*model_ptr && *model_ptr < 0x00000FFF)
{
return *model_ptr;
}
/* even newer models (DIGIC 6) */
model_ptr = (uint32_t *)0xFC060014;
if(*model_ptr && *model_ptr < 0x00000FFF)
{
return *model_ptr;
}
/* DIGIC 4+ */
model_ptr = (uint32_t *)0xF8001014;
if(*model_ptr && *model_ptr < 0x00000FFF)
{
return *model_ptr;
}
/* DIGIC 7 */
model_ptr = (uint32_t *)0xE9FF9014;
if(*model_ptr && *model_ptr < 0x00000FFF)
{
return *model_ptr;
}
/* DIGIC 5 */
model_ptr = (uint32_t *)0xF8020014;
if(*model_ptr && *model_ptr < 0x00000FFF)
{
return *model_ptr;
}
/* DIGIC 4+ */
model_ptr = (uint32_t *)0xF8001014;
if(*model_ptr && *model_ptr < 0x00000FFF)
{
return *model_ptr;
/* DIGIC 6 */
model_ptr = (uint32_t *)0xFC060014;
if(*model_ptr && *model_ptr < 0x00000FFF)
{
return *model_ptr;
}
}
return 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment