Commit 5c6e788d authored by alex@thinkpad's avatar alex@thinkpad
Browse files

QEMU: simplified SFDMA mapping by removing model-specific redirection

(they are fairly consistent across all models)

--HG--
branch : qemu
parent 445254a0b691
......@@ -706,11 +706,11 @@ Serial flash
''''''''''''
To enable serial flash emulation (if your camera needs it, you'll see some relevant startup messages),
define `.serial_flash_size` in model_list.c and a few other parameters:
define ``.serial_flash_size`` in model_list.c and a few other parameters:
- chip select signal (CS): some GPIO register toggled before and after serial flash access
- SIO channel (used for SPI transfers)
- SFIO and SFDMA channels (for DMA transfers — Canon reused the same kind of DMA used for SD card).
- check SFIO and SFDMA in ``eos_handlers`` (for DMA transfers — Canon reused the same kind of DMA used for SD card).
Dumper: `sf_dump module <https://bitbucket.org/hudson/magic-lantern/src/unified/modules/sf_dump>`_.
......
......@@ -169,10 +169,10 @@ EOSRegionHandler eos_handlers[] =
{ "SDIO0", 0xC0C00000, 0xC0C00FFF, eos_handle_sdio, 0 },
{ "SDIO1", 0xC0C10000, 0xC0C10FFF, eos_handle_sdio, 1 },
{ "SDIO2", 0xC0C20000, 0xC0C20FFF, eos_handle_sdio, 2 },
{ "SDIO4", 0xC0C40000, 0xC0C40FFF, eos_handle_sdio, 4 },
{ "SFIO4", 0xC0C40000, 0xC0C40FFF, eos_handle_sfio, 4 },
{ "SDIO86", 0xC8060000, 0xC8060FFF, eos_handle_sdio, 0x86 },
{ "SDIO87", 0xC8070000, 0xC8070FFF, eos_handle_sdio, 0x87 },
{ "SDIO88", 0xC8080000, 0xC8080FFF, eos_handle_sdio, 0x88 },
{ "SFIO87", 0xC8070000, 0xC8070FFF, eos_handle_sfio, 0x87 },
{ "SFIO88", 0xC8080000, 0xC8080FFF, eos_handle_sfio, 0x88 },
{ "UartDMA", 0xC05000C0, 0xC05000DF, eos_handle_uart_dma, 0 },
{ "CFDMA0*", 0xC0500000, 0xC05000FF, eos_handle_cfdma, 0x0F },
{ "CFDMA10", 0xC0510000, 0xC051001F, eos_handle_cfdma, 0x10 },
......@@ -180,11 +180,11 @@ EOSRegionHandler eos_handlers[] =
{ "CFDMA30", 0xC0530000, 0xC053001F, eos_handle_cfdma, 0x30 },
//{ "SDDMA31", 0xC0530020, 0xC053003F, eos_handle_sddma, 0x31 },
//{ "SDDMA32", 0xC0530040, 0xC053005F, eos_handle_sddma, 0x32 },
{ "SDDMA33", 0xC0530060, 0xC053007F, eos_handle_sddma, 0x33 },
{ "SFDMA33", 0xC0530060, 0xC053007F, eos_handle_sfdma, 0x33 },
{ "SDDMA3*", 0xC0530000, 0xC05300FF, eos_handle_sddma, 0x3F },
{ "SDDMA82*", 0xC8020000, 0xC80200FF, eos_handle_sddma, 0x82F },
{ "SDDMA83*", 0xC8030000, 0xC80300FF, eos_handle_sddma, 0x83F },
{ "SDDMA84*", 0xC8040000, 0xC80400FF, eos_handle_sddma, 0x84F },
{ "SFDMA83*", 0xC8030000, 0xC80300FF, eos_handle_sfdma, 0x83F },
{ "SFDMA84*", 0xC8040000, 0xC80400FF, eos_handle_sfdma, 0x84F },
{ "CFATA0", 0xC0600000, 0xC060FFFF, eos_handle_cfata, 0 },
{ "CFATA2", 0xC0620000, 0xC062FFFF, eos_handle_cfata, 2 },
{ "CFATA16", 0xC0700000, 0xC070FFFF, eos_handle_cfata, 0x10 },
......@@ -3728,12 +3728,6 @@ static void sdio_trigger_interrupt(EOSState *s)
unsigned int eos_handle_sdio ( unsigned int parm, EOSState *s, unsigned int address, unsigned char type, unsigned int value )
{
if (s->sf && parm == s->model->serial_flash_sfio_ch)
{
/* serial flash DMA */
return eos_handle_sfio(parm, s, address, type, value);
}
unsigned int ret = 0;
const char * msg = 0;
intptr_t msg_arg1 = 0;
......@@ -3961,12 +3955,6 @@ unsigned int eos_handle_sdio ( unsigned int parm, EOSState *s, unsigned int addr
unsigned int eos_handle_sddma ( unsigned int parm, EOSState *s, unsigned int address, unsigned char type, unsigned int value )
{
if (s->sf && parm == s->model->serial_flash_sfdma_ch)
{
/* serial flash DMA */
return eos_handle_sfdma(parm, s, address, type, value);
}
unsigned int ret = 0;
const char * msg = 0;
......
......@@ -100,9 +100,7 @@ struct eos_model_desc eos_model_list[] = {
.uart_tx_interrupt = 0x3A,
.rtc_cs_register = 0xC02201F8,
.serial_flash_sio_ch = 4, /* SF params are only valid on models */
.serial_flash_sfio_ch = 4, /* where .serial_flash_size is set */
.serial_flash_sfdma_ch = 0x33,
.serial_flash_interrupt = 0x17B,
.serial_flash_interrupt = 0x17B, /* where .serial_flash_size is set */
.serial_flash_cs_register = 0xC022C0D4,
.serial_flash_cs_bitmask = 0x00100000, /* 0x83DC00 / 0x93D800 */
},
......@@ -132,8 +130,6 @@ struct eos_model_desc eos_model_list[] = {
.card_led_address = 0xD20B0A24,
.uart_rx_interrupt = 0x15D,
.uart_tx_interrupt = 0x16D,
.serial_flash_sfio_ch = 0x87,
.serial_flash_sfdma_ch = 0x83F,
.serial_flash_interrupt = 0xFE,
.serial_flash_cs_register = 0xD20B0D8C,
.serial_flash_cs_bitmask = 0x00010000, /* 0xC0003 / 0xD0002 */
......@@ -424,8 +420,6 @@ struct eos_model_desc eos_model_list[] = {
.mpu_mreq_interrupt = 0x12A, /* MREQ_ISR in InitializeIntercom */
.serial_flash_size = 0x1000000,
.serial_flash_sio_ch = 0,
.serial_flash_sfio_ch = 0x88,
.serial_flash_sfdma_ch = 0x84F,
.serial_flash_cs_register = 0xD20B037C,
},
{
......
......@@ -48,8 +48,6 @@ struct eos_model_desc {
uint32_t serial_flash_cs_register;
uint32_t serial_flash_cs_bitmask;
uint32_t serial_flash_sio_ch;
uint32_t serial_flash_sfio_ch;
uint32_t serial_flash_sfdma_ch;
uint32_t serial_flash_interrupt;
uint32_t sd_driver_interrupt;
uint32_t sd_dma_interrupt;
......@@ -66,7 +64,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[46];
uint32_t params[44];
};
} __attribute__((packed));
......
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