CHDK_DE Vorschauversion  Trunk Rev. 5163
 Alle Datenstrukturen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
usb_remote.h-Dateireferenz
+ Dieser Graph zeigt, welche Datei direkt oder indirekt diese Datei enthält:

gehe zum Quellcode dieser Datei

Datenstrukturen

struct  remote_input_desc_t
 

Makrodefinitionen

#define NUM_USB_INPUT_DRV   5
 
#define NUM_USB_MODULES   10
 
#define RMT_DISABLED   0
 
#define RMT_ENABLED   1
 
#define REMOTE_CLICK_TIME   100
 
#define DEBOUNCE_TIME   10
 
#define FULL_PRESS_PULSE_TIME   1000
 
#define MAX_FULL_PRESS_DELAY   1000
 
#define CA1_MIN_HALFPRESS_TIME   10
 
#define CA1_MAX_HALFPRESS_TIME   50
 
#define CA1_CANCEL_PULSE_TIME   100
 
#define CA1_MIN_FULLPRESS_TIME   100
 
#define CA1_MAX_FULLPRESS_TIME   300
 
#define CA1_FULL_WAIT_PRESS_TIMEOUT   30000
 
#define DELAY_TIMEOUT   10000
 
#define BRACKETING_TIMEOUT   10000
 

Aufzählungen

enum  REMOTE_INPUT_TYPE { REMOTE_INPUT_USB, REMOTE_INPUT_HDMI_HPD, REMOTE_INPUT_ANALOG_AV, REMOTE_INPUT_AD_CHANNEL }
 
enum  { INVALID_STATE, INVALID_DEVICE, INVALID_MODULE }
 
enum  SWITCH_TYPE { SW_NONE = 0, SW_ONE_PRESS, SW_TWO_PRESS, SW_RICOH_CA1 }
 
enum  CONTROL_MODULE {
  RMT_NONE = 0, RMT_HALF_PRESS_FULL_PRESS, RMT_AUTO_1, RMT_AUTO_2,
  RMT_CONTINUOUS, RMT_ZOOM, RMT_BRACKETING
}
 
enum  VIRTUAL_REMOTE_STATE { REMOTE_RESET = 0, REMOTE_RELEASE, REMOTE_HALF_PRESS, REMOTE_FULL_PRESS }
 
enum  DRIVER_STATE {
  SW_RESET = 0, SW_IDLE, SW_POWER_CONNECT, SW_POWER_ON,
  SW_POWER_DISCONNECT, SW_FULL_PRESS_ACTIVE, SW_SHORT_PRESS, SW_CANCEL_PULSE,
  SW_HALF_PRESS, SW_FULL_PRESS, SW_FULL_PRESS_RESET, SW_PRESS,
  SW_RELEASE, SW_CANCEL, SW_CA1_1XX, SW_CA1_10X,
  SW_CA1_100, SW_CA1_101, SW_CA1_11
}
 
enum  LOGIC_MODULE_STATE {
  LM_RESET = 0, LM_RELEASE, LM_HALF_PRESS, LM_FULL_PRESS,
  LM_START_RECORD, LM_RECORDING, LM_STOP_RECORDING, LM_KEY_PRESS
}
 
enum  USB_POWER_STATE { USB_POWER_OFF, USB_POWER_ON }
 
enum  CAMERA_MODE { CAMERA_MODE_SHOOTING, CAMERA_MODE_PLAYBACK, CAMERA_MODE_VIDEO }
 
enum  ZOOM_MODE {
  ZOOM_STEP_OUT = 1, ZOOM_STEP_IN, ZOOM_SHOOT, ZOOM_FULL_OUT,
  ZOOM_FULL_IN
}
 
enum  PLAYBACK_MODE { PLAYBACK_NEXT =1, PLAYBACK_REVERSE, PLAYBACK_LEFT, PLAYBACK_RIGHT }
 
enum  GET_USB_PWR {
  SINGLE_PULSE, USB_STATE, BUFFERED_PULSE, PULSE_COUNT,
  LM_PULSE_COUNT, HPTIMER_ERROR_COUNT
}
 

