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

318 {
319  usb_power = 0 ;
320  usb_count = 0 ;
323 }
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 332 der Datei usb_remote.c.

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

Definiert in Zeile 398 der Datei usb_remote.c.

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

383 {
384  if (conf.remote_enable)
385  {
389  }
390  else
391  {
393  usb_remote_active = 0 ;
394  }
396 }
int start_usb_HPtimer ( int  )

Definiert in Zeile 1858 der Datei wrappers.c.

1859 {
1860 #ifdef CAM_REMOTE_USB_HIGHSPEED
1861 
1862  if ( usb_HPtimer_handle == 0 )
1863  {
1866  if (!(usb_HPtimer_handle & 0x01)) return 1 ;
1867  usb_HPtimer_handle = 0 ;
1868  }
1869 #endif
1870  return 0;
1871 }
int stop_usb_HPtimer ( )

Definiert in Zeile 1873 der Datei wrappers.c.

1874 {
1875 #ifdef CAM_REMOTE_USB_HIGHSPEED
1876  if( usb_HPtimer_handle )
1877  {
1879  usb_HPtimer_handle = 0 ;
1880  return 1 ;
1881  }
1882 #endif
1883  return 0;
1884 }
void usb_remote_key ( void  )

Definiert in Zeile 250 der Datei usb_remote.c.

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

Definiert in Zeile 218 der Datei usb_remote.c.

219 {
221  {
223  debug_led(state);
224  else
225  *(int*)camera_info.cam_remote_sync_status_led=state ? 0x46 : 0x44;
226  }
227 }
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 1852 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.