SD 4000 IS / IXUS 300 HS / IXY 30S porting thread - page 5 - DryOS Development - CHDK Forum supplierdeeply

SD 4000 IS / IXUS 300 HS / IXY 30S porting thread

  • 322 Replies
  • 163590 Views
*

Offline pixeldoc2000

  • ****
  • 356
  • IXUS900Ti 1.00C, IXUS300HS 1.00D
    • pixel::doc homebase
Re: SD 4000 IS / IXUS 300 HS / IXY 30S porting thread
« Reply #40 on: 01 / September / 2010, 12:23:05 »
Advertisements
As I'm using the sx200 as base for the port, and it is an "old" DRYOS version 2.3, release #0031, and sx210 is release #0043
SD4000 is also DRYOS 2.3 release #0043  ;)

Does gui_draw_debug_vals_osd() show the box with three memory values?
Code: [Select]
1: 8xxxxxx
2: ffe
3: 400000

Maybe physw_status address is not correct?
« Last Edit: 01 / September / 2010, 12:30:02 by pixeldoc2000 »

*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: SD 4000 IS / IXUS 300 HS / IXY 30S porting thread
« Reply #41 on: 01 / September / 2010, 13:04:22 »
yes Now I get the three vales perfectly, now I have to figure out how to convert them into the KEYS_MASK and the KeyMap is my first time.
For example I have iddle
Code: [Select]
1: 800a19b
2: fff3f
3: 400000

and meny
Code: [Select]
1: 800a19b
2: bff3f
3: 400000



*

Offline pixeldoc2000

  • ****
  • 356
  • IXUS900Ti 1.00C, IXUS300HS 1.00D
    • pixel::doc homebase
Re: SD 4000 IS / IXUS 300 HS / IXY 30S porting thread
« Reply #42 on: 01 / September / 2010, 13:24:48 »
yes Now I get the three vales perfectly, now I have to figure out how to convert them into the KEYS_MASK and the KeyMap is my first time.
For example I have iddle
Code: [Select]
1: 800a19b
2: fff3f
3: 400000

and meny
Code: [Select]
1: 800a19b
2: bff3f
3: 400000
So physw_status[1] is changing on key press:

Code: [Select]
0xfff3f = 11111111111100111111 (idle)
0xbff3f = 10111111111100111111 (menu?)
so your bit mask for this key is:
0x40000 = 01000000000000000000
So you have to put this into keymap:
Code: [Select]
{ 2, KEY_MENU , 0x00040000 },
« Last Edit: 01 / September / 2010, 13:30:13 by pixeldoc2000 »

*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: SD 4000 IS / IXUS 300 HS / IXY 30S porting thread
« Reply #43 on: 01 / September / 2010, 13:31:43 »
Get it, Thanks!,

and what It physw_status[0], also changes for some keys?

and what about KEYS_MASK ?
« Last Edit: 01 / September / 2010, 13:34:23 by asm1989 »


*

Offline pixeldoc2000

  • ****
  • 356
  • IXUS900Ti 1.00C, IXUS300HS 1.00D
    • pixel::doc homebase
Re: SD 4000 IS / IXUS 300 HS / IXY 30S porting thread
« Reply #44 on: 01 / September / 2010, 13:40:07 »
and what It physw_status[0], also changes for some keys?
Only one memory value does change on key press. If you have jogdial or feather control they change some bits too.
EDIT: it's possible some keys does change physw_status[0] or physw_status[1].

and what about KEYS_MASK ?
I guess this is used to increase processing speed in physw task by "ignoring" some bits which never change on key press.
EDIT: i would begin with watching all bits for changes:
Code: [Select]
#define KEYS_MASK0 (0x00000000)
#define KEYS_MASK1 (0x00000000)
#define KEYS_MASK2 (0x0FFF)
Maybe some chdk guru could confirm this?
« Last Edit: 01 / September / 2010, 13:50:36 by pixeldoc2000 »

*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: SD 4000 IS / IXUS 300 HS / IXY 30S porting thread
« Reply #45 on: 01 / September / 2010, 13:45:18 »
Thanks,


*

Offline reyalp

  • ******
  • 13792
Re: SD 4000 IS / IXUS 300 HS / IXY 30S porting thread
« Reply #46 on: 01 / September / 2010, 23:15:28 »