Funktionen

int handle_usb_remote ()
 
void wait_until_remote_button_is_released (void)
 
void usb_remote_key (void)
 
int get_usb_bit ()
 
int get_hdmi_hpd_bit ()
 
int get_analog_av_bit ()
 
int get_remote_state ()
 
int get_usb_power (int edge)
 
void clear_usb_power ()
 
void set_usb_remote_state ()
 
void usb_remote_status_led (int)
 
void kbd_synch_delay (int)
 
int start_usb_HPtimer (int)
 
int stop_usb_HPtimer ()
 
int force_usb_state (int)
 
int GetAdChValue (int)
 

Variablen

int usb_HPtimer_handle
 
int usb_remote_active
 
int usb_sync_wait_flag
 
int bracketing_timeout
 
int forced_usb_port
 
enum SWITCH_TYPE switch_type
 
enum VIRTUAL_REMOTE_STATE virtual_remote_state
 
enum DRIVER_STATE driver_state
 
enum LOGIC_MODULE_STATE logic_module_state
 
enum USB_POWER_STATE usb_state
 
enum CAMERA_MODE camera_mode
 

Makro-Dokumentation

#define BRACKETING_TIMEOUT   10000

Definiert in Zeile 182 der Datei usb_remote.h.

#define CA1_CANCEL_PULSE_TIME   100

Definiert in Zeile 175 der Datei usb_remote.h.

#define CA1_FULL_WAIT_PRESS_TIMEOUT   30000

Definiert in Zeile 178 der Datei usb_remote.h.

#define CA1_MAX_FULLPRESS_TIME   300

Definiert in Zeile 177 der Datei usb_remote.h.

#define CA1_MAX_HALFPRESS_TIME   50

Definiert in Zeile 174 der Datei usb_remote.h.

#define CA1_MIN_FULLPRESS_TIME   100

Definiert in Zeile 176 der Datei usb_remote.h.

#define CA1_MIN_HALFPRESS_TIME   10

Definiert in Zeile 173 der Datei usb_remote.h.

#define DEBOUNCE_TIME   10

Definiert in Zeile 170 der Datei usb_remote.h.

#define DELAY_TIMEOUT   10000

Definiert in Zeile 180 der Datei usb_remote.h.

#define FULL_PRESS_PULSE_TIME   1000

Definiert in Zeile 171 der Datei usb_remote.h.

#define MAX_FULL_PRESS_DELAY   1000

Definiert in Zeile 172 der Datei usb_remote.h.

#define NUM_USB_INPUT_DRV   5

Definiert in Zeile 44 der Datei usb_remote.h.

#define NUM_USB_MODULES   10

Definiert in Zeile 45 der Datei usb_remote.h.

#define REMOTE_CLICK_TIME   100

Definiert in Zeile 169 der Datei usb_remote.h.

#define RMT_DISABLED   0

Definiert in Zeile 164 der Datei usb_remote.h.

#define RMT_ENABLED   1

Definiert in Zeile 165 der Datei usb_remote.h.

Dokumentation der Aufzählungstypen

anonymous enum
Aufzählungswerte
INVALID_STATE 
INVALID_DEVICE 
INVALID_MODULE 

Definiert in Zeile 60 der Datei usb_remote.h.

60  {
64  } ;
Aufzählungswerte
CAMERA_MODE_SHOOTING 
CAMERA_MODE_PLAYBACK 
CAMERA_MODE_VIDEO 

Definiert in Zeile 131 der Datei usb_remote.h.

131  { // camera mode = 0 in picture record mode, 1 in playback mode, 2 when modedial is set to videomode AND camera is in record mode
135 } ;
Aufzählungswerte
RMT_NONE 
RMT_HALF_PRESS_FULL_PRESS 
RMT_AUTO_1 
RMT_AUTO_2 
RMT_CONTINUOUS 
RMT_ZOOM 
RMT_BRACKETING 

Definiert in Zeile 74 der Datei usb_remote.h.

