Read about our upcoming Code of Conduct on this issue

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

QEMU: 40D GUI working!

- MPU RX register was read 8 bits at a time (other models so far used 16-bit reads)
- using 50D MPU spells
- button codes found with extract_button_codes.py, from existing ML port
- HotPlug: external monitor, USB, Toe, erase switch
- CFDMA: new channel, protocol tweaks, enabled interrupts
- Powersave workaround (GUI locked up after some seconds of inactivity, similar to 1300D)

--HG--
branch : qemu
parent ff562b6fe2b7
......@@ -178,6 +178,7 @@ EOSRegionHandler eos_handlers[] =
{ "SDDMA6", 0xC8020000, 0xC80200FF, eos_handle_sddma, 6 },
{ "CFATA0", 0xC0600000, 0xC060FFFF, eos_handle_cfata, 0 },
{ "CFATA2", 0xC0620000, 0xC062FFFF, eos_handle_cfata, 2 },
{ "CFATA16", 0xC0700000, 0xC070FFFF, eos_handle_cfata, 0x10 },
{ "UART", 0xC0800000, 0xC08000FF, eos_handle_uart, 0 },
{ "UART", 0xC0810000, 0xC08100FF, eos_handle_uart, 1 },
{ "UART", 0xC0270000, 0xC027000F, eos_handle_uart, 2 },
......@@ -2693,6 +2694,14 @@ unsigned int eos_handle_gpio ( unsigned int parm, EOSState *s, unsigned int addr
break;
case 0x011C: /* 40D, 450D */
msg = "VIDEO CONNECT";
ret = (strcmp(s->model->name, "40D") == 0) ? 0 : 1;
#ifdef IGNORE_CONNECT_POLL
return ret;
#endif
break;
case 0x0070: /* 600D, 60D */
case 0x0164:
case 0x0174: /* 5D3 */
......@@ -2716,8 +2725,8 @@ unsigned int eos_handle_gpio ( unsigned int parm, EOSState *s, unsigned int addr
case 0x015C:
case 0x017C: /* 5D3 */
case 0x0130: /* EOSM */
case 0x0100: /* 450D, 1000D */
case 0x0130: /* EOSM; 40D erase switch */
case 0x0100: /* 40D, 450D, 1000D */
msg = "USB CONNECT";
ret = 0;
#ifdef IGNORE_CONNECT_POLL
......@@ -2725,6 +2734,14 @@ unsigned int eos_handle_gpio ( unsigned int parm, EOSState *s, unsigned int addr
#endif
break;
case 0x0128: /* 40D TOE (Ceres) */
msg = "TOE CONNECT";
ret = 1;
#ifdef IGNORE_CONNECT_POLL
return ret;
#endif
break;
case 0x003C: /* 5D2, 50D */
case 0x0124: /* 100D? */
case 0x0150: /* 5D3 */
......@@ -3334,7 +3351,9 @@ static unsigned int eos_handle_rtc ( unsigned int parm, EOSState *s, unsigned in
{
uint8_t cmd = last_sio_txdata & 0x0F;
uint8_t reg = (last_sio_txdata>>4) & 0x0F;
if (!strcmp(s->model->name, "5D2") || !strcmp(s->model->name, "50D"))
if (!strcmp(s->model->name, "5D2") ||
!strcmp(s->model->name, "50D") ||
!strcmp(s->model->name, "40D"))
{
reg = last_sio_txdata & 0x0F;
cmd = (last_sio_txdata>>4) & 0x0F;
......@@ -3963,7 +3982,8 @@ 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 (strcmp(s->model->name, "5D2") == 0 ||
strcmp(s->model->name, "50D") == 0)
strcmp(s->model->name, "50D") == 0 ||
strcmp(s->model->name, "40D") == 0)
{
/* other models use SDDMA on the same address */
/* todo: make it generic? */
......@@ -4191,13 +4211,13 @@ unsigned int eos_handle_cfdma ( unsigned int parm, EOSState *s, unsigned int add
if(type & MODE_WRITE)
{
if (value == 0x3D)
if (value == 0x3D || value == 0x2D)
{
msg = "DMA write start";
s->cf.dma_written = 0;
s->cf.dma_write_request = 1;
}
else if (value == 0x39 || value == 0x21)
else if (value == 0x39 || value == 0x29 || value == 0x21)
{
msg = "DMA read start";
s->cf.dma_read = 0;
......@@ -4316,7 +4336,8 @@ unsigned int eos_handle_cfata ( unsigned int parm, EOSState *s, unsigned int add
if (offset == 7)
{
/* reading the status register clears peding interrupt */
s->cf.pending_interrupt = 0;
/* unsure actually - 40D doesn't like this */
//s->cf.pending_interrupt = 0;
}
}
break;
......@@ -4381,18 +4402,32 @@ unsigned int eos_handle_basic ( unsigned int parm, EOSState *s, unsigned int add
/* from C0100000 */
if (parm == 0)
{
if ((address & 0xFFF) == 0x1C)
switch(address & 0xFFF)
{
/* 5D classic: expects 1 at 0xFFFF01A4 */
ret = 1;
}
case 0x00C:
{
/* 40D: expects 2 at 0xFF819AA0 */
/* GUI locks up without it after entering PowerSave */
msg = "Powersave related?";
ret = 2;
break;
}
if ((address & 0xFFF) == 0x110)
{
/* 1300D: expects 0x80000000 at 0xFE0C038C */
/* GUI locks up without it after entering PowerSave */
msg = "Powersave related?";
ret = 0x80000000;
case 0x01C:
{
/* 5D classic: expects 1 at 0xFFFF01A4 */
ret = 1;
break;
}
case 0x110:
{
/* 1300D: expects 0x80000000 at 0xFE0C038C */
/* GUI locks up without it after entering PowerSave */
msg = "Powersave related?";
ret = 0x80000000;
break;
}
}
io_log("BASIC", s, address, type, value, ret, msg, 0, 0);
return ret;
......
......@@ -19,7 +19,9 @@ struct eos_model_desc eos_model_list[] = {
.current_task_name_offs = 0x0D,
.hptimer_interrupt = 0x10,
.sd_driver_interrupt = 0x4A,
.cf_driver_interrupt = 0x4A,
.sd_dma_interrupt = 0x29,
.cf_dma_interrupt = 0x30,
.card_led_address = 0xC02200E0,
.mpu_request_register = 0xC0220098, /* written in mpu_send (run with -d io) */
.mpu_request_bitmask = 0x00000002, /* 0x44 request, 0x46 idle */
......
......@@ -582,6 +582,7 @@ unsigned int eos_handle_sio3( unsigned int parm, EOSState *s, unsigned int addre
break;
case 0x1C: /* C082031C - data coming from MPU */
case 0x1D: /* 40D uses 8-bit reads */
if(type & MODE_WRITE)
{
......@@ -593,7 +594,8 @@ unsigned int eos_handle_sio3( unsigned int parm, EOSState *s, unsigned int addre
{
int hi = 0, lo = 0;
if (mpu_handle_get_data(s, &hi, &lo)) {
ret = (hi << 8) | lo;
/* 40D uses 8-bit reads (fixme: cleaner way to handle this) */
ret = ((hi << 8) | lo) >> ((address & 1) ? 8 : 0);
msg = "Data from MPU";
} else {
msg = "From MPU -> out of range (char %d of %d)";
......@@ -1105,6 +1107,7 @@ void mpu_spells_init(EOSState *s)
MPU_SPELL_SET_OTHER_CAM(1100D, 60D)
MPU_SPELL_SET_OTHER_CAM(1200D, 60D)
MPU_SPELL_SET_OTHER_CAM(1300D, 60D)
MPU_SPELL_SET_OTHER_CAM(40D, 50D)
MPU_SPELL_SET_OTHER_CAM(650D, 700D)
......@@ -1134,6 +1137,7 @@ void mpu_spells_init(EOSState *s)
MPU_BUTTON_CODES_OTHER_CAM(1300D, 1100D)
MPU_BUTTON_CODES(450D)
MPU_BUTTON_CODES_OTHER_CAM(1000D, 450D)
MPU_BUTTON_CODES(40D)
MPU_BUTTON_CODES(500D)
MPU_BUTTON_CODES(550D)
MPU_BUTTON_CODES(50D)
......
......@@ -165,6 +165,40 @@ static int button_codes_550D[] = {
[BGMT_END_OF_LIST] = 0x0000
};
static int button_codes_40D[] = {
[BGMT_INFO] = 0x0101,
[BGMT_JUMP] = 0x0201,
[BGMT_MENU] = 0x0001,
[BGMT_PICSTYLE] = 0x1701,
[BGMT_PLAY] = 0x0301,
[BGMT_JOY_CENTER] = 0x0B01,
[BGMT_PRESS_DIRECT_PRINT] = 0x0501,
[BGMT_PRESS_DOWN] = 0x0B09,
[BGMT_PRESS_DOWN_LEFT] = 0x0B08,
[BGMT_PRESS_DOWN_RIGHT] = 0x0B07,
[BGMT_PRESS_HALFSHUTTER] = 0x0900,
[BGMT_PRESS_LEFT] = 0x0B06,
[BGMT_PRESS_RIGHT] = 0x0B05,
[BGMT_PRESS_SET] = 0x0C01,
[BGMT_PRESS_UP] = 0x0B02,
[BGMT_PRESS_UP_LEFT] = 0x0B04,
[BGMT_PRESS_UP_RIGHT] = 0x0B03,
[BGMT_PRESS_ZOOM_IN] = 0x0901,
[BGMT_PRESS_ZOOM_OUT] = 0x0A01,
[BGMT_TRASH] = 0x0401,
[BGMT_UNPRESS_DIRECT_PRINT] = 0x0500,
[BGMT_UNPRESS_UDLR] = 0x0B00,
[BGMT_UNPRESS_ZOOM_OUT] = 0x0A00,
[BGMT_WHEEL_DOWN] = 0x0E01,
[BGMT_WHEEL_LEFT] = 0x0DFF,
[BGMT_WHEEL_RIGHT] = 0x0D01,
[BGMT_WHEEL_UP] = 0x0EFF,
[GMT_GUICMD_OPEN_BATT_COVER] = 0x1301,
[GMT_GUICMD_OPEN_SLOT_COVER] = 0x1201,
[GMT_GUICMD_START_AS_CHECK] = 0x1100,
[BGMT_END_OF_LIST] = 0x0000
};
static int button_codes_50D[] = {
[BGMT_FUNC] = 0x1601,
[BGMT_INFO] = 0x0101,
......
......@@ -27,4 +27,13 @@ msleep_log
b *0xFFD427B0
register_interrupt_log
# MPU communication
if 0
b *0xFFC8E2D0
mpu_send_log
b *0xFFC8D660
mpu_recv_log
end
cont
e78fec65cb0e8475a5071645b184373b format0.png
8a16d6932f425dd52e8bdfa0bbd5a28f format1.png
4312cb8cdd9720568d091ff80cdc5c6e format2.png
3d7d51f2576db998d0d7bb8f83725ccb format3.png
3a6577f6966dd8bd229b246f16b2526d format4.png
dc3a075df14d30264f4d28b2076aa7dd format5.png
81892f8d5c27cb7de9875a9b4cfdbdcb format6.png
3a6577f6966dd8bd229b246f16b2526d format8.png
28b2984fe47f005d74e580a1e789d868 format9.png
e78fec65cb0e8475a5071645b184373b menu0.png
2eccd5c7b98b502443c8c1fd2ce5abbf menu10.png
4312cb8cdd9720568d091ff80cdc5c6e menu11.png
3c1be6b1f8b768e802f521a4aa504191 menu12.png
4312cb8cdd9720568d091ff80cdc5c6e menu13.png
56069fc929280c8106fec0829db93af4 menu14.png
f58ba066f57e6ea33cc9f74dbec84de3 menu15.png
ed4e76858b6775809ee9ab346023b91a menu16.png
e9296d16ffed967ced32e55b1d98ab40 menu17.png
56069fc929280c8106fec0829db93af4 menu18.png
0c7cf8d61b533f13f6af3d38f44a67a6 menu19.png
8a16d6932f425dd52e8bdfa0bbd5a28f menu1.png
56069fc929280c8106fec0829db93af4 menu20.png
8d6c70149a3e7721d102668985fd0cff menu2.png
bd31d3a0501b7054e72c55f20becbd77 menu3.png
2eccd5c7b98b502443c8c1fd2ce5abbf menu4.png
3906cdd5dd892e76cd64998e3ea45aeb menu5.png
41cb1a830623b6a5c80672f578c1b235 menu6.png
2f68669ac1906403c150a1348c49381d menu7.png
6c15aa5ee9c89b49bb141c337708ad4d menu8.png
54c4818d4246a8cf1874dd9a234ae12f menu9.png
......@@ -20,7 +20,7 @@ POWERSHOT_CAMS=( EOSM3 EOSM10 EOSM5 A1100 )
EOS_SECONDARY_CORES=( 5D3eeko 5D4AE 7D2S )
# cameras able to run Canon GUI (menu tests)
GUI_CAMS=( 5D2 5D3 6D 50D 60D 70D
GUI_CAMS=( 5D2 5D3 6D 40D 50D 60D 70D
450D 500D 550D 600D 650D 700D
100D 1000D 1100D 1200D 1300D EOSM EOSM2 )
......@@ -97,6 +97,7 @@ declare -A MENU_SEQUENCE
MENU_SEQUENCE[5D2]="f1 i i i m up up up space m m w w p p" # sensor cleaning animation
MENU_SEQUENCE[5D3]="f1 i i i f1 i m left down down down space m m p p q space m right right space m down right space pgdn m q"
MENU_SEQUENCE[6D]="m left left up space space down space m right down space down space up up space down space m i i i q right space right space space space m m q p p"
MENU_SEQUENCE[40D]="m left down down down space up space up space m left space space m i i p p w w"
MENU_SEQUENCE[50D]="f1 i i i m up space space m w w p p" # sensor cleaning animation
MENU_SEQUENCE[60D]="f1 i i i i m left left up space m m p p"
MENU_SEQUENCE[70D]="m left up space down space m p p i i i i i q"
......@@ -122,6 +123,7 @@ declare -A FORMAT_SEQUENCE
FORMAT_SEQUENCE[5D2]="m right right right right $FMT_SEQ"
FORMAT_SEQUENCE[5D3]="m left left left left $FMT_SEQ_5D3"
FORMAT_SEQUENCE[6D]="m left left left $FMT_SEQ"
FORMAT_SEQUENCE[40D]="m left left left left $FMT_SEQ"
FORMAT_SEQUENCE[50D]="m down down $FMT_SEQ"
FORMAT_SEQUENCE[60D]="m left left left left $FMT_SEQ"
FORMAT_SEQUENCE[70D]="m left left left $FMT_SEQ"
......
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