I guess this is used to increase processing speed in physw task by "ignoring" some bits which never change on key press.
EDIT: i would begin with watching all bits for changes:
Code: [Select]
#define KEYS_MASK0 (0x00000000)
#define KEYS_MASK1 (0x00000000)
#define KEYS_MASK2 (0x0FFF)
Maybe some chdk guru could confirm this?
KEYS_MASK selects just the bits that represents the keys, so they can be overridden without messing up the other stuff. e.g.
Code: [Select]
        physw_status[0] = (kbd_new_state[0] & (~KEYS_MASK0)) |  (kbd_mod_state[0] & KEYS_MASK0);
clears the key bits in the real hardware state, and ORs in the modified ones.
Don't forget what the H stands for.

*

Offline pixeldoc2000

  • ****
  • 356
  • IXUS900Ti 1.00C, IXUS300HS 1.00D
    • pixel::doc homebase
Re: SD 4000 IS / IXUS 300 HS / IXY 30S porting thread
« Reply #47 on: 02 / September / 2010, 12:16:27 »
KEYS_MASK selects just the bits that represents the keys, so they can be overridden without messing up the other stuff. e.g.
Code: [Select]
       physw_status[0] = (kbd_new_state[0] & (~KEYS_MASK0)) |  (kbd_mod_state[0] & KEYS_MASK0);
clears the key bits in the real hardware state, and ORs in the modified ones.
Well, i should have tried harder to understand that code piece  ::)
Thanx!
« Last Edit: 02 / September / 2010, 12:29:46 by pixeldoc2000 »


*

Offline pixeldoc2000

  • ****
  • 356
  • IXUS900Ti 1.00C, IXUS300HS 1.00D
    • pixel::doc homebase
Re: SD 4000 IS / IXUS 300 HS / IXY 30S porting thread
« Reply #48 on: 02 / September / 2010, 12:17:42 »
I'm still struggeling to find a way to overwrite physw_status on this camera.
Problem is GetKbdState is totaly different to other (older) cameras...

