Magic Lantern Forum

Developing Magic Lantern => Reverse Engineering => Topic started by: 1% on September 02, 2012, 06:58:04 PM

Title: All about I/O.
Post by: 1% on September 02, 2012, 06:58:04 PM
Ok from my reading of FW and understanding this is what I gather.

600D can use:

CF Cards? - Driver components are there, I think HW is not.
SD Cards - Over DMA and SDIO (I think for eyefi cards, otherwise "CERES" in FW
USB - Called "HDD" in firmware and intertwined with PTP. Seems to imply can treat USB as storage


SD:
NSTUB(0xFF4F6D98, SD_ReConfiguration_0)

DMA mode has a few speeds officially:

Set Hi-Speed Mode( 24MHz )
Set Hi-Speed Mode( 48MHz )

Also can SD_SetBusWidth

There is also an MMC mode probably for slower access.

Set MMC Mode( 48MHz )'
'Set MMC Mode( 16MHz )'
'Set MMC Mode( 24MHz )'

And MMC_Set_Bus_Width


Are fast cards using 48mhz, highest bus width?
Can clock be raised for UHS cards (at least to full 50mhz) since in theory they would keep up. Can USB be used as storage, is PTP the bottleneck or the interface?


------
Ok, more info:

Mode is picked here:


if NE((sd_device.off_0x34 /*0x15780*/ & 0x2)):
        DryosDebugMsg(0x23, 0x3, 'Set Hi-Speed Mode( 48MHz )', sd_device.off_0x34 /*0x15780*/) => ret_DryosDebugMsg_FF4F6E48
        AJ_guess_SD_related_Storage_wait(0x1, 0x3) => ret_AJ_guess_SD_related_Storage_wait_FF4F6E6C
    if EQ((sd_device.off_0x34 /*0x15780*/ & 0x2)):
        DryosDebugMsg(0x23, 0x3, 'Set Hi-Speed Mode( 24MHz )', sd_device.off_0x34 /*0x15780*/) => ret_DryosDebugMsg_FF4F6E60
        AJ_guess_SD_related_Storage_wait(0x1, 0x2) => ret_AJ_guess_SD_related_Storage_wait_FF4F6E6C



But if you look at how that function is called:



AJ_SDCom_related__Storage_wait+24: AJ_guess_SD_related_Storage_wait(arg0, arg0)
ResetCard_maybe+56: AJ_guess_SD_related_Storage_wait(1, 0)
SD_ReConfiguration_0+212: AJ_guess_SD_related_Storage_wait(1, 2)
SD_ReConfiguration_0+648: AJ_guess_SD_related_Storage_wait(1, 2)
str:8MHz_eCreate_4MHz_WIDTH_4BIT_WIDTH_1BIT+528: AJ_guess_SD_related_Storage_wait(1, 2)
str:8MHz_eCreate_4MHz_WIDTH_4BIT_WIDTH_1BIT+632: AJ_guess_SD_related_Storage_wait(1, 1)
str:8MHz_eCreate_4MHz_WIDTH_4BIT_WIDTH_1BIT+948: AJ_guess_SD_related_Storage_wait(1, 1)
str:8MHz_eCreate_4MHz_WIDTH_4BIT_WIDTH_1BIT+992: AJ_guess_SD_related_Storage_wait(1, 2)
str:8MHz_eCreate_4MHz_WIDTH_4BIT_WIDTH_1BIT+1196: AJ_guess_SD_related_Storage_wait(1, 2)
str:8MHz_eCreate_4MHz_WIDTH_4BIT_WIDTH_1BIT+1240: AJ_guess_SD_related_Storage_wait(1, 1)


AJ_guess_SD_related_Storage_wait(1, 3) never appears and SDCOM is related to SDIO. How can I check mode being used?

----

Tried calling: AJ_guess_SD_related_Storage_wait(0x1, 0x3);

Did not affect speed test but sd card flashes when this command is run.

Running AJ_guess_SD_related_Storage_wait(0x1, 0x1);

Buffer fills sooner.

Running
Running AJ_guess_SD_related_Storage_wait(0x1, 0x6);

128K buffer write speed goes up to 11.1MB however. from 10.2 and its reproduceable.

From the register map:


0xC0400004 [32]  Clock selection
                   Bitmask
                   0x03000000 SD/MMC clock selection bits
                      0 unknown
                      1 16MHz
                      2 24MHz
                      3 48MHz

0xC0400008 [32]  Clock control
                   Bitmask - configures which module gets system clock
                   0x00000002 Engio LCLK
                   0x00000004 (ASIF related too)
                   0x00000008 SD/MMC clock 1
                   0x00000100 Display PWM module
                   0x00000400 Timer #0
                   0x00000800 Timer #1
                   0x00001000 Timer #2
                   0x00200000 SIO clock
                   0x01000000 DMA module #0 (fIPCClk)
                   0x02000000 ASIF
                   0x10000000 SD/MMC clock 2


Both of these registers read as 0 for me on digic poke.