USB-remote and memory-mapped I/O (MMIO) - General Discussion and Assistance - CHDK Forum supplierdeeply

USB-remote and memory-mapped I/O (MMIO)

  • 5 Replies
  • 4445 Views
USB-remote and memory-mapped I/O (MMIO)
« on: 07 / February / 2008, 11:07:15 »
Advertisements
All of the 'A' series cameras that suport USB-remote, read hardware-registers mmio0 or mmio1 ... apart from the A570 that reads mmio2.

kbd_fetch_data(kbd_new_state) reads the full value of mmio0 and mmio1 but masks mmio2 with 0x0000FFFF.

That means physw_status[2] is similarly masked.

Why is that ?

The USB_MASK for the A570 is claimed to be 0x40000.

The script detects the remote key by checking the status of the following :-

usb_power = (physw_status[2] & USB_MASK)==USB_MASK;


That should fail but the script detects it and continues with the shoot command.

The shoot command is intercepted and the following check made :-

   do
         {
          x = (long)*mmio2;         
           }
  while(((x&USB_MASK)==USB_MASK)&&  ((int)get_tick_count()-tick < DELAY_TIMEOUT));
 

i.e. detect button release or timeout.

Unlike with the other cameras, this does not work and the above 'while' fails and the photo is taken immediately (without releasing the button).

It is difficult to see how directly monitoring the hardware register could possibly fail.

Any ideas about both the above problems ?



David

*

Offline ewavr

  • ****
  • 1057
  • A710IS
Re: USB-remote and memory-mapped I/O (MMIO)
« Reply #1 on: 07 / February / 2008, 11:45:27 »
Any ideas about both the above problems ?

Possible solution: do not use kbd_fetch_data() for reading USB power status bit, but _kbd_read_keys_r2().
Maybe this function reads other I/O ports (also USB power status) and updates physw_status[] array.

Re: USB-remote and memory-mapped I/O (MMIO)
« Reply #2 on: 07 / February / 2008, 12:02:54 »
Maybe this function ....   updates physw_status[] array.


So, Canon firmware functions can alter the physw_status[] array  ?


Even so, how can reading MMIO give an incorrect value ?

Maybe I should read it twice ?

*

Offline ewavr

  • ****
  • 1057
  • A710IS
Re: USB-remote and memory-mapped I/O (MMIO)
« Reply #3 on: 07 / February / 2008, 18:25:28 »
Well, kbd_fetch_data(physw_status) fills physw_status[] with some values (keyboard status), and kbd_read_keys_r2(physw_status) again modifies this array (with SD card lock status and USB power status).
But kbd_read_keys_r2() is too complicated for me, I cannot make reverse engineering for it. :(



Re: USB-remote and memory-mapped I/O (MMIO)
« Reply #4 on: 07 / February / 2008, 19:20:03 »
The strange this is ... on my A620 if I display the contents of mmio1 in Debug\Misc Values display, you can see the bit change if you press the USB-remote.

On the A570, if you display the contents of mmio2 the display does not change when you press the button.

On the Debug\Misc display, physw_status[2]  DOES change when you press the button.

The strange this is, the USB status is on the fifth nibble and the keyboard routine only reads the lower four nibbles (setting upper four to zero).

How can this be ?

Re: USB-remote and memory-mapped I/O (MMIO)
« Reply #5 on: 30 / March / 2008, 11:38:50 »
Were you able to find an answer to this question?
~~~~~~~~~~~~~~~~~~~~~

<")%%%><<

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal