Changeset 1334


Ignore:
Timestamp:
09/12/11 02:40:15 (20 months ago)
Author:
reyalp
Message:

ixus120_sd940 updates from waterwingz in http://chdk.setepontos.com/index.php?topic=650.msg73050#msg73050

  • Corrects bug in capt_seq.c for all firmware versions.
  • Enables USB remote operation in "Synchable Remote" mode.
Location:
trunk/platform/ixus120_sd940
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/platform/ixus120_sd940/kbd.c

    r1056 r1334  
    7373void wait_until_remote_button_is_released(void) 
    7474{ 
    75  
    76 long x[3]; 
    7775int count1; 
    7876int count2; 
     
    208206void __attribute__((naked,noinline)) mykbd_task() 
    209207{ 
    210 #if 0 
    211     /* WARNING 
    212      * Stack pointer manipulation performed here! 
    213      * This means (but not limited to): 
    214      *  function arguments destroyed; 
    215      *  function CAN NOT return properly; 
    216      *  MUST NOT call or use stack variables before stack 
    217      *  is setup properly; 
    218      * 
    219      */ 
    220  
    221         register int i; 
    222         register long *newstack; 
    223  
    224 #ifndef MALLOCD_STACK 
    225         newstack = (void*)kbd_stack; 
    226 #else 
    227         newstack = malloc(NEW_SS); 
    228 #endif 
    229  
    230         for (i=0;i<NEW_SS/4;i++) 
    231                 newstack[i]=0xdededede; 
    232  
    233         asm volatile ( 
    234                 "MOV    SP, %0" 
    235                 :: "r"(((char*)newstack)+NEW_SS) 
    236                 : "memory" 
    237         ); 
    238 #endif 
    239  
    240208        mykbd_task_proceed(); 
    241  
    242         /* function can be modified to restore SP here... 
    243          */ 
    244209 
    245210        _ExitTask(); 
     
    261226 
    262227volatile int jogdial_stopped=0; 
    263 void disable_SD_writeprotect() 
    264 { 
    265         physw_status[SD_READONLY_REG] = physw_status[SD_READONLY_REG] & ~SD_READONLY_FLAG; 
    266 } 
    267228 
    268229void my_kbd_read_keys() 
     
    277238        _platformsub_kbd_fetch_data(kbd_new_state); 
    278239 
     240        /* Get the rest of the buttons */ 
     241         
     242        _kbd_read_keys_r2(kbd_new_state); 
     243         
    279244        kbd_new_state[2] |=0x00008000;  /// disable the battery door switch 
    280245 
     
    295260                physw_status[0] |= alt_mode_key_mask;  /// disable the ALT mode button 
    296261 
    297                 physw_status[SD_READONLY_REG] = physw_status[SD_READONLY_REG] & ~SD_READONLY_FLAG; 
    298262        } 
    299263        else { 
     
    308272                } 
    309273        } 
    310  
    311         _kbd_read_keys_r2(physw_status); 
    312  
    313         physw_status[2] = physw_status[SD_READONLY_REG] & ~SD_READONLY_FLAG; 
    314  
     274         
     275         
    315276        remote_key = (physw_status[2] & USB_MASK)==USB_MASK; 
    316277        if (remote_key) { 
     
    321282                remote_count = 0; 
    322283        } 
     284         
    323285 
    324286        if (conf.remote_enable) { 
     
    329291} 
    330292 
    331 #ifdef original_way_to_handle_display_key 
    332  
    333 void my_kbd_read_keys() 
    334 { 
    335         static int altDownTimer=0; 
    336         const int DISP_DOWN_TIME = 20; 
    337  
    338         static int isAlt=0, isDisplay=0; 
    339         static int altDownTimer=0; 
    340  
    341         kbd_prev_state[0] = kbd_new_state[0]; 
    342         kbd_prev_state[1] = kbd_new_state[1]; 
    343         kbd_prev_state[2] = kbd_new_state[2]; 
    344  
    345         _platformsub_kbd_fetch_data(kbd_new_state); 
    346  
    347         kbd_new_state[2] |=0x00008000;  /// disable the battery door switch 
    348  
    349         // support for short/long press of Display 
    350         if (kbd_is_key_pressed(KEY_DISPLAY)) {                  // Display held down 
    351                 altDownTimer++; 
    352         } 
    353         if (altDownTimer > 50) {                // TODO - determine best threshold 
    354                 isDisplay = 1;                                                          // held down long enough for Display 
    355         } 
    356         else if (!kbd_is_key_pressed(KEY_DISPLAY)) { 
    357                 if (altDownTimer > 0) 
    358                         isAlt = 1; 
    359                 altDownTimer = 0; 
    360         } 
    361  
    362         if (kbd_process() == 0) { 
    363                 // leave it alone... 
    364                 physw_status[0] = kbd_new_state[0]; 
    365                 physw_status[1] = kbd_new_state[1]; 
    366                 physw_status[2] = kbd_new_state[2]; 
    367  
    368                 physw_status[0] |= alt_mode_key_mask;  /// disable the ALT mode button 
    369  
    370                 physw_status[SD_READONLY_REG] = physw_status[SD_READONLY_REG] & ~SD_READONLY_FLAG; 
    371         } 
    372         else { 
    373                 // override keys 
    374  
    375                 physw_status[0] = (kbd_new_state[0] & (~KEYS_MASK0)) |(kbd_mod_state[0] & KEYS_MASK0); 
    376                 physw_status[1] = (kbd_new_state[1] & (~KEYS_MASK1)) | (kbd_mod_state[1] & KEYS_MASK1); 
    377                 physw_status[2] = (kbd_new_state[2] & (~KEYS_MASK2)) |(kbd_mod_state[2] & KEYS_MASK2); 
    378  
    379                 if (isDisplay) 
    380                         physw_status[0] &= ~alt_mode_key_mask;  /// press the Display button 
    381         } 
    382  
    383         _kbd_read_keys_r2(physw_status); 
    384  
    385         physw_status[2] = physw_status[SD_READONLY_REG] & ~SD_READONLY_FLAG; 
    386  
    387         remote_key = (physw_status[2] & USB_MASK)==USB_MASK; 
    388         if (remote_key) { 
    389                 remote_count += 1; 
    390         } 
    391         else if (remote_count) { 
    392                 usb_power = remote_count; 
    393                 remote_count = 0; 
    394         } 
    395  
    396         if (conf.remote_enable) { 
    397                 physw_status[2] = physw_status[SD_READONLY_REG] & ~(SD_READONLY_FLAG | USB_MASK); 
    398         } else { 
    399                 physw_status[2] = physw_status[SD_READONLY_REG] & ~SD_READONLY_FLAG; 
    400         } 
    401 } 
    402 #endif 
     293 
    403294 
    404295 
  • trunk/platform/ixus120_sd940/platform_camera.h

    r1255 r1334  
    2222 
    2323        #define CAM_DRYOS_2_3_R39                       1  //stat is different, as well as some other functions 
    24         #define SYNCHABLE_REMOTE_NOT_ENABLED 1 
     24 
     25//      #define SYNCHABLE_REMOTE_NOT_ENABLED 1 
     26 
    2527    #define CAM_PROPSET                 3 
    2628    #define CAM_DRYOS                   1 
  • trunk/platform/ixus120_sd940/sub/100e/capt_seq.c

    r1189 r1334  
    101101"       MOV     R0, R5 \n"    
    102102 
    103 //"     BL      sub_FF9425F4 \n"  
    104 "       BL      sub_FF9425F4_my \n"                     // patched  
     103//"     BL      sub_FF942410 \n"  
     104"       BL      sub_FF942410_my \n"                     // patched  
    105105                      
    106106"       TST     R0, #1 \n"                            
     
    280280 
    281281/*---------------------------------------------------------------------- 
    282         sub_FF9425F4_my()  - capt_seq_task() 
     282        sub_FF942410_my()  - capt_seq_task() 
    283283-----------------------------------------------------------------------*/ 
    284 void __attribute__((naked,noinline)) sub_FF9425F4_my() { 
     284void __attribute__((naked,noinline)) sub_FF942410_my() { 
    285285asm volatile ( 
    286286"       STMFD   SP!, {R0-R8,LR} \n"                 
     
    333333"       BL      capt_seq_hook_set_nr\n" 
    334334  
    335 "       LDR     R0, [R4, #0x1C] \n"                   
    336 "       CMP     R0, #0 \n"                            
    337 "       MOVNE   R0, #1 \n"                          
    338 "       STRNE   R0, [R5] \n"                        
    339 "       LDR     R0, [R5, #4] \n"                      
    340 "       BL      sub_FF90B7F8 \n"                       
    341 "       LDR     R0, [R5, #8] \n"                      
    342 "       BL      sub_FF8B9E48 \n"                       
    343 "       MOV     R0, #1 \n"                            
    344 "       BL      sub_FF8B9E54 \n"                       
    345 "       LDR     R0, =0xFF941E0C \n"                 
    346 "       MOV     R1, R4 \n"                            
    347 "       BL      sub_FF8B9E24 \n"                       
    348 "       LDR     R0, [R5] \n"                          
    349 "       CMP     R0, #5 \n"                            
    350 "       ADDLS   PC, PC, R0, LSL #2 \n"     
    351           
    352 "       B       sub_FF9425CC \n"   // go to the ROM                        
     335"       B       sub_FF9424C0 \n"   // go back to the ROM                     
    353336        ); 
    354337} 
     
    409392"       BL      sub_FF942328 \n"                       
    410393"       BL      sub_FF942DA0 \n"                       
    411 "       MOV     R0, R4 \n"    
    412          
    413 // this patch causes a crash when shooting 
    414 // it is unknown what the effect is of not calling this (called elsewhere)                                       
    415 "       BL      sub_FF9425F4 \n"      
    416 //"     BL      sub_FF9425F4_my \n"                       
     394"       MOV     R0, R4 \n"      
     395                         
     396//"     BL      sub_FF942410 \n"      
     397"       BL      sub_FF942410_my \n"                             // patched         
     398             
    417399"       MOV     R5, R0 \n"   
    418400"       BL              capt_seq_hook_raw_here\n"  //----------->>                             
  • trunk/platform/ixus120_sd940/sub/100e/stubs_auto.S

    r1189 r1334  
    159159STUB(FF8B44EC) 
    160160STUB(FF8B4588) 
    161 STUB(FF8B9E24) 
    162 STUB(FF8B9E48) 
    163 STUB(FF8B9E54) 
    164161STUB(FF8D7AE8) 
    165162STUB(FF8D9F0C) 
    166163STUB(FF8DB75C) 
    167164STUB(FF90B548) 
    168 STUB(FF90B7F8) 
    169165STUB(FF9181E0) 
    170166STUB(FF9182A8) 
     
    194190STUB(FF941CAC) 
    195191STUB(FF942328) 
    196 STUB(FF9425CC) 
    197 STUB(FF9425F4) 
     192STUB(FF942410) 
     193STUB(FF9424C0) 
    198194STUB(FF9426C8) 
    199195STUB(FF942724) 
  • trunk/platform/ixus120_sd940/sub/101a/capt_seq.c

    r1149 r1334  
    333333"       BL      capt_seq_hook_set_nr\n" 
    334334 
    335                      
    336 "       LDR     R0, [R4, #0x1C] \n"                   
    337 "       CMP     R0, #0 \n"                            
    338 "       MOVNE   R0, #1 \n"                          
    339 "       STRNE   R0, [R5] \n"                    
    340 "       LDR     R0, [R5, #4] \n"                      
    341 "       BL      sub_FF90B814 \n"                       
    342 "       LDR     R0, [R5, #8] \n"                      
    343 "       BL      sub_FF8B9E64 \n"                       
    344 "       MOV     R0, #1 \n"                            
    345 "       BL      sub_FF8B9E70 \n"                       
    346 "       LDR     R0, =0xFF941E28 \n"                   
    347 "       MOV     R1, R4 \n"                            
    348 "       BL      sub_FF8B9E40 \n"                       
    349 "       LDR     R0, [R5] \n"                      
    350 "       CMP     R0, #5 \n"                            
    351 "       ADDLS   PC, PC, R0, LSL #2 \n"              
    352  
    353 "       B       sub_FF9425E8 \n"   // go to the ROM                    
     335"       B       sub_FF9424DC \n"    
    354336        ); 
    355337} 
     
    410392"       BL      sub_FF942344 \n"                       
    411393"       BL      sub_FF942DBC \n"                       
    412 "       MOV     R0, R4 \n"   
    413  
    414 // this patch causes a crash when shooting 
    415 // it is unknown what the effect is of not calling this (called elsewhere)                        
    416 "       BL      sub_FF94242C \n"   
    417 //"     BL      sub_FF94242C_my \n"                     
     394"       MOV     R0, R4 \n"      
     395             
     396//"     BL      sub_FF94242C \n"   
     397"       BL      sub_FF94242C_my \n"    
     398                  
    418399"       MOV     R5, R0 \n"   
    419400"       BL              capt_seq_hook_raw_here\n"  //----------->>                          
  • trunk/platform/ixus120_sd940/sub/101a/stubs_auto.S

    r1149 r1334  
    159159STUB(FF8B4508) 
    160160STUB(FF8B45A4) 
    161 STUB(FF8B9E40) 
    162 STUB(FF8B9E64) 
    163 STUB(FF8B9E70) 
    164161STUB(FF8D7B04) 
    165162STUB(FF8D9F28) 
    166163STUB(FF8DB778) 
    167164STUB(FF90B564) 
    168 STUB(FF90B814) 
    169165STUB(FF9181FC) 
    170166STUB(FF9182C4) 
     
    195191STUB(FF942344) 
    196192STUB(FF94242C) 
    197 STUB(FF9425E8) 
     193STUB(FF9424DC) 
    198194STUB(FF9426E4) 
    199195STUB(FF942740) 
  • trunk/platform/ixus120_sd940/sub/102c/capt_seq.c

    r1056 r1334  
    330330"               BL      capt_seq_hook_set_nr \n"                                        // added 
    331331 
    332 "               LDR     R0, [R4,#0x1C] \n" 
    333 "               CMP     R0, #0 \n" 
    334 "               MOVNE   R0, #1 \n" 
    335 "               STRNE   R0, [R5] \n" 
    336 "               LDR     R0, [R5,#4] \n" 
    337 "               BL      sub_FF90B814 \n" 
    338 "               LDR     R0, [R5,#8] \n" 
    339 "               BL      sub_FF8B9E64 \n" 
    340 "               MOV     R0, #1 \n" 
    341 "               BL      sub_FF8B9E70 \n"                        // nullsub_13 
    342 "               LDR     R0, =0xFF941E28 \n" 
    343 "               MOV     R1, R4 \n" 
    344 "               BL      sub_FF8B9E40 \n" 
    345 "               LDR     R0, [R5] \n" 
    346 "               CMP     R0, #5 \n" 
    347 "               ADDLS   PC, PC, R0,LSL#2 \n" 
    348 //"             B       loc_FF9425E8 \n" 
    349 "               B       sub_FF9425E8 \n" 
    350  
     332"               B       sub_FF9424DC \n" 
    351333        ); 
    352334} 
     
    408390"               MOV     R0, R4 \n" 
    409391 
    410 // this patch causes a crash when shooting 
    411 // it is unknown what the effect is of not calling this 
    412 "               BL      sub_FF94242C \n" 
    413 //"             BL      sub_FF94242C_my \n"                                     // patched 
     392//"             BL      sub_FF94242C \n" 
     393"               BL      sub_FF94242C_my \n"                                     // patched 
     394 
    414395"               MOV     R5, R0 \n" 
    415396"               BL     capt_seq_hook_raw_here \n"               // added 
  • trunk/platform/ixus120_sd940/sub/102c/stubs_auto.S

    r1056 r1334  
    159159STUB(FF8B4508) 
    160160STUB(FF8B45A4) 
    161 STUB(FF8B9E40) 
    162 STUB(FF8B9E64) 
    163 STUB(FF8B9E70) 
    164161STUB(FF8D7B04) 
    165162STUB(FF8D9F28) 
    166163STUB(FF8DB778) 
    167164STUB(FF90B564) 
    168 STUB(FF90B814) 
    169165STUB(FF9181FC) 
    170166STUB(FF9182C4) 
     
    195191STUB(FF942344) 
    196192STUB(FF94242C) 
    197 STUB(FF9425E8) 
     193STUB(FF9424DC) 
    198194STUB(FF9426E4) 
    199195STUB(FF942740) 
  • trunk/platform/ixus120_sd940/sub/103b/capt_seq.c

    r1134 r1334  
    330330                "BL      wait_until_remote_button_is_released\n" 
    331331                "BL      capt_seq_hook_set_nr\n" 
    332  
    333  
    334 "               LDR     R0, [R4,#0x1C]\n" 
    335 "               CMP     R0, #0\n" 
    336 "               MOVNE   R0, #1\n" 
    337 "               STRNE   R0, [R5]\n" 
    338 "               LDR     R0, [R5,#4]\n" 
    339 "               BL              sub_FF90B820\n" 
    340 "               LDR     R0, [R5,#8]\n" 
    341 "               BL              sub_FF8B9E70\n" 
    342 "               MOV     R0, #1\n" 
    343 "               BL              sub_FF8B9E7C\n"  
    344 "               LDR     R0, =0xFF941E34\n" 
    345 "               MOV     R1, R4\n" 
    346 "               BL              sub_FF8B9E4C\n" 
    347 "               LDR     R0, [R5]\n" 
    348 "               CMP     R0, #5\n" 
    349 "               ADDLS   PC, PC, R0,LSL#2\n" 
    350  
    351 "               B               sub_FF9425F4\n"  // go to the ROM 
     332                 
     333"               B               sub_FF9424E8\n"                 // go back to the ROM 
    352334); 
    353335}                
     
    410392"               MOV             R0, R4\n" 
    411393 
    412 // this patch causes a crash when shooting 
    413 // it is unknown what the effect is of not calling this (called elsewhere)       
    414 "               BL              sub_FF942438\n" 
    415 //"             BL              sub_FF942438_my\n"  
     394//"             BL              sub_FF942438\n" 
     395"               BL              sub_FF942438_my\n"  
     396 
    416397"               MOV             R5, R0\n" 
    417398"               BL              capt_seq_hook_raw_here\n"  //----------->> 
  • trunk/platform/ixus120_sd940/sub/103b/stubs_auto.S

    r1134 r1334  
    159159STUB(FF8B4514) 
    160160STUB(FF8B45B0) 
    161 STUB(FF8B9E4C) 
    162 STUB(FF8B9E70) 
    163 STUB(FF8B9E7C) 
    164161STUB(FF8D9F34) 
    165162STUB(FF8DB784) 
    166163STUB(FF90B570) 
    167 STUB(FF90B820) 
    168164STUB(FF918208) 
    169165STUB(FF9182D0) 
     
    194190STUB(FF942350) 
    195191STUB(FF942438) 
    196 STUB(FF9425F4) 
     192STUB(FF9424E8) 
    197193STUB(FF9426F0) 
    198194STUB(FF94274C) 
  • trunk/platform/ixus120_sd940/sub/103c/capt_seq.c

    r1071 r1334  
    330330                "BL      capt_seq_hook_set_nr\n" 
    331331 
    332                 "LDR    R0, [R4,#0x1C]\n"        
    333                 "CMP    R0, #0\n"                        
    334                 "MOVNE  R0, #1\n"                        
    335                 "STRNE  R0, [R5]\n"                      
    336                 "LDR    R0, [R5,#4]\n"           
    337                 "BL             sub_FF90B870\n"          
    338                 "LDR    R0, [R5,#8]\n"           
    339                 "BL             sub_FF8B9EC0\n"          
    340                 "MOV    R0, #1\n"                        
    341                 "BL             sub_FF8B9ECC\n"         //nullsub_50             
    342                 "LDR    R0, =0xFF941FF0\n"       
    343                 "MOV    R1, R4\n"                        
    344                 "BL             sub_FF8B9E9C\n"          
    345                 "LDR    R0, [R5]\n"                      
    346                 "CMP    R0, #5\n"                        
    347                 "ADDLS  PC, PC, R0,LSL#2\n"      
    348                  
    349                 "B              sub_FF9427B0\n"         //go to the ROM 
     332                "B              sub_FF9426A4\n"         //go back to the ROM 
    350333 ); 
    351334}                
     
    408391                "MOV    R0, R4\n" 
    409392                 
    410 // this patch causes a crash when shooting 
    411 // it is unknown what the effect is of not calling this (called elsewhere)       
    412                 "BL             sub_FF9425F4 \n"                 
    413         //      "BL             sub_FF9425F4_my \n"      
     393        //      "BL             sub_FF9425F4 \n"                 
     394                "BL             sub_FF9425F4_my \n" 
     395                 
    414396                "MOV    R5, R0\n" 
    415397                "BL     capt_seq_hook_raw_here\n"  //----------->> 
  • trunk/platform/ixus120_sd940/sub/103c/stubs_auto.S

    r1056 r1334  
    159159STUB(FF8B4564) 
    160160STUB(FF8B4600) 
    161 STUB(FF8B9E9C) 
    162 STUB(FF8B9EC0) 
    163 STUB(FF8B9ECC) 
    164161STUB(FF8D9F84) 
    165162STUB(FF8DB7D4) 
    166163STUB(FF90B5C0) 
    167 STUB(FF90B870) 
    168164STUB(FF918258) 
    169165STUB(FF918320) 
     
    194190STUB(FF94250C) 
    195191STUB(FF9425F4) 
    196 STUB(FF9427B0) 
     192STUB(FF9426A4) 
    197193STUB(FF9428AC) 
    198194STUB(FF942908) 
Note: See TracChangeset for help on using the changeset viewer.