CHDK_DE Vorschauversion  Trunk Rev. 5707
 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 316 der Datei usb_remote.c.

317 {
318  usb_power = 0 ;
319  usb_count = 0 ;
322 }
int force_usb_state ( int  )

Definiert in Zeile 36 der Datei usb_sync.c.

37 {
38  forced_usb_port = state ;
39 #ifdef CAM_ALLOWS_USB_PORT_FORCING
40  return 1 ;
41 #else
42  return 0 ;
43 #endif
44 }
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 54 der Datei usb_sync.c.

55 {
56 #ifdef CAM_REMOTE_MULTICHANNEL
58  {
59  case REMOTE_INPUT_USB:
60  return get_usb_bit();
61 #ifdef CAM_REMOTE_HDMI_HPD
63  return get_hdmi_hpd_bit();
64 #endif
65 #ifdef CAM_REMOTE_ANALOG_AV
67  return get_analog_av_bit();
68 #endif
69 #ifdef CAM_REMOTE_AtoD_CHANNEL
72 #endif
73  }
74  return 0;
75 #else // not CAM_REMOTE_MULTICHANNEL
76  return( get_usb_bit() );
77 #endif
78 }
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 331 der Datei usb_remote.c.

332 {
333  int x = 0;
334 
335  switch( mode)
336  {
337  case SINGLE_PULSE :
338  x = usb_power;
339  usb_power = 0;
340  break ;
341  case USB_STATE :
342  x=usb_state;
343  break ;
344  case BUFFERED_PULSE :
345  if ( usb_buffer_out != usb_buffer_in )
346  {
348  x = *usb_buffer_out ;
349  }
350  break ;
351  case PULSE_COUNT :
352  x = usb_count;
353  usb_count = 0;
354  break ;
355  case LM_PULSE_COUNT :
358  break ;
359  case HPTIMER_ERROR_COUNT :
362  break ;
363  }
364  return x;
365 }
int GetAdChValue ( int  )
int handle_usb_remote ( )

Definiert in Zeile 399 der Datei usb_remote.c.

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

Definiert in Zeile 157 der Datei usb_remote.c.

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

Definiert in Zeile 381 der Datei usb_remote.c.

382 {
383  if (conf.remote_enable)
384  {
388  }
389  else
390  {
392  usb_remote_active = 0 ;
393  }
397 }
int start_usb_HPtimer ( int  )

Definiert in Zeile 1901 der Datei wrappers.c.

1902 {
1903 #ifdef CAM_REMOTE_USB_HIGHSPEED
1904 
1905  if ( usb_HPtimer_handle == 0 )
1906  {
1909  if (!(usb_HPtimer_handle & 0x01)) return 1 ;
1910  usb_HPtimer_handle = 0 ;
1911  }
1912 #endif
1913  return 0;
1914 }
int stop_usb_HPtimer ( )

Definiert in Zeile 1916 der Datei wrappers.c.

1917 {
1918 #ifdef CAM_REMOTE_USB_HIGHSPEED
1919  if( usb_HPtimer_handle )
1920  {
1922  usb_HPtimer_handle = 0 ;
1923  return 1 ;
1924  }
1925 #endif
1926  return 0;
1927 }
void usb_remote_key ( void  )

Definiert in Zeile 249 der Datei usb_remote.c.

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

Definiert in Zeile 217 der Datei usb_remote.c.

218 {
220  {
222  debug_led(state);
223  else
224  *(int*)camera_info.cam_remote_sync_status_led=state ? 0x46 : 0x44;
225  }
226 }
void wait_until_remote_button_is_released ( void  )

Variablen-Dokumentation

int bracketing_timeout

Definiert in Zeile 33 der Datei usb_remote.c.

enum CAMERA_MODE camera_mode

Definiert in Zeile 51 der Datei usb_remote.c.

enum DRIVER_STATE driver_state

Definiert in Zeile 48 der Datei usb_remote.c.

int forced_usb_port

Definiert in Zeile 34 der Datei usb_sync.c.

enum LOGIC_MODULE_STATE logic_module_state

Definiert in Zeile 49 der Datei usb_remote.c.

enum SWITCH_TYPE switch_type

Definiert in Zeile 45 der Datei usb_remote.c.

int usb_HPtimer_handle

Definiert in Zeile 1896 der Datei wrappers.c.

int usb_remote_active

Definiert in Zeile 32 der Datei usb_remote.c.

enum USB_POWER_STATE usb_state

Definiert in Zeile 50 der Datei usb_remote.c.

int usb_sync_wait_flag

Definiert in Zeile 31 der Datei usb_remote.c.

enum VIRTUAL_REMOTE_STATE virtual_remote_state

Definiert in Zeile 47 der Datei usb_remote.c.