SD4000
Code: (asm) [Select]
ROM:FF861908 GetKbdState                             ; CODE XREF: kbd_read_keys+20
ROM:FF861908                 STMFD   SP!, {R4-R6,LR}
ROM:FF86190C                 LDR     R6, =0x24BC
ROM:FF861910                 MOV     R4, R0
ROM:FF861914                 LDR     R0, [R6,#4]
ROM:FF861918                 LDR     R5, =0xC0220000
ROM:FF86191C                 CMP     R0, #0
ROM:FF861920                 LDRNE   R0, [R5,#0x114]
ROM:FF861924                 BICNE   R0, R0, #2
ROM:FF861928                 STRNE   R0, [R5,#0x114]
ROM:FF86192C                 MOVNE   R0, #3
ROM:FF861930                 BLNE    _sub_FF8618C4__PhySwGpioMatSw.c__2 ; LOCATION: PhySwGpioMatSw.c:2
ROM:FF861934                 LDR     R0, [R5,#0x200]
ROM:FF861938                 STR     R0, [R4]
ROM:FF86193C                 LDR     R0, [R5,#0x204]
ROM:FF861940                 STR     R0, [R4,#4]
ROM:FF861944                 LDR     R0, [R5,#0x208]
ROM:FF861948                 STR     R0, [R4,#8]
ROM:FF86194C                 MOV     R0, R4
ROM:FF861950                 BL      sub_FF861080
ROM:FF861954                 STR     R0, [R4]
ROM:FF861958                 MOV     R0, #0
ROM:FF86195C                 STR     R0, [R4,#4]
ROM:FF861960                 STR     R0, [R4,#8]
ROM:FF861964                 LDR     R0, [R6,#4]
ROM:FF861968                 CMP     R0, #0
ROM:FF86196C                 LDREQ   R0, [R6,#0xC]
ROM:FF861970                 STREQ   R0, [R4,#4]
ROM:FF861974                 BEQ     loc_FF861A10
ROM:FF861978                 MOV     R0, #0
ROM:FF86197C                 BL      sub_FF8610AC
ROM:FF861980                 STR     R0, [R4,#4]
ROM:FF861984                 LDR     R0, [R5,#0x114]
ROM:FF861988                 ORR     R0, R0, #2
ROM:FF86198C                 STR     R0, [R5,#0x114]
ROM:FF861990                 MOV     R0, #0x1E
ROM:FF861994                 BL      _sub_FF8618C4__PhySwGpioMatSw.c__2 ; LOCATION: PhySwGpioMatSw.c:2
ROM:FF861998                 LDR     R0, [R5,#0x118]
ROM:FF86199C                 BIC     R0, R0, #2
ROM:FF8619A0                 STR     R0, [R5,#0x118]
ROM:FF8619A4                 MOV     R0, #3
ROM:FF8619A8                 BL      _sub_FF8618C4__PhySwGpioMatSw.c__2 ; LOCATION: PhySwGpioMatSw.c:2
ROM:FF8619AC                 MOV     R0, #1
ROM:FF8619B0                 BL      sub_FF8610AC
ROM:FF8619B4                 LDR     R1, [R4,#4]
ROM:FF8619B8                 ORR     R0, R0, R1
ROM:FF8619BC                 STR     R0, [R4,#4]
ROM:FF8619C0                 LDR     R0, [R5,#0x118]
ROM:FF8619C4                 ORR     R0, R0, #2
ROM:FF8619C8                 STR     R0, [R5,#0x118]
ROM:FF8619CC                 MOV     R0, #0x1E
ROM:FF8619D0                 BL      _sub_FF8618C4__PhySwGpioMatSw.c__2 ; LOCATION: PhySwGpioMatSw.c:2
ROM:FF8619D4                 LDR     R0, [R5,#0x11C]
ROM:FF8619D8                 BIC     R0, R0, #2
ROM:FF8619DC                 STR     R0, [R5,#0x11C]
ROM:FF8619E0                 MOV     R0, #3
ROM:FF8619E4                 BL      _sub_FF8618C4__PhySwGpioMatSw.c__2 ; LOCATION: PhySwGpioMatSw.c:2
ROM:FF8619E8                 MOV     R0, #2
ROM:FF8619EC                 BL      sub_FF8610AC
ROM:FF8619F0                 LDR     R1, [R4,#4]
ROM:FF8619F4                 ORR     R0, R0, R1
ROM:FF8619F8                 STR     R0, [R4,#4]
ROM:FF8619FC                 LDR     R0, [R5,#0x11C]
ROM:FF861A00                 ORR     R0, R0, #2
ROM:FF861A04                 STR     R0, [R5,#0x11C]
ROM:FF861A08                 LDR     R0, [R4,#4]
ROM:FF861A0C                 STR     R0, [R6,#0xC]
ROM:FF861A10
ROM:FF861A10 loc_FF861A10                            ; CODE XREF: GetKbdState+6C
ROM:FF861A10                 LDR     R0, [R6,#4]
ROM:FF861A14                 MOV     R1, #1
ROM:FF861A18                 BIC     R0, R1, R0
ROM:FF861A1C                 STR     R0, [R6,#4]
ROM:FF861A20                 LDMFD   SP!, {R4-R6,PC}

SD990 (like most other DryOs cameras like A720)
Code: (asm) [Select]
ROM:FF84A390 GetKbdState                             ; CODE XREF: kbd_read_keys+20
ROM:FF84A390                 LDR     R1, =0xC0220000
ROM:FF84A394                 LDR     R2, [R1,#0x200]
ROM:FF84A398                 STR     R2, [R0]
ROM:FF84A39C                 LDR     R2, [R1,#0x204]
ROM:FF84A3A0                 STR     R2, [R0,#4]
ROM:FF84A3A4                 LDR     R1, [R1,#0x208]
ROM:FF84A3A8                 MOV     R1, R1,LSL#16
ROM:FF84A3AC                 MOV     R1, R1,LSR#16
ROM:FF84A3B0                 STR     R1, [R0,#8]
ROM:FF84A3B4                 BX      LR

If i try to overwrite physw_status like SD990 for example, camera just shutdown without assert or else...
SD990 kbd.c
Code: (c) [Select]
...
physw_status[0] = kbd_new_state[0];
physw_status[1] = kbd_new_state[1];
physw_status[2] = kbd_new_state[2];
...
« Last Edit: 02 / September / 2010, 12:33:47 by pixeldoc2000 »

*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: SD 4000 IS / IXUS 300 HS / IXY 30S porting thread
« Reply #49 on: 02 / September / 2010, 15:47:24 »
In sx210 its like your camera, in sx210 at FF861D88,

But if you look at the sx200 port, the function is almost identical at FF848340 , so maybe there is a starting point.

And there is a working port for the sx200
« Last Edit: 02 / September / 2010, 15:53:37 by asm1989 »

 

Related Topics