Changeset 1568 for trunk/platform/ixus870_sd880/kbd.c
- Timestamp:
- 01/16/12 06:46:19 (16 months ago)
- File:
-
- 1 edited
-
trunk/platform/ixus870_sd880/kbd.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/platform/ixus870_sd880/kbd.c
r1344 r1568 12 12 13 13 14 static long kbd_new_state[3];15 static long kbd_prev_state[3] ;16 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 }; 17 17 18 18 static long last_kbd_key = 0; 19 19 static long alt_mode_key_mask = 0x00000800; // key_print 20 static int usb_power=0; 21 static int remote_key, remote_count; 22 static int shoot_counter=0; 20 23 21 extern void _platformsub_kbd_fetch_data(long*); 24 25 #define DELAY_TIMEOUT 1000026 22 27 23 // each mask should be the xor of all key values in the corresponding group … … 48 44 49 45 #define USB_MASK (0x40000) 50 #define USB_REG 2 // idx in physw_status 46 #define USB_IDX 2 47 48 extern void usb_remote_key( int ) ; 49 int get_usb_bit() 50 { 51 long usb_physw[3]; 52 usb_physw[USB_IDX] = 0; 53 _kbd_read_keys_r2(usb_physw); 54 return(( usb_physw[USB_IDX] & USB_MASK)==USB_MASK) ; 55 } 51 56 52 57 … … 84 89 long __attribute__((naked)) wrap_kbd_p1_f() ; 85 90 86 void wait_until_remote_button_is_released(void)87 {88 89 long x[3];90 int count1;91 int count2;92 int tick,tick2,tick3;93 int nSW;94 int prev_usb_power,cur_usb_power;95 // ------ add by Masuji SUTO (start) --------------96 static int nMode;97 // ------ add by Masuji SUTO (end) --------------98 99 asm volatile ("STMFD SP!, {R0-R11,LR}\n"); // store R0-R11 and LR in stack100 debug_led(1);101 tick = get_tick_count();102 tick2 = tick;103 static long usb_physw[3];104 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 disconnect105 {106 // ------ add by Masuji SUTO (start) --------------107 nMode=0;108 usb_physw[USB_REG] = 0; // makes sure USB bit is cleared.109 _kbd_read_keys_r2(usb_physw);110 if((usb_physw[USB_REG] & USB_MASK)==USB_MASK) nMode=1;111 // ------ add by Masuji SUTO (end) --------------112 if(conf.ricoh_ca1_mode && conf.remote_enable)113 {114 if(shooting_get_drive_mode()==1 && state_shooting_progress == SHOOTING_PROGRESS_PROCESSING){ //continuous-shooting mode115 if(conf.bracket_type>2){116 if(shoot_counter<2) shutter_int=3;117 shoot_counter--;118 }119 else{120 prev_usb_power=0;121 nSW = 0;122 do123 {124 usb_physw[USB_REG] = 0; // makes sure USB bit is cleared.125 _kbd_read_keys_r2(usb_physw);126 cur_usb_power = (usb_physw[USB_REG] & USB_MASK)==USB_MASK;127 if(cur_usb_power){128 if(!prev_usb_power){129 tick2 = get_tick_count();130 prev_usb_power=cur_usb_power;131 }132 else{133 if((int)get_tick_count()-tick2>1000) {debug_led(0);}134 }135 }136 else{137 if(prev_usb_power){138 tick3 = (int)get_tick_count()-tick2;139 if(nSW==10) {140 if(tick3>50) shutter_int=1;141 nSW=20;142 }143 if(nSW==0 && tick3>0) {144 if(tick3<50) {145 nSW=10;146 }147 else{148 if(tick3>1000) shutter_int=1;149 nSW=20;150 }151 }152 prev_usb_power=cur_usb_power;153 }154 }155 if((int)get_tick_count()-tick >= DELAY_TIMEOUT) {nSW=20;shutter_int=2;}156 }157 while(nSW<20);158 }159 } //continuous-shooting mode160 else{ // normal mode161 shoot_counter=0;162 if(conf.bracket_type>2){163 shoot_counter=(conf.bracket_type-2)*2;164 }165 do166 {167 // _platformsub_kbd_fetch_data(x);168 usb_physw[USB_REG] = 0;169 _kbd_read_keys_r2(usb_physw);170 }171 172 // ------ modif by Masuji SUTO (start) --------------173 while(((((usb_physw[USB_REG] & USB_MASK)!=USB_MASK) && (nMode==0)) || (((usb_physw[USB_REG] & USB_MASK)==USB_MASK) && (nMode==1))) && ((int)get_tick_count()-tick < DELAY_TIMEOUT));174 // ------ modif by Masuji SUTO (end) --------------175 }176 } // ricoh ca-1 mode177 178 else179 180 {181 do182 {183 // _platformsub_kbd_fetch_data(x);184 usb_physw[USB_REG] = 0;185 _kbd_read_keys_r2(usb_physw);186 }187 while((usb_physw[USB_REG]&USB_MASK) && ((int)get_tick_count()-tick < DELAY_TIMEOUT));188 189 }190 191 } // synch enable192 193 194 if (conf.synch_delay_enable && conf.synch_delay_value>0) // if delay is switched on and greater than 0195 {196 for (count1=0;count1<conf.synch_delay_value+(conf.synch_delay_coarse_value*1000);count1++) // wait delay_value * 0.1ms197 {198 for (count2=0;count2<1400;count2++) // delay approx. 0.1ms199 {200 }201 }202 }203 204 debug_led(0);205 206 asm volatile ("LDMFD SP!, {R0-R11,LR}\n"); // restore R0-R11 and LR from stack207 }208 209 210 211 91 212 92 static void __attribute__((noinline)) mykbd_task_proceed() … … 309 189 _kbd_read_keys_r2(physw_status); 310 190 311 remote_key = (physw_status[USB_REG] & USB_MASK)==USB_MASK; 312 if (remote_key) 313 remote_count += 1; 314 else if (remote_count) { 315 usb_power = remote_count; 316 remote_count = 0; 317 } 191 usb_remote_key(physw_status[USB_IDX]) ; 192 318 193 if (conf.remote_enable) { 319 #if USB_REG == SD_READONLY_REG 320 physw_status[USB_REG] = physw_status[USB_REG] & ~(SD_READONLY_FLAG | USB_MASK); 321 #else 322 physw_status[USB_REG] = physw_status[USB_REG] & ~USB_MASK; 323 physw_status[SD_READONLY_REG] = physw_status[SD_READONLY_REG] & ~SD_READONLY_FLAG; 324 #endif 194 physw_status[USB_IDX] = physw_status[USB_IDX] & ~(SD_READONLY_FLAG | USB_MASK); 325 195 } else { 326 physw_status[ SD_READONLY_REG] = physw_status[SD_READONLY_REG] & ~SD_READONLY_FLAG;196 physw_status[USB_IDX] = physw_status[USB_IDX] & ~SD_READONLY_FLAG; 327 197 } 328 198 … … 452 322 } 453 323 454 455 int get_usb_power(int edge)456 {457 int x;458 459 if (edge) return remote_key;460 x = usb_power;461 usb_power = 0;462 return x;463 }464 465 324 long kbd_use_zoom_as_mf() { 466 325 return 0;
Note: See TracChangeset
for help on using the changeset viewer.