Changeset 1980


Ignore:
Timestamp:
07/14/12 05:02:55 (10 months ago)
Author:
reyalp
Message:

untested, port alpha a3200 100d from stable branch, r1970-1971

Location:
trunk
Files:
6 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/camera_list.csv

    r1977 r1980  
    1010a3000,100c,BETA,, 
    1111a3000,100d,BETA,, 
     12a3200,100d,ALPHA,, 
    1213a3300,100a,BETA,, 
    1314a3300,100c,BETA,, 
  • trunk/core/gui.c

    r1977 r1980  
    6767    // KEY_LEFT/KEY_RIGHT is used for gui_subj_dist_override_value_enum (because of no separate ZOOM_IN/OUT) 
    6868 
    69 #elif defined(CAMERA_a3300)     // a3300 has no erase button, so make DISP button the toggle_raw and Alt +/- shortcuts. 
     69#elif defined(CAMERA_a3300) || defined(CAMERA_a3200)// a3300 has no erase button, so make DISP button the toggle_raw and Alt +/- shortcuts. 
    7070    //Alt mode 
    7171    // NOTE both of these conflict with adjustable alt 
     
    14621462        static const char* names[]={ "Print", "ISO"}; 
    14631463        static const int keys[]={ KEY_PRINT, KEY_ISO }; 
    1464     #elif defined(CAMERA_a3300) 
     1464    #elif defined(CAMERA_a3300) || defined(CAMERA_a3200) 
    14651465        static const char* names[]={ "Print", "Face", "Disp"}; 
    14661466        static const int keys[]={ KEY_PRINT, KEY_FACE, KEY_DISPLAY }; 
  • trunk/platform/a3200/kbd.c

    r1971 r1980  
    4343#define BTN_ZoomTele    (0x00008000) 
    4444 
    45  
    46  
    47 static long kbd_new_state[3]; 
    48 static long kbd_prev_state[3]; 
    49 static long kbd_mod_state[3]; 
     45long kbd_new_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }; 
     46static long kbd_prev_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }; 
     47static long kbd_mod_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }; 
     48 
    5049static long last_kbd_key = 0; 
    51 static int usb_power=0; 
    52 static int remote_key, remote_count; 
    53 static int shoot_counter=0; 
    5450extern void _GetKbdState(long*); 
    5551 
    56 #define DELAY_TIMEOUT 10000 
     52//#define DELAY_TIMEOUT 10000 
    5753 
    5854// override key and feather bits to avoid feather osd messing up chdk display in ALT mode 
     
    7470           ) 
    7571 
    76 //#define LED_AF 0xC02200F4 
    77 #define NEW_SS (0x2000) 
    7872#define SD_READONLY_FLAG    0x00020000 // Found @0xffb5d574, levent 0x90a 
    7973#define USB_MASK            0x04000000 // Found @0xffb5d594, levent 0x902 
    8074#define USB_FLAG            0x04000000 // ?? Found @0xff3bcf44 a3300, levent 0x902 
    81 #define USB_REG 2 
     75#define USB_IDX 2 
    8276#define SD_READONLY_IDX     2 
    83 #define USB_IDX             2 
    84  
    85 #ifndef MALLOCD_STACK 
    86 static char kbd_stack[NEW_SS]; 
    87 #endif 
     77 
     78extern void usb_remote_key( int ) ; 
     79int get_usb_bit()  
     80{ 
     81        long usb_physw[3]; 
     82        usb_physw[USB_IDX] = 0; 
     83        _kbd_read_keys_r2(usb_physw); 
     84        return(( usb_physw[USB_IDX] & USB_MASK)==USB_MASK) ;  
     85} 
    8886 
    8987static KeyMap keymap[] = { 
     
    117115        "MOV    R5, #0 \n" 
    118116        //"BL   _kbd_read_keys \n" 
    119         "BL     my_kbd_read_keys \n"    // pacthed 
     117        "BL     my_kbd_read_keys \n"    // patched 
    120118        "B      _kbd_p1_f_cont \n" 
    121119        ); 
     
    170168    } 
    171169         
    172     remote_key = (physw_status[2] & USB_MASK)==USB_MASK;  
    173     if (remote_key) 
    174         remote_count += 1; 
    175     else if (remote_count) { 
    176         usb_power = remote_count; 
    177         remote_count = 0; 
    178     } 
    179          
     170        usb_remote_key(physw_status[USB_IDX]) ; 
     171 
    180172    if (conf.remote_enable) { 
    181173        physw_status[2] = physw_status[2] & ~(SD_READONLY_FLAG | USB_MASK);   // override USB and SD-Card Readonly Bits 
     
    183175    
    184176    physw_status[2] = physw_status[2] & ~SD_READONLY_FLAG;   // override SD-Card Readonly Bit 
    185 } 
    186  
    187 int get_usb_power(int edge) { 
    188  
    189   int x; 
    190  
    191     if (edge) return remote_key; 
    192     x = usb_power; 
    193     usb_power = 0; 
    194     return x; 
    195177} 
    196178 
     
    342324#endif 
    343325 
    344 // called from capt_seq.c at sub_FF96EF54_my() 
    345 void wait_until_remote_button_is_released(void) { 
    346      
    347         int count1; 
    348     int count2; 
    349     int tick,tick2,tick3; 
    350     int nSW; 
    351     int prev_usb_power,cur_usb_power; 
    352     static int nMode; 
    353  
    354     asm volatile ("STMFD SP!, {R0-R11,LR}\n");   // store R0-R11 and LR in stack 
    355  
    356     debug_led(1); 
    357     tick = get_tick_count(); 
    358     tick2 = tick; 
    359     static long usb_physw[3]; 
    360     if (conf.synch_enable && conf.ricoh_ca1_mode && conf.remote_enable && (!shooting_get_drive_mode()|| (shooting_get_drive_mode()==1) || ((shooting_get_drive_mode()==2) && state_shooting_progress != SHOOTING_PROGRESS_PROCESSING))) 
    361  
    362     { 
    363         // ------ add by Masuji SUTO (start) -------------- 
    364         nMode = 0; 
    365         usb_physw[2] = 0;   // makes sure USB bit is cleared. 
    366         _kbd_read_keys_r2(usb_physw); 
    367         if((usb_physw[2] & USB_MASK)==USB_MASK) nMode=1; 
    368         // ------ add by Masuji SUTO (end)   -------------- 
    369         if(conf.ricoh_ca1_mode && conf.remote_enable) { 
    370             if(shooting_get_drive_mode() == 1 && state_shooting_progress == SHOOTING_PROGRESS_PROCESSING) {   //continuous-shooting mode 
    371                 if(conf.bracket_type>2) { 
    372                     if(shoot_counter<2) shutter_int=3; 
    373                     shoot_counter--; 
    374                 } else { 
    375                     prev_usb_power=0; 
    376                     nSW = 0; 
    377                     do { 
    378                         usb_physw[2] = 0;   // makes sure USB bit is cleared. 
    379                         _kbd_read_keys_r2(usb_physw); 
    380                         cur_usb_power = (usb_physw[2] & USB_MASK)==USB_MASK; 
    381                         if(cur_usb_power) { 
    382                             if(!prev_usb_power) { 
    383                                 tick2 = get_tick_count(); 
    384                                 prev_usb_power=cur_usb_power; 
    385                             } else { 
    386                                 if((int)get_tick_count()-tick2>1000) {debug_led(0);} 
    387                             } 
    388                         } else { 
    389                             if(prev_usb_power) { 
    390                                 tick3 = (int)get_tick_count()-tick2; 
    391                                 if(nSW==10) { 
    392                                     if(tick3>50) shutter_int=1; 
    393                                         nSW=20; 
    394                                 } 
    395                                 if(nSW==0 && tick3>0) { 
    396                                     if(tick3<50) { 
    397                                     nSW=10; 
    398                                     } else { 
    399                                         if(tick3>1000) shutter_int=1; 
    400                                             nSW=20; 
    401                                     } 
    402                                 } 
    403                                 prev_usb_power=cur_usb_power; 
    404                             } 
    405                         } 
    406                         if((int)get_tick_count()-tick >= DELAY_TIMEOUT) { nSW=20;shutter_int=2; } 
    407                     } 
    408                     while(nSW<20); 
    409                 } 
    410             }   // continuous-shooting mode 
    411             else {   //nomal mode 
    412                 shoot_counter=0; 
    413                 if(conf.bracket_type>2) { 
    414                     shoot_counter=(conf.bracket_type-2)*2; 
    415                 } 
    416                 do { 
    417                     usb_physw[2] = 0;    // makes sure USB bit is cleared. 
    418                     _kbd_read_keys_r2(usb_physw); 
    419                 } 
    420                 while (((((usb_physw[2] & USB_MASK)!=USB_MASK) && (nMode==0)) || (((usb_physw[2] & USB_MASK)==USB_MASK) && (nMode==1))) && ((int)get_tick_count()-tick < DELAY_TIMEOUT)); 
    421             } 
    422         } else { 
    423             do { 
    424                 usb_physw[2] = 0;   // makes sure USB bit is cleared. 
    425                _kbd_read_keys_r2(usb_physw); 
    426             } 
    427            while ((usb_physw[2]&USB_MASK) && ((int)get_tick_count()-tick < DELAY_TIMEOUT)); 
    428         } 
    429     } 
    430  
    431     if (conf.synch_delay_enable && conf.synch_delay_value>0) {   // if delay is switched on and greater than 0 
    432         for (count1=0;count1<conf.synch_delay_value+(conf.synch_delay_coarse_value*1000);count1++) {   // wait delay_value * 0.1ms 
    433             for (count2=0;count2<1400;count2++) {   // delay approx. 0.1ms 
    434             } 
    435         } 
    436     } 
    437  
    438     debug_led(0); 
    439     asm volatile ("LDMFD SP!, {R0-R11,LR}\n");   // restore R0-R11 and LR from stack 
    440 } 
  • trunk/platform/a3200/shooting.c

    r1971 r1980  
    7474}; 
    7575 
    76 static struct { 
    77         int hackmode; 
    78         int canonmode; 
    79 } modemap[] = { 
     76const CapturemodeMap modemap[] = { 
    8077        { MODE_P,                                       32772 }, 
    8178        { MODE_LIVE,                            33332 }, 
     
    107104 
    108105#include "../generic/shooting.c" 
    109  
    110 // Override ISO settings (need to do this before exposure calc for ISO as well as after) 
    111 void __attribute__((naked,noinline)) shooting_expo_iso_override(void) { 
    112          
    113         asm volatile("STMFD   SP!, {R0-R12,LR}\n"); 
    114          
    115         if ((state_kbd_script_run) && (photo_param_put_off.sv96)) { 
    116                 shooting_set_sv96(photo_param_put_off.sv96, SET_NOW); 
    117                 // photo_param_put_off.sv96 is not reset here, it will be reset in next call to shooting_expo_param_override 
    118     } 
    119     else if ((conf.iso_override_value) && (conf.iso_override_koef) && !(conf.override_disable==1)) 
    120                 shooting_set_iso_real(shooting_get_iso_override_value(), SET_NOW); 
    121     else if (conf.autoiso_enable && shooting_get_flash_mode()/*NOT FOR FLASH AUTO MODE*/ && !(conf.override_disable==1 && conf.override_disable_all)) 
    122                 shooting_set_autoiso(shooting_get_iso_mode()); 
    123  
    124         asm volatile("LDMFD   SP!, {R0-R12,PC}\n"); 
    125 } 
    126  
    127106 
    128107long get_file_next_counter() { 
  • trunk/platform/a3300/kbd.c

    r1923 r1980  
    1313// button and mode dial codes 
    1414// physw [0] 
    15 #define BTN_Play        (0x00002000) 
     15#define BTN_Play        (0x00002000)//?? 
    1616 
    1717// physw [2] 
     
    2222#define BTN_Set         (0x00000010) 
    2323#define BTN_Disp        (0x00000020) 
    24 #define BTN_Face        (0x00000040) 
     24#define BTN_Face        (0x00000040)//?? 
    2525#define BTN_Menu        (0x00000080) 
    2626 
     
    4848 
    4949static long last_kbd_key = 0; 
    50  
     50static int usb_power=0; 
     51static int remote_key, remote_count; 
     52static int shoot_counter=0; 
    5153extern void _GetKbdState(long*); 
     54 
     55//#define DELAY_TIMEOUT 10000 
    5256 
    5357// override key and feather bits to avoid feather osd messing up chdk display in ALT mode 
     
    6973           ) 
    7074 
    71 #define LED_AF 0xC02200F4 
    72 #define NEW_SS (0x2000) 
    73  
    74 #define SD_READONLY_FLAG (0x00020000) 
     75//#define LED_AF 0xC02200F4 
     76//#define NEW_SS (0x2000) 
     77#define SD_READONLY_FLAG    0x00020000 // Found @0xffb5d574, levent 0x90a 
     78#define USB_MASK            0x04000000 // Found @0xffb5d594, levent 0x902 
     79#define USB_FLAG            0x04000000 // ?? Found @0xff3bcf44 a3300, levent 0x902 
     80#define USB_REG 2 
    7581#define SD_READONLY_IDX     2 
    76  
    77 #define USB_MASK (0x04000000) 
    78 #define USB_IDX             2 
     82//#define USB_IDX             2 
    7983 
    8084extern void usb_remote_key( int ) ; 
     
    8791} 
    8892 
     93 
     94/* 
    8995#ifndef MALLOCD_STACK 
    9096static char kbd_stack[NEW_SS]; 
    9197#endif 
     98*/ 
    9299 
    93100static KeyMap keymap[] = { 
    94     { 0, KEY_PRINT           ,BTN_Play },  
    95     { 2, KEY_SHOOT_FULL      ,BTN_ShootFull | BTN_ShootHalf }, // Found @0xffb5dc9c, levent 0x01 
    96     { 2, KEY_SHOOT_HALF      ,BTN_ShootHalf }, // Found @0xffb5dc94, levent 0x00 
    97     { 2, KEY_SHOOT_FULL_ONLY ,BTN_ShootFull }, // Found @0xffb5dc9c, levent 0x01 
    98     { 2, KEY_FACE            ,BTN_Face }, //  
    99     { 2, KEY_UP              ,BTN_Up }, // Found @0xffb5dc3c, levent 0x04 
    100     { 2, KEY_DOWN            ,BTN_Down }, // Found @0xffb5dc44, levent 0x05 
    101     { 2, KEY_LEFT            ,BTN_Left }, // Found @0xffb5dc4c, levent 0x06 
    102     { 2, KEY_RIGHT           ,BTN_Right }, // Found @0xffb5dc54, levent 0x07 
    103     { 2, KEY_SET             ,BTN_Set }, // Found @0xffb5dc5c, levent 0x08 
    104     { 2, KEY_DISPLAY         ,BTN_Disp }, // Found @0xffb5dc64, levent 0x0a 
    105     { 2, KEY_MENU            ,BTN_Menu }, // Found @0xffb5dc74, levent 0x09 
    106     { 2, KEY_ZOOM_OUT        ,BTN_ZoomWide }, // Found @0xffb5dca4, levent 0x03 
    107     { 2, KEY_ZOOM_IN         ,BTN_ZoomTele }, // Found @0xffb5dcac, levent 0x02 
     101    { 0, KEY_PRINT           ,BTN_Play }, 
     102    { 2, KEY_SHOOT_FULL      ,BTN_ShootFull | BTN_ShootHalf }, // Found @0xffb5d554, levent 0x01 
     103    { 2, KEY_SHOOT_HALF      ,BTN_ShootHalf }, // Found @0xffb5d54c, levent 0x00 
     104    { 2, KEY_SHOOT_FULL_ONLY ,BTN_ShootFull }, // Found @0xffb5d554, levent 0x01 
     105    { 2, KEY_FACE            ,BTN_Face }, // 
     106    { 2, KEY_UP              ,BTN_Up }, // Found @0xffb5d4f4, levent 0x04 
     107    { 2, KEY_DOWN            ,BTN_Down }, // Found @0xffb5d4fc, levent 0x05 
     108    { 2, KEY_LEFT            ,BTN_Left }, // Found @0xffb5d504, levent 0x06 
     109    { 2, KEY_RIGHT           ,BTN_Right }, // Found @0xffb5d50c, levent 0x07 
     110    { 2, KEY_SET             ,BTN_Set }, // Found @0xffb5d514, levent 0x08 
     111    { 2, KEY_DISPLAY         ,BTN_Disp }, // Found @0xffb5d51c, levent 0x0a 
     112    { 2, KEY_MENU            ,BTN_Menu }, // Found @0xffb5d52c, levent 0x09 
     113    { 2, KEY_ZOOM_OUT        ,BTN_ZoomWide }, // Found @0xffb5d55c, levent 0x03 
     114    { 2, KEY_ZOOM_IN         ,BTN_ZoomTele }, // Found @0xffb5d564, levent 0x02 
    108115    { 0, 0, 0 } 
    109116}; 
     
    116123 
    117124extern long __attribute__((naked)) wrap_kbd_p1_f() { 
    118          
    119  
    120         asm volatile( 
    121                 "STMFD  SP!, {R1-R7,LR} \n" 
    122                 "MOV    R5, #0 \n" 
    123                 //"BL           _kbd_read_keys \n" 
    124                 "BL             my_kbd_read_keys \n"    // pacthed 
    125                 "B              _kbd_p1_f_cont \n" 
     125 
     126    asm volatile( 
     127        "STMFD  SP!, {R1-R7,LR} \n" 
     128        "MOV    R5, #0 \n" 
     129        //"BL   _kbd_read_keys \n" 
     130        "BL     my_kbd_read_keys \n"    // patched 
     131        "B      _kbd_p1_f_cont \n" 
    126132        ); 
    127133        return 0; // shut up the compiler 
     
    132138         
    133139        while (physw_run) { 
    134         _SleepTask(*((int*)(0x1C30 + 0x8))); //  @FF834160 + FF834168 
     140        _SleepTask(*((int*)(0x1C30 + 0x8))); //  @FF83410C + FF834114 
    135141 
    136142                if (wrap_kbd_p1_f() == 1) {   // autorepeat ? 
     
    177183        usb_remote_key(physw_status[USB_IDX]) ; 
    178184 
    179         if (conf.remote_enable) { 
    180                 physw_status[USB_IDX] = physw_status[USB_IDX] & ~(SD_READONLY_FLAG | USB_MASK); 
    181         } else { 
    182                 physw_status[USB_IDX] = physw_status[USB_IDX] & ~SD_READONLY_FLAG; 
    183         } 
    184  
    185         } 
     185    if (conf.remote_enable) { 
     186        physw_status[2] = physw_status[2] & ~(SD_READONLY_FLAG | USB_MASK);   // override USB and SD-Card Readonly Bits 
     187    } 
     188    
     189    physw_status[2] = physw_status[2] & ~SD_READONLY_FLAG;   // override SD-Card Readonly Bit 
     190} 
     191 
     192/* 
     193int get_usb_power(int edge) { 
     194 
     195  int x; 
     196 
     197    if (edge) return remote_key; 
     198    x = usb_power; 
     199    usb_power = 0; 
     200    return x; 
     201} 
     202*/ 
    186203 
    187204void kbd_key_press(long key) { 
     
    331348    } 
    332349#endif 
     350 
Note: See TracChangeset for help on using the changeset viewer.