74  { // USB remote control modes
75  RMT_NONE = 0 ,
77  RMT_AUTO_1 ,
78  RMT_AUTO_2 ,
80  RMT_ZOOM ,
82 } ;
Aufzählungswerte
SW_RESET 
SW_IDLE 
SW_POWER_CONNECT 
SW_POWER_ON 
SW_POWER_DISCONNECT 
SW_FULL_PRESS_ACTIVE 
SW_SHORT_PRESS 
SW_CANCEL_PULSE 
SW_HALF_PRESS 
SW_FULL_PRESS 
SW_FULL_PRESS_RESET 
SW_PRESS 
SW_RELEASE 
SW_CANCEL 
SW_CA1_1XX 
SW_CA1_10X 
SW_CA1_100 
SW_CA1_101 
SW_CA1_11 

Definiert in Zeile 91 der Datei usb_remote.h.

91  { // state variable for drivers
92  SW_RESET = 0 ,
93  SW_IDLE,
101  SW_FULL_PRESS ,
103  SW_PRESS ,
104  SW_RELEASE ,
105  SW_CANCEL,
106 
107  SW_CA1_1XX,
108  SW_CA1_10X,
109  SW_CA1_100,
110  SW_CA1_101,
111  SW_CA1_11
112 
113 } ;
Aufzählungswerte
SINGLE_PULSE 
USB_STATE 
BUFFERED_PULSE 
PULSE_COUNT 
LM_PULSE_COUNT 
HPTIMER_ERROR_COUNT 

Definiert in Zeile 153 der Datei usb_remote.h.

153  { // input parameter for get_usb_power()
154  SINGLE_PULSE,
155  USB_STATE ,
157  PULSE_COUNT,
160 } ;
Aufzählungswerte
LM_RESET 
LM_RELEASE 
LM_HALF_PRESS 
LM_FULL_PRESS 
LM_START_RECORD 
LM_RECORDING 
LM_STOP_RECORDING 
LM_KEY_PRESS 

Definiert in Zeile 115 der Datei usb_remote.h.

115  { // remote control mode states
116  LM_RESET = 0 ,
117  LM_RELEASE,
121  LM_RECORDING ,
124 } ;
Aufzählungswerte
PLAYBACK_NEXT 
PLAYBACK_REVERSE 
PLAYBACK_LEFT 
PLAYBACK_RIGHT 

Definiert in Zeile 145 der Datei usb_remote.h.

145  { // playback scroll through pix - looks at pulse counts so 0 = NOP
146  PLAYBACK_NEXT =1 ,
148  PLAYBACK_LEFT ,
150 } ;
Aufzählungswerte
REMOTE_INPUT_USB 
REMOTE_INPUT_HDMI_HPD 
REMOTE_INPUT_ANALOG_AV 
REMOTE_INPUT_AD_CHANNEL 

Definiert in Zeile 48 der Datei usb_remote.h.

48  {
50  REMOTE_INPUT_HDMI_HPD, // HDMI hot plug detect
51  REMOTE_INPUT_ANALOG_AV, // Analog AV plug detect
52  REMOTE_INPUT_AD_CHANNEL, // A to D channel (battery temperature)
53 } ;
Aufzählungswerte
SW_NONE 
SW_ONE_PRESS 
SW_TWO_PRESS 
SW_RICOH_CA1 

Definiert in Zeile 67 der Datei usb_remote.h.

67  { // USB remote switch types
68  SW_NONE = 0 ,
69  SW_ONE_PRESS ,
70  SW_TWO_PRESS ,
72 } ;
Aufzählungswerte
USB_POWER_OFF 
USB_POWER_ON 

Definiert in Zeile 126 der Datei usb_remote.h.

126  { // values returned from get_usb_power(USB_STATE)
129 } ;
Aufzählungswerte
REMOTE_RESET 
REMOTE_RELEASE 
REMOTE_HALF_PRESS 
REMOTE_FULL_PRESS 

Definiert in Zeile 84 der Datei usb_remote.h.

