Changeset 1568 for trunk/platform/g10/kbd.c
- Timestamp:
- 01/16/12 06:46:19 (17 months ago)
- File:
-
- 1 edited
-
trunk/platform/g10/kbd.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/platform/g10/kbd.c
r1344 r1568 12 12 13 13 14 //static long kbd_new_state[3]; 15 long kbd_new_state[3]; 16 17 static long kbd_prev_state[3]; 18 static long kbd_mod_state[3]; 14 long kbd_new_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }; 15 static long kbd_prev_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }; 16 static long kbd_mod_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }; 19 17 20 18 static long last_kbd_key = 0; 21 19 static long alt_mode_key_mask = 0x00000400; // G10 22 20 23 static int usb_power=0;24 static int remote_key, remote_count;25 static int shoot_counter=0;26 21 extern void _GetKbdState(long*); 27 28 #define DELAY_TIMEOUT 10000 22 extern void usb_remote_key( int ) ; 29 23 30 24 #define LED_ISO (void*) 0xC02200D0 // G10 ISO select dial LED … … 35 29 #define SD_READONLY_FLAG 0x00020000 // Found @0xffb0f940, levent 0x90a 36 30 #define SD_READONLY_IDX 2 37 #define USB_ FLAG0x00040000 // Found @0xffb0f94c, levent 0x90231 #define USB_MASK 0x00040000 // Found @0xffb0f94c, levent 0x902 38 32 #define USB_IDX 2 33 34 extern void usb_remote_key( int ) ; 35 int get_usb_bit() 36 { 37 long usb_physw[3]; 38 usb_physw[USB_IDX] = 0; 39 _kbd_read_keys_r2(usb_physw); 40 return(( usb_physw[USB_IDX] & USB_MASK)==USB_MASK) ; 41 } 39 42 40 43 #define KEYS_MASK0 (0x00000003) … … 71 74 long __attribute__((naked)) wrap_kbd_p1_f() ; 72 75 73 void wait_until_remote_button_is_released(void)74 {75 76 77 int count1;78 int count2;79 int tick,tick2,tick3;80 int nSW;81 int prev_usb_power,cur_usb_power;82 // ------ add by Masuji SUTO (start) --------------83 static int nMode;84 // ------ add by Masuji SUTO (end) --------------85 86 asm volatile ("STMFD SP!, {R0-R11,LR}\n"); // store R0-R11 and LR in stack87 debug_led(1);88 tick = get_tick_count();89 tick2 = tick;90 static long usb_physw[3];91 if (conf.synch_enable && conf.ricoh_ca1_mode && conf.remote_enable && (!shooting_get_drive_mode()|| ((shooting_get_drive_mode()==2) && state_shooting_progress != SHOOTING_PROGRESS_PROCESSING))) // synch mode enable so wait for USB to disconnect92 {93 // ------ add by Masuji SUTO (start) --------------94 nMode=0;95 usb_physw[USB_IDX] = 0; // makes sure USB bit is cleared.96 _kbd_read_keys_r2(usb_physw);97 if((usb_physw[USB_IDX] & USB_FLAG)==USB_FLAG) nMode=1;98 // ------ add by Masuji SUTO (end) --------------99 if(conf.ricoh_ca1_mode && conf.remote_enable)100 {101 if(shooting_get_drive_mode()==1 && state_shooting_progress == SHOOTING_PROGRESS_PROCESSING){ //continuous-shooting mode102 if(conf.bracket_type>2){103 if(shoot_counter<2) shutter_int=3;104 shoot_counter--;105 }106 else{107 prev_usb_power=0;108 nSW = 0;109 do110 {111 usb_physw[USB_IDX] = 0; // makes sure USB bit is cleared.112 _kbd_read_keys_r2(usb_physw);113 cur_usb_power = (usb_physw[USB_IDX] & USB_FLAG)==USB_FLAG;114 if(cur_usb_power){115 if(!prev_usb_power){116 tick2 = get_tick_count();117 prev_usb_power=cur_usb_power;118 }119 else{120 if((int)get_tick_count()-tick2>1000) {debug_led(0);}121 }122 }123 else{124 if(prev_usb_power){125 tick3 = (int)get_tick_count()-tick2;126 if(nSW==10) {127 if(tick3>50) shutter_int=1;128 nSW=20;129 }130 if(nSW==0 && tick3>0) {131 if(tick3<50) {132 nSW=10;133 }134 else{135 if(tick3>1000) shutter_int=1;136 nSW=20;137 }138 }139 prev_usb_power=cur_usb_power;140 }141 }142 if((int)get_tick_count()-tick >= DELAY_TIMEOUT) {nSW=20;shutter_int=2;}143 }144 while(nSW<20);145 }146 } //continuous-shooting mode147 else{ // normal mode148 shoot_counter=0;149 if(conf.bracket_type>2){150 shoot_counter=(conf.bracket_type-2)*2;151 }152 do153 {154 // _platformsub_kbd_fetch_data(x);155 usb_physw[USB_IDX] = 0;156 _kbd_read_keys_r2(usb_physw);157 }158 159 // ------ modif by Masuji SUTO (start) --------------160 while(((((usb_physw[USB_IDX] & USB_FLAG)!=USB_FLAG) && (nMode==0)) || (((usb_physw[USB_IDX] & USB_FLAG)==USB_FLAG) && (nMode==1))) && ((int)get_tick_count()-tick < DELAY_TIMEOUT));161 // ------ modif by Masuji SUTO (end) --------------162 }163 } // ricoh ca-1 mode164 165 else166 167 {168 do169 {170 // _platformsub_kbd_fetch_data(x);171 usb_physw[USB_IDX] = 0;172 _kbd_read_keys_r2(usb_physw);173 }174 while((usb_physw[USB_IDX]&USB_FLAG) && ((int)get_tick_count()-tick < DELAY_TIMEOUT));175 176 }177 178 } // synch enable179 180 181 if (conf.synch_delay_enable && conf.synch_delay_value>0) // if delay is switched on and greater than 0182 {183 for (count1=0;count1<conf.synch_delay_value+(conf.synch_delay_coarse_value*1000);count1++) // wait delay_value * 0.1ms184 {185 for (count2=0;count2<1400;count2++) // delay approx. 0.1ms186 {187 }188 }189 }190 191 debug_led(0);192 asm volatile ("LDMFD SP!, {R0-R11,LR}\n"); // restore R0-R11 and LR from stack193 }194 195 76 static void __attribute__((noinline)) mykbd_task_proceed() 196 77 { … … 272 153 } 273 154 274 remote_key = (physw_status[USB_IDX] & USB_FLAG)==USB_FLAG; 275 if (remote_key) 276 remote_count += 1; 277 else if (remote_count) { 278 usb_power = remote_count; 279 remote_count = 0; 280 } 155 usb_remote_key(physw_status[USB_IDX]) ; 156 281 157 if (conf.remote_enable) { 282 physw_status[USB_IDX] = physw_status[USB_IDX] & ~(SD_READONLY_FLAG | USB_ FLAG);158 physw_status[USB_IDX] = physw_status[USB_IDX] & ~(SD_READONLY_FLAG | USB_MASK); 283 159 } else { 284 160 physw_status[USB_IDX] = physw_status[USB_IDX] & ~SD_READONLY_FLAG; 285 161 } 162 286 163 } 287 164 … … 407 284 } 408 285 409 int get_usb_power(int edge)410 {411 int x;412 413 if (edge) return remote_key;414 x = usb_power;415 usb_power = 0;416 return x;417 }418 419 286 420 287 static int new_jogdial=0, old_jogdial=0;
Note: See TracChangeset
for help on using the changeset viewer.