Commit bd4cdc04 authored by alex@thinkpad's avatar alex@thinkpad
Browse files

QEMU: experimental serial flash support for 80D

using SFDATA.BIN from 70D, patched at 0x10004 from 09 8B C1 20 to 00 00 01 20
meaning: size of 70D's property block at 0x10000 is 0x12BC98 (data is shifted by 4 bytes)
but 80D expects a maximum size of 0x12000 in FE47BF40 ("Liar Valid Packages!!" if the size check fails)
so we trim the property block at the expected size of 0x12000
this will lose a few properties, but at least the emulation goes further (no SF dumper for D6 yet)
other 8MB SFDATA.BIN patched in the same way should also work (700D, 650D, EOSM, 6D),
but their data block at 0x10000 is larger, so more properties will be probably lost (not tested)

--HG--
branch : qemu
parent 442b6916bec5
......@@ -171,6 +171,7 @@ EOSRegionHandler eos_handlers[] =
{ "SDIO2", 0xC0C20000, 0xC0C20FFF, eos_handle_sdio, 2 },
{ "SFIO4", 0xC0C40000, 0xC0C40FFF, eos_handle_sfio, 4 },
{ "SDIO6", 0xC8060000, 0xC8060FFF, eos_handle_sdio, 6 },
{ "SFIO7", 0xC8070000, 0xC8070FFF, eos_handle_sfio, 7 },
{ "CFDMA0", 0xC0500000, 0xC0500FFF, eos_handle_cfdma, 0 },
{ "SDDMA1", 0xC0510000, 0xC05100FF, eos_handle_sddma, 1 },
{ "SDDMA3", 0xC0530000, 0xC0530FFF, eos_handle_sddma, 3 },
......@@ -3450,6 +3451,12 @@ static unsigned int eos_handle_rtc ( unsigned int parm, EOSState *s, unsigned in
unsigned int eos_handle_sio ( unsigned int parm, EOSState *s, unsigned int address, unsigned char type, unsigned int value )
{
if (parm == 2 && strcmp(s->model->name, "80D") == 0)
{
/* fixme: nicer way to handle model-specific handlers */
return eos_handle_sio_serialflash(parm, s, address, type, value);
}
if (s->rtc.transfer_format != RTC_INACTIVE)
{
/* RTC CS active? */
......@@ -5076,6 +5083,21 @@ unsigned int eos_handle_digic6 ( unsigned int parm, EOSState *s, unsigned int ad
ret = 0x10000;
break;
case 0xD20B0D8C:
/* Serial flash on 80D */
msg = "SPI";
if (s->sf)
{
serial_flash_set_CS(s->sf, (value & 1) ? 0 : 1);
}
if (!qemu_loglevel_mask(EOS_LOG_SFLASH))
{
if (value == 0xD0002 || value == 0xC0003)
return 0; // Quiet
}
ret = 0;
break;
case 0xD6040000: /* M3: appears to expect 0x3008000 or 0x3108000 */
ret = 0x3008000;
break;
......
......@@ -89,6 +89,7 @@ struct eos_model_desc eos_model_list[] = {
.uart_rx_interrupt = 0x2E,
.uart_tx_interrupt = 0x3A,
.rtc_cs_register = 0xC02201F8,
.serial_flash_interrupt = 0x17B,
},
{
/* defaults for DIGIC 6 cameras */
......@@ -116,6 +117,7 @@ struct eos_model_desc eos_model_list[] = {
.card_led_address = 0xD20B0A24,
.uart_rx_interrupt = 0x15D,
.uart_tx_interrupt = 0x16D,
.serial_flash_interrupt = 0xFE,
},
{
/* defaults for DIGIC 7 cameras */
......@@ -360,6 +362,7 @@ struct eos_model_desc eos_model_list[] = {
.ram_size = 0x40000000,
.ram_manufacturer_id = 0x18000103, /* RAM manufacturer: Micron */
.current_task_addr = 0x44F4,
.serial_flash_size = 0x800000,
},
{
.name = "750D",
......
......@@ -43,6 +43,7 @@ struct eos_model_desc {
uint32_t mpu_status_register;
uint32_t mpu_control_register;
uint32_t serial_flash_size;
uint32_t serial_flash_interrupt;
uint32_t sd_driver_interrupt;
uint32_t sd_dma_interrupt;
uint32_t cf_driver_interrupt;
......@@ -58,7 +59,7 @@ struct eos_model_desc {
/* this must match the number of items in the above struct */
/* note: you get a compile-time error if params[] is smaller than the struct */
uint32_t params[38];
uint32_t params[39];
};
} __attribute__((packed));
......
......@@ -7,6 +7,7 @@
#include "hw/sd/sd.h"
#include "hw/eos/serial_flash.h"
#include "hw/eos/eos_utils.h"
#include "model_list.h"
#include "serial_flash.h"
......@@ -14,6 +15,7 @@
#define SF_EPRINTF(fmt, ...) EPRINTF("[SFIO] ", EOS_LOG_SFLASH, fmt, ## __VA_ARGS__)
#define EE_DPRINTF(fmt, ...) DPRINTF("[EEPROM] ", EOS_LOG_SFLASH, fmt, ## __VA_ARGS__)
#define EE_EPRINTF(fmt, ...) EPRINTF("[EEPROM] ", EOS_LOG_SFLASH, fmt, ## __VA_ARGS__)
#define EE_VPRINTF(fmt, ...) VPRINTF("[EEPROM] ", EOS_LOG_SFLASH, fmt, ## __VA_ARGS__)
static const char * spi_opname(int code)
{
......@@ -142,7 +144,7 @@ uint8_t serial_flash_spi_read(SerialFlashState * sf)
sf->read_value = 0;
break;
}
EE_DPRINTF("READ >> 0x%X\n", ret);
EE_VPRINTF("READ >> 0x%X\n", ret);
return ret;
}
......@@ -310,7 +312,7 @@ unsigned int sfio_trigger_int_DMA ( EOSState *s )
{
SF_DPRINTF("sfio_trigger_int_DMA\n");
sfio_do_transfer(s);
eos_trigger_int(s, 0x17B, 0);
eos_trigger_int(s, s->model->serial_flash_interrupt, 0);
return 0;
}
......@@ -329,7 +331,7 @@ static inline void sfio_trigger_interrupt(EOSState *s, SDIOState *sd)
// if ((sd->status & 3) == 1 && sd->irq_flags)
// {
eos_trigger_int(s, 0x17B, 0);
eos_trigger_int(s, s->model->serial_flash_interrupt, 0);
//eos_trigger_int(s, 0xB1, 0);
// }
SF_DPRINTF("sfio_trigger_interrupt OUT\n");
......
22a09c06fd28e5a229b590cfea9e8134 calls-main.log
fc348adfc11dd60d46d1d010e0680708 calls-main.idc
dd2535ea1bd74a3234a17aecb566b2a1 calls-main-basic.log
351bb37a84d6fd77d37f8270ea6d2a9d calls-main-basic.idc
d8dc73b01e5e9df84b0113e572f1a101 calls-main.log
05e95c879de984e5c9acb835563dfe64 calls-main.idc
b01c9a07ce01e540e71614bc8c636304 calls-main-basic.log
456ea5e694946c531a0e08d7d5cd91c9 calls-main-basic.idc
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