84  { // state of Virtual USB remote switch
85  REMOTE_RESET = 0 ,
89 } ;
enum ZOOM_MODE
Aufzählungswerte
ZOOM_STEP_OUT 
ZOOM_STEP_IN 
ZOOM_SHOOT 
ZOOM_FULL_OUT 
ZOOM_FULL_IN 

Definiert in Zeile 137 der Datei usb_remote.h.

137  {
138  ZOOM_STEP_OUT = 1,
139  ZOOM_STEP_IN ,
140  ZOOM_SHOOT ,
141  ZOOM_FULL_OUT ,
143 } ;

Dokumentation der Funktionen

void clear_usb_power ( )

Definiert in Zeile 312 der Datei usb_remote.c.

313 {
314  usb_power = 0 ;
315  usb_count = 0 ;
318 }
int force_usb_state ( int  )

Definiert in Zeile 37 der Datei usb_sync.c.

38 {
39  forced_usb_port = state ;
40 #ifdef CAM_ALLOWS_USB_PORT_FORCING
41  return 1 ;
42 #else
43  return 0 ;
44 #endif
45 }
int get_analog_av_bit ( )

Definiert in Zeile 45 der Datei kbd.c.

45  {
46  long av_physw[3];
47  av_physw[ANALOG_AV_IDX] = 0;
48  _GetKbdState(av_physw);
49  return( ((av_physw[ANALOG_AV_IDX] & ANALOG_AV_FLAG)==ANALOG_AV_FLAG)?0:1) ;
50 }
int get_hdmi_hpd_bit ( )

Definiert in Zeile 20 der Datei kbd.c.

20  {
21  long hpd_physw[3];
22  hpd_physw[HDMI_HPD_IDX] = 0;
23  _GetKbdState(hpd_physw);
24  return( ((hpd_physw[HDMI_HPD_IDX] & HDMI_HPD_FLAG)==HDMI_HPD_FLAG)?0:1) ;
25 }
int get_remote_state ( )

Definiert in Zeile 55 der Datei usb_sync.c.

56 {
57 #ifdef CAM_REMOTE_MULTICHANNEL
59  {
60  case REMOTE_INPUT_USB:
61  return get_usb_bit();
62 #ifdef CAM_REMOTE_HDMI_HPD
64  return get_hdmi_hpd_bit();
65 #endif
66 #ifdef CAM_REMOTE_ANALOG_AV
68  return get_analog_av_bit();
69 #endif
70 #ifdef CAM_REMOTE_AtoD_CHANNEL
73 #endif
74  }
75  return 0;
76 #else // not CAM_REMOTE_MULTICHANNEL
77  return( get_usb_bit() );
78 #endif
79 }
int get_usb_bit ( )

Definiert in Zeile 34 der Datei kbd.c.

35 {
36  long usb_physw[3];
37  usb_physw[USB_IDX] = 0;
38  _kbd_read_keys_r2(usb_physw);
39  return(( usb_physw[USB_IDX] & USB_MASK)==USB_MASK) ;
40 }
int get_usb_power ( int  edge)

Definiert in Zeile 327 der Datei usb_remote.c.

328 {
329  int x = 0;
330 
331  switch( mode)
332  {
333  case SINGLE_PULSE :
334  x = usb_power;
335  usb_power = 0;
336  break ;
337  case USB_STATE :
338  x=usb_state;
339  break ;
340  case BUFFERED_PULSE :
341  if ( usb_buffer_out != usb_buffer_in )
342  {
344  x = *usb_buffer_out ;
345  }
346  break ;
347  case PULSE_COUNT :
348  x = usb_count;
349  usb_count = 0;
350  break ;
351  case LM_PULSE_COUNT :
354  break ;
355  case HPTIMER_ERROR_COUNT :
358  break ;
359  }
360  return x;
361 }
int GetAdChValue ( int  )
int handle_usb_remote ( )

Definiert in Zeile 393 der Datei usb_remote.c.

394 {
395  if (conf.remote_enable)
396  {
399  else
401 
402  (*usb_driver[switch_type])(get_usb_power(USB_STATE)); // jump to driver state machine
403 
404  switch( camera_mode )
405  {
406  case CAMERA_MODE_PLAYBACK :
407  (*usb_module_play[switch_type])(); // jump to control module state machine
408  break ;
409  case CAMERA_MODE_SHOOTING :
410  (*usb_module_shoot[control_module])(); // jump to control module state machine
411  break ;
412  case CAMERA_MODE_VIDEO :
413  (*usb_module_video[control_module])(); // jump to control module state machine
414  break ;
415  default :
416  conf.remote_enable = 0 ;
417  break ;
418  }
419 
420  usb_remote_active = ((logic_module_state > 1) || (driver_state > 1) || (virtual_remote_state > 1) ) ? 1 : 0 ;
421 
422  #ifdef USB_REMOTE_RECORD
423  debug_add_rec();
424  #endif
425 
426  #ifdef USB_REMOTE_DEBUGGING
427  extern int sync_counter ;
428  extern long physw_status[3] ;
429  extern int usb_buffer[] ;
430  extern int * usb_buffer_in ;
431  extern int * usb_buffer_out ;
432  extern const char* gui_USB_switch_types[] ;
433  extern const char* gui_USB_control_modes[];
435  char buf[64] ;
436  static int debug_print = 0 ;
437  static int startup_delay = 0 ;
438  int i, buff_pos, *buff_ptr ;
439 
440  if ( startup_delay < 100 ) startup_delay++ ; // need to give things time to settle before using draw_string()
441  else
442  {
443  if ( debug_print++ > 10000 ) debug_print = 0 ;
444 
445  if ((debug_print%2) == 0)
446  {
447  switch( virtual_remote_state )
448  {
449  case REMOTE_RESET :
450  sprintf(buf,"RESET ") ;
451  break;
452  case REMOTE_RELEASE :
453  sprintf(buf,"RELEASED ") ;
454  break;
455  case REMOTE_HALF_PRESS :
456  sprintf(buf,"HALF PRESS ") ;
457  break;
458  case REMOTE_FULL_PRESS :
459  sprintf(buf,"FULL PRESS ") ;
460  break;
461  default :
462  sprintf(buf,"ERROR ") ;
463  break;
464  }
466  }
467  else
468  {
471  }
472 
473  if (((debug_print+25)%100) ==0 )
474  {
475  sprintf(buf,"switch=%d logic=%d sync=%s mode=%d ", switch_type, control_module, conf.synch_enable?"yes":"no", camera_mode) ;
477  sprintf(buf,"sync count=%d, pulse count=%d width=%d b=%d ", sync_counter, usb_count, usb_power, bracketing.shoot_counter);
479  sprintf(buf,"physw=%d err=%d %d %d ", physw_status[0]&0x03, debug_errors[0], debug_errors[1], debug_errors[2] );
481  }
482 
483  if (((debug_print+75)%100) == 0 )
484  {
485  buff_ptr = usb_buffer_in ;
486  buff_pos = 0 ;
487 
488  for ( i=0 ; i<16 ; i++ )
489  {
490  sprintf(&buf[buff_pos],"%d ", *buff_ptr) ;
491  buff_pos = strlen(buf) ;
492  if ( buff_pos > 45 )
493  {
494  buf[45] = 0 ;
495  i=17 ;
496  }
497  if ( buff_ptr-- == usb_buffer ) buff_ptr = &usb_buffer[15] ;
498  }
500  }
501  }
502  #endif
503  }
504 
505  return usb_remote_active ;
506 }
void kbd_synch_delay ( int  )

Definiert in Zeile 158 der Datei usb_remote.c.

159 {
160  int count1;
161 
162  for (count1=0;count1<delay_value;count1++) //wait delay_value * 0.1ms
163  {
164  asm volatile (
165  "mov r1, #0\n"
166  ".loop: \n\t"
167  "add r1, r1, #1\n\t"
168  "cmp r1, %0\n\t"
169  "blt .loop"
170  :
171  : "r" (synch_delay_tick)
172  : "r1" );
173 
174  }
175 }
void set_usb_remote_state ( )

Definiert in Zeile 377 der Datei usb_remote.c.

378 {
379  if (conf.remote_enable)
380  {
384  }
385  else
386  {
388  usb_remote_active = 0 ;
389  }
391 }
int start_usb_HPtimer ( int  )

Definiert in Zeile 1771 der Datei wrappers.c.

1772 {
1773 #ifdef CAM_REMOTE_USB_HIGHSPEED
1774 
1775  if ( usb_HPtimer_handle == 0 )
1776  {
1779  if (!(usb_HPtimer_handle & 0x01)) return 1 ;
1780  usb_HPtimer_handle = 0 ;
1781  }
1782 #endif
1783  return 0;
1784 }
int stop_usb_HPtimer ( )

Definiert in Zeile 1786 der Datei wrappers.c.

1787 {
1788 #ifdef CAM_REMOTE_USB_HIGHSPEED
1789  if( usb_HPtimer_handle )
1790  {
1792  usb_HPtimer_handle = 0 ;
1793  return 1 ;
1794  }
1795 #endif
1796  return 0;
1797 }
void usb_remote_key ( void  )

Definiert in Zeile 245 der Datei usb_remote.c.

246 {
247  static int pulse_count=0 ;
248 
250 
251  if(conf.remote_enable)
252  {
253  if (usb_state)
254  { // USB power is ON
255  if (remote_mark_count<30000) remote_mark_count++ ; // track how long the USB power is ON
256  if (remote_space_count != 0) // is this the 0 -> 1 transistion?
257  { //
258  usb_buffer_insert(remote_space_count); // insert space length into buffer
259  remote_space_count = 0 ; // reset the counter
260  }
261  }
262  else
263  { // USB power if OFF
264  if(remote_space_count>-30000) remote_space_count-- ; // track how long the USB power is OFF (note space counts are negative)
265  if (remote_mark_count != 0) // is this the 1 -> 0 transistion?
266  { //
267  pulse_count++ ; // count pulses transistions
268  usb_power = remote_mark_count; // transfer most recent pulse length to variable read by scripts
269  usb_buffer_insert(remote_mark_count); // insert pulse length into buffer
270  remote_mark_count = 0; // reset the counter
271  camera_info.state.kbd_last_clicked = 0xFF; // flag the remote key as the last one pressed (for scripts)
272  camera_info.state.kbd_last_clicked_time = get_tick_count(); // store key release time too
273  } //
274  if ((remote_space_count < -50) && (pulse_count > 0)) // pulse counting done if no activity for 50 timer periods
275  {
276  usb_count = pulse_count ;
277  logic_module_usb_count = pulse_count ;
278  pulse_count = 0 ;
279  }
280  }
281  }
282 }
void usb_remote_status_led ( int  )

Definiert in Zeile 218 der Datei usb_remote.c.

219 {
221  *(int*)camera_info.cam_remote_sync_status_led=state ? 0x46 : 0x44;
222 }
void wait_until_remote_button_is_released ( void  )

Variablen-Dokumentation

int bracketing_timeout

Definiert in Zeile 34 der Datei usb_remote.c.

enum CAMERA_MODE camera_mode

Definiert in Zeile 52 der Datei usb_remote.c.

enum DRIVER_STATE driver_state

Definiert in Zeile 49 der Datei usb_remote.c.

int forced_usb_port

Definiert in Zeile 35 der Datei usb_sync.c.

enum LOGIC_MODULE_STATE logic_module_state

Definiert in Zeile 50 der Datei usb_remote.c.

enum SWITCH_TYPE switch_type

Definiert in Zeile 46 der Datei usb_remote.c.

int usb_HPtimer_handle

Definiert in Zeile 1765 der Datei wrappers.c.

int usb_remote_active

Definiert in Zeile 33 der Datei usb_remote.c.

enum USB_POWER_STATE usb_state

Definiert in Zeile 51 der Datei usb_remote.c.

int usb_sync_wait_flag

Definiert in Zeile 32 der Datei usb_remote.c.

enum VIRTUAL_REMOTE_STATE virtual_remote_state

Definiert in Zeile 48 der Datei usb_remote.c.