| 1 | #ifndef PLATFORM_H |
|---|
| 2 | #define PLATFORM_H |
|---|
| 3 | |
|---|
| 4 | #include "camera.h" |
|---|
| 5 | |
|---|
| 6 | #define SSID_INVALID (-32767) |
|---|
| 7 | #define ASID_INVALID (-32767) |
|---|
| 8 | |
|---|
| 9 | #define MODE_MASK 0x0300 |
|---|
| 10 | #define MODE_REC 0x0100 |
|---|
| 11 | #define MODE_PLAY 0x0200 |
|---|
| 12 | |
|---|
| 13 | #define MODE_SHOOTING_MASK 0x00FF |
|---|
| 14 | |
|---|
| 15 | /* capture mode constants. These are in their own header for easier sed processing*/ |
|---|
| 16 | #include "modelist.h" |
|---|
| 17 | |
|---|
| 18 | // converted large macro to function in platform/generic/shooting.c (philmoz July 2011) |
|---|
| 19 | extern int mode_is_video(int); |
|---|
| 20 | #define MODE_IS_VIDEO(m) mode_is_video(m) |
|---|
| 21 | |
|---|
| 22 | /* propcase ID constants. These are in their own header files for easier sed processing */ |
|---|
| 23 | #if CAM_PROPSET == 4 |
|---|
| 24 | #include "propset4.h" |
|---|
| 25 | #elif CAM_PROPSET == 3 |
|---|
| 26 | #include "propset3.h" |
|---|
| 27 | #elif CAM_PROPSET == 2 // most digic3 cameras |
|---|
| 28 | #include "propset2.h" |
|---|
| 29 | #elif CAM_PROPSET == 1 // most digic2 cameras |
|---|
| 30 | #include "propset1.h" |
|---|
| 31 | #else |
|---|
| 32 | #error unknown camera processor |
|---|
| 33 | #endif |
|---|
| 34 | |
|---|
| 35 | #define MAX_DIST 65535 |
|---|
| 36 | #define MAX_DIST_HYPER_FOCAL 999999 |
|---|
| 37 | |
|---|
| 38 | //******************** |
|---|
| 39 | //char * get_debug(); |
|---|
| 40 | //******************** |
|---|
| 41 | |
|---|
| 42 | #define MODE_SCREEN_MASK 0x0C00 |
|---|
| 43 | #define MODE_SCREEN_OPENED 0x0400 |
|---|
| 44 | #define MODE_SCREEN_ROTATED 0x0800 |
|---|
| 45 | #define AS_SIZE (sizeof(aperture_sizes_table)/sizeof(aperture_sizes_table[0])) |
|---|
| 46 | #define ASID_MIN (aperture_sizes_table[0].id) |
|---|
| 47 | #define ASID_MAX (aperture_sizes_table[AS_SIZE-1].id) |
|---|
| 48 | |
|---|
| 49 | /* Keyboard repeat and initial delays */ |
|---|
| 50 | #define KBD_REPEAT_DELAY 140 |
|---|
| 51 | #define KBD_INITIAL_DELAY 300 |
|---|
| 52 | |
|---|
| 53 | // Video recording current status constants, see movie_status variable |
|---|
| 54 | #define VIDEO_RECORD_NEVER_STARTED 0 |
|---|
| 55 | #define VIDEO_RECORD_STOPPED 1 |
|---|
| 56 | #define VIDEO_RECORD_IN_PROGRESS 4 |
|---|
| 57 | |
|---|
| 58 | //Optical & digital zoom status constants, see zoom_status variable |
|---|
| 59 | #define ZOOM_OPTICAL_MIN 1 |
|---|
| 60 | #define ZOOM_OPTICAL_MAX 2 |
|---|
| 61 | #define ZOOM_OPTICAL_MEDIUM 3 |
|---|
| 62 | #define ZOOM_OPTICAL_IN 4 |
|---|
| 63 | #define ZOOM_OPTICAL_OUT 5 |
|---|
| 64 | #define ZOOM_OPTICAL_REACHED_MIN 7 |
|---|
| 65 | |
|---|
| 66 | #define ZOOM_DIGITAL_MAX 9 |
|---|
| 67 | #define ZOOM_DIGITAL_MEDIUM 10 |
|---|
| 68 | #define ZOOM_DIGITAL_IN 11 |
|---|
| 69 | #define ZOOM_DIGITAL_OUT 12 |
|---|
| 70 | #define ZOOM_DIGITAL_REACHED_MAX 13 |
|---|
| 71 | |
|---|
| 72 | typedef struct { |
|---|
| 73 | unsigned short hackmode; // platform independent mode values from MODE_xxx enum |
|---|
| 74 | unsigned short canonmode; // PROPCASE_SHOOTING_MODE value |
|---|
| 75 | } CapturemodeMap; |
|---|
| 76 | |
|---|
| 77 | typedef struct { |
|---|
| 78 | short id; // hacks id |
|---|
| 79 | short prop_id; // Canons id |
|---|
| 80 | char name[8]; |
|---|
| 81 | short shutter_dfs_value; // shutter speed to use dark frame substraction |
|---|
| 82 | } ISOTable; |
|---|
| 83 | |
|---|
| 84 | typedef struct { |
|---|
| 85 | short id; // hacks id |
|---|
| 86 | short prop_id; // Canons id |
|---|
| 87 | char name[8]; |
|---|
| 88 | long usec; |
|---|
| 89 | } ShutterSpeed; |
|---|
| 90 | |
|---|
| 91 | typedef struct { |
|---|
| 92 | short id; // hacks id |
|---|
| 93 | short prop_id; // Canons id |
|---|
| 94 | char name[8]; |
|---|
| 95 | } ApertureSize; |
|---|
| 96 | |
|---|
| 97 | typedef struct { |
|---|
| 98 | short av96; |
|---|
| 99 | short dav96; |
|---|
| 100 | short av96_step; |
|---|
| 101 | short tv96; |
|---|
| 102 | short dtv96; |
|---|
| 103 | short tv96_step; |
|---|
| 104 | short sv96; |
|---|
| 105 | short dsv96; |
|---|
| 106 | short sv96_step; |
|---|
| 107 | short iso; |
|---|
| 108 | short diso; |
|---|
| 109 | short iso_step; |
|---|
| 110 | short subj_dist; |
|---|
| 111 | short dsubj_dist; |
|---|
| 112 | short subj_dist_step; |
|---|
| 113 | short shoot_counter; |
|---|
| 114 | short type; |
|---|
| 115 | } EXPO_BRACKETING_VALUES; |
|---|
| 116 | |
|---|
| 117 | #define SET_NOW 1 |
|---|
| 118 | #define SET_LATER 0 |
|---|
| 119 | |
|---|
| 120 | #define SHOW_ALWAYS 1 |
|---|
| 121 | #define SHOW_HALF 2 |
|---|
| 122 | |
|---|
| 123 | typedef struct { |
|---|
| 124 | short av96; |
|---|
| 125 | short tv96; |
|---|
| 126 | short sv96; |
|---|
| 127 | short subj_dist; |
|---|
| 128 | short nd_filter; |
|---|
| 129 | } PHOTO_PARAM; |
|---|
| 130 | |
|---|
| 131 | typedef struct { |
|---|
| 132 | int subject_distance; |
|---|
| 133 | int near_limit; |
|---|
| 134 | int far_limit; |
|---|
| 135 | int hyperfocal_distance; |
|---|
| 136 | int depth_of_field; |
|---|
| 137 | int lens_to_focal_plane_width; |
|---|
| 138 | } DOF_TYPE; |
|---|
| 139 | |
|---|
| 140 | typedef struct { |
|---|
| 141 | short av96; |
|---|
| 142 | short tv96; |
|---|
| 143 | short sv96; |
|---|
| 144 | short iso; |
|---|
| 145 | short sv96_market; |
|---|
| 146 | short iso_market; |
|---|
| 147 | short bv96_measured; |
|---|
| 148 | short bv96_seted;//Ev96_internal-Sv96 |
|---|
| 149 | short ev96_seted; //Tv96+Av96 |
|---|
| 150 | short ev96_measured; //Bv96+Sv96 |
|---|
| 151 | short dev96;// Ev96_external-Ev96_internal |
|---|
| 152 | short dev96_canon;// Canon OverExposure |
|---|
| 153 | int b; //average scene luminance |
|---|
| 154 | } EXPO_TYPE; |
|---|
| 155 | |
|---|
| 156 | typedef struct { |
|---|
| 157 | float value; |
|---|
| 158 | char fraction[10]; |
|---|
| 159 | } shutter_speed; |
|---|
| 160 | |
|---|
| 161 | |
|---|
| 162 | /******************************************************************/ |
|---|
| 163 | |
|---|
| 164 | int get_focal_length(int zp); |
|---|
| 165 | int get_effective_focal_length(int zp); |
|---|
| 166 | int get_zoom_x(int zp); |
|---|
| 167 | |
|---|
| 168 | /******************************************************************/ |
|---|
| 169 | |
|---|
| 170 | long get_tick_count(); |
|---|
| 171 | |
|---|
| 172 | void remount_filesystem(); |
|---|
| 173 | void mark_filesystem_bootable(); |
|---|
| 174 | |
|---|
| 175 | /******************************************************************/ |
|---|
| 176 | |
|---|
| 177 | long get_parameter_data(long id, void *buf, long bufsize); |
|---|
| 178 | long set_parameter_data(long id, void *buf, long bufsize); |
|---|
| 179 | |
|---|
| 180 | long get_property_case(long id, void *buf, long bufsize); |
|---|
| 181 | long set_property_case(long id, void *buf, long bufsize); |
|---|
| 182 | |
|---|
| 183 | long get_file_counter(); |
|---|
| 184 | long get_exposure_counter(); |
|---|
| 185 | long get_file_next_counter(); |
|---|
| 186 | #if defined(CAM_DATE_FOLDER_NAMING) |
|---|
| 187 | void get_target_dir_name(char*); |
|---|
| 188 | #else |
|---|
| 189 | long get_target_dir_num(); |
|---|
| 190 | #endif |
|---|
| 191 | long get_target_file_num(); |
|---|
| 192 | |
|---|
| 193 | /******************************************************************/ |
|---|
| 194 | |
|---|
| 195 | void kbd_key_press(long key); |
|---|
| 196 | void kbd_key_release(long key); |
|---|
| 197 | void kbd_key_release_all(); |
|---|
| 198 | long kbd_is_key_pressed(long key); |
|---|
| 199 | long kbd_is_key_clicked(long key); |
|---|
| 200 | long kbd_get_pressed_key(); |
|---|
| 201 | long kbd_get_clicked_key(); |
|---|
| 202 | long kbd_get_autoclicked_key(); |
|---|
| 203 | void kbd_reset_autoclicked_key(); |
|---|
| 204 | long kbd_use_zoom_as_mf(); |
|---|
| 205 | long kbd_use_up_down_left_right_as_fast_switch(); |
|---|
| 206 | void kbd_set_alt_mode_key_mask(long key); |
|---|
| 207 | int get_usb_power(int edge); |
|---|
| 208 | long get_jogdial_direction(void); |
|---|
| 209 | /******************************************************************/ |
|---|
| 210 | |
|---|
| 211 | long vid_is_bitmap_shown(); |
|---|
| 212 | void *vid_get_bitmap_fb(); |
|---|
| 213 | long vid_get_bitmap_screen_width(); |
|---|
| 214 | long vid_get_bitmap_screen_height(); |
|---|
| 215 | long vid_get_bitmap_buffer_width(); |
|---|
| 216 | long vid_get_bitmap_buffer_height(); |
|---|
| 217 | void *vid_get_viewport_fb(); |
|---|
| 218 | void *vid_get_viewport_fb_d(); |
|---|
| 219 | void *vid_get_viewport_live_fb(); |
|---|
| 220 | void vid_bitmap_refresh(); |
|---|
| 221 | long vid_get_viewport_height(); |
|---|
| 222 | int vid_get_viewport_width(); |
|---|
| 223 | int vid_get_viewport_buffer_width(); |
|---|
| 224 | int vid_get_viewport_xoffset(); |
|---|
| 225 | int vid_get_viewport_yoffset(); |
|---|
| 226 | int vid_get_viewport_image_offset(); |
|---|
| 227 | int vid_get_viewport_row_offset(); |
|---|
| 228 | void vid_turn_off_updates(); |
|---|
| 229 | void vid_turn_on_updates(); |
|---|
| 230 | |
|---|
| 231 | /******************************************************************/ |
|---|
| 232 | |
|---|
| 233 | void *hook_raw_fptr(); |
|---|
| 234 | void *hook_raw_ret_addr(); |
|---|
| 235 | char *hook_raw_image_addr(); |
|---|
| 236 | char *hook_alt_raw_image_addr(); |
|---|
| 237 | long hook_raw_size(); |
|---|
| 238 | void hook_raw_install(); |
|---|
| 239 | void hook_raw_save_complete(); |
|---|
| 240 | |
|---|
| 241 | /******************************************************************/ |
|---|
| 242 | |
|---|
| 243 | long lens_get_zoom_pos(); |
|---|
| 244 | void lens_set_zoom_pos(long newpos); |
|---|
| 245 | long lens_get_zoom_point(); |
|---|
| 246 | void lens_set_zoom_point(long newpt); |
|---|
| 247 | void lens_set_zoom_speed(long newspd); //for S-series |
|---|
| 248 | long lens_get_focus_pos(); |
|---|
| 249 | long lens_get_focus_pos_from_lens(); |
|---|
| 250 | void lens_set_focus_pos(long newpos); |
|---|
| 251 | long lens_get_target_distance(); |
|---|
| 252 | |
|---|
| 253 | /******************************************************************/ |
|---|
| 254 | |
|---|
| 255 | int shooting_in_progress(); |
|---|
| 256 | int shooting_is_flash(); |
|---|
| 257 | int shooting_is_flash_ready(); |
|---|
| 258 | short shooting_get_flash_mode(); |
|---|
| 259 | |
|---|
| 260 | |
|---|
| 261 | /******************************************************************/ |
|---|
| 262 | int shooting_get_user_tv_id(); |
|---|
| 263 | char* shooting_get_tv_str(); |
|---|
| 264 | short shooting_get_tv96_from_shutter_speed(float t); |
|---|
| 265 | short shooting_get_tv96(); |
|---|
| 266 | void shooting_set_tv96(short v, short is_now); |
|---|
| 267 | void shooting_set_tv96_direct(short v, short is_now); |
|---|
| 268 | void shooting_set_shutter_speed_ubasic(int t, short is_now); |
|---|
| 269 | short shooting_get_user_tv96(); |
|---|
| 270 | void shooting_set_user_tv96(short v); |
|---|
| 271 | float shooting_get_shutter_speed_from_tv96(short tv); |
|---|
| 272 | float shooting_get_shutter_speed_override_value(); |
|---|
| 273 | const char * shooting_get_tv_override_value(); |
|---|
| 274 | const char * shooting_get_tv_bracket_value(); |
|---|
| 275 | const char * shooting_get_bracket_type(); |
|---|
| 276 | void shooting_set_user_tv_by_id(int v); |
|---|
| 277 | void shooting_set_user_tv_by_id_rel(int v); |
|---|
| 278 | const ShutterSpeed *shooting_get_tv_line(); |
|---|
| 279 | /******************************************************************/ |
|---|
| 280 | short shooting_get_aperture_sizes_table_size(); |
|---|
| 281 | short shooting_get_aperture_sizes_table_prop_id(short i); |
|---|
| 282 | short shooting_get_max_aperture_sizes_table_prop_id(); |
|---|
| 283 | short shooting_get_aperture_from_av96(short av96); |
|---|
| 284 | int shooting_get_user_av_id(); |
|---|
| 285 | char* shooting_get_av_str(); |
|---|
| 286 | void shooting_set_user_av_by_id(int v); |
|---|
| 287 | short shooting_get_av96(); |
|---|
| 288 | void shooting_set_av96(short v,short is_now); |
|---|
| 289 | void shooting_set_av96_direct(short v, short is_now); |
|---|
| 290 | short shooting_get_user_av96(); |
|---|
| 291 | void shooting_set_user_av96(short v); |
|---|
| 292 | void shooting_set_user_av_by_id_rel(int v); |
|---|
| 293 | short shooting_get_real_aperture(); |
|---|
| 294 | short shooting_get_min_real_aperture(); |
|---|
| 295 | short shooting_get_av96_override_value(); |
|---|
| 296 | const char * shooting_get_av_bracket_value(); |
|---|
| 297 | void shooting_set_nd_filter_state(short v, short is_now); |
|---|
| 298 | /******************************************************************/ |
|---|
| 299 | int shooting_get_day_seconds(); |
|---|
| 300 | int shooting_get_tick_count(); |
|---|
| 301 | /******************************************************************/ |
|---|
| 302 | void shooting_set_prop(int id, int v); |
|---|
| 303 | int shooting_get_prop(int id); |
|---|
| 304 | /******************************************************************/ |
|---|
| 305 | extern int circle_of_confusion; |
|---|
| 306 | /******************************************************************/ |
|---|
| 307 | extern const int zoom_points; |
|---|
| 308 | int shooting_get_zoom(); |
|---|
| 309 | void shooting_set_zoom(int v); |
|---|
| 310 | void shooting_set_zoom_rel(int v); |
|---|
| 311 | void shooting_set_zoom_speed(int v); |
|---|
| 312 | /******************************************************************/ |
|---|
| 313 | int shooting_get_focus(); |
|---|
| 314 | void shooting_set_focus(int v, short is_now); |
|---|
| 315 | short shooting_get_focus_mode(); |
|---|
| 316 | int shooting_get_hyperfocal_distance(); |
|---|
| 317 | int shooting_get_hyperfocal_distance_f(int av, int fl); |
|---|
| 318 | int shooting_get_near_limit_of_acceptable_sharpness(); |
|---|
| 319 | int shooting_get_far_limit_of_acceptable_sharpness(); |
|---|
| 320 | int shooting_get_depth_of_field(); |
|---|
| 321 | int shooting_get_subject_distance(); |
|---|
| 322 | int shooting_get_subject_distance_override_value(); |
|---|
| 323 | int shooting_get_subject_distance_bracket_value(); |
|---|
| 324 | int shooting_get_subject_distance_override_koef(); |
|---|
| 325 | int shooting_get_lens_to_focal_plane_width(); |
|---|
| 326 | short shooting_get_drive_mode(); |
|---|
| 327 | short shooting_can_focus(); |
|---|
| 328 | short shooting_get_common_focus_mode(); |
|---|
| 329 | /******************************************************************/ |
|---|
| 330 | int shooting_get_iso_mode(); |
|---|
| 331 | void shooting_set_iso_mode(int v); |
|---|
| 332 | short shooting_get_sv96(); |
|---|
| 333 | short shooting_get_svm96(); |
|---|
| 334 | short shooting_get_iso_market(); |
|---|
| 335 | short shooting_get_iso_real(); |
|---|
| 336 | void shooting_set_iso_real(short iso, short is_now); |
|---|
| 337 | //void shooting_set_iso_market(short isom); |
|---|
| 338 | //void shooting_set_iso_real_delta_from_base(short diso); |
|---|
| 339 | void shooting_set_sv96(short sv96, short is_now); |
|---|
| 340 | short shooting_get_iso_override_value(); |
|---|
| 341 | short shooting_get_iso_bracket_value(); |
|---|
| 342 | /******************************************************************/ |
|---|
| 343 | short shooting_get_canon_overexposure_value(); |
|---|
| 344 | short shooting_get_bv96(); |
|---|
| 345 | int shooting_get_luminance(); |
|---|
| 346 | //const char* shooting_get_flash_light_value(); |
|---|
| 347 | /******************************************************************/ |
|---|
| 348 | int shooting_get_canon_subject_distance(); |
|---|
| 349 | int shooting_get_exif_subject_dist(); |
|---|
| 350 | /******************************************************************/ |
|---|
| 351 | void shooting_expo_param_override(); |
|---|
| 352 | void shooting_bracketing(void); |
|---|
| 353 | |
|---|
| 354 | void shooting_video_bitrate_change(int v); |
|---|
| 355 | extern int auto_started; |
|---|
| 356 | void shooting_tv_bracketing(); |
|---|
| 357 | void shooting_av_bracketing(); |
|---|
| 358 | void shooting_iso_bracketing(); |
|---|
| 359 | /******************************************************************/ |
|---|
| 360 | // capture mode functions |
|---|
| 361 | // return a CHDK mode enum for a PROPCASE_SHOOTING_MODE value, or 0 if not found |
|---|
| 362 | int shooting_mode_canon2chdk(int canonmode); |
|---|
| 363 | // return a PROPCASE_SHOOTING_MODE value for a CHDK mode enum value, or -1 if not found. 0 is a valid mode on some cameras. |
|---|
| 364 | int shooting_mode_chdk2canon(int hackmode); |
|---|
| 365 | // set capture mode from CHDK mode, returns 0 if mode not found or not in rec, otherwise 1 |
|---|
| 366 | int shooting_set_mode_chdk(int mode); |
|---|
| 367 | // set capture mode from PROPCASE_SHOOTING_MODE value. return 0 if not in rec or mode is -1, otherwise 1 |
|---|
| 368 | int shooting_set_mode_canon(int mode); |
|---|
| 369 | |
|---|
| 370 | // returns 0 if in play, nonzero if rec |
|---|
| 371 | int rec_mode_active(void); |
|---|
| 372 | |
|---|
| 373 | // not used. Right now this is just to preserve code from earlier version of mode_get() |
|---|
| 374 | // in case we want to check play/rec switch state in the future. |
|---|
| 375 | // WARNING: it isn't known if all variants of this check the switch state or some other bit. |
|---|
| 376 | // should return 0 is switch is in play position, non-zero otherwise |
|---|
| 377 | //int rec_switch_state(void); |
|---|
| 378 | |
|---|
| 379 | // swivel screen state. |
|---|
| 380 | #ifdef CAM_SWIVEL_SCREEN |
|---|
| 381 | // 0 not open, non-zero open |
|---|
| 382 | int screen_opened(void); |
|---|
| 383 | // 0 not rotated, non-zero rotated |
|---|
| 384 | int screen_rotated(void); |
|---|
| 385 | #endif |
|---|
| 386 | |
|---|
| 387 | /******************************************************************/ |
|---|
| 388 | void clear_values(); |
|---|
| 389 | /******************************************************************/ |
|---|
| 390 | |
|---|
| 391 | int mode_get(); |
|---|
| 392 | |
|---|
| 393 | /******************************************************************/ |
|---|
| 394 | |
|---|
| 395 | long stat_get_vbatt(); |
|---|
| 396 | int get_ccd_temp(); |
|---|
| 397 | int get_optical_temp(); |
|---|
| 398 | int get_battery_temp(); |
|---|
| 399 | long get_vbatt_min(); |
|---|
| 400 | long get_vbatt_max(); |
|---|
| 401 | void play_sound(unsigned sound); |
|---|
| 402 | void camera_set_raw(int mode); |
|---|
| 403 | void camera_set_nr(int mode); |
|---|
| 404 | int camera_get_nr(); |
|---|
| 405 | int camera_get_script_autostart(); |
|---|
| 406 | void camera_set_script_autostart(); |
|---|
| 407 | void exit_alt(); |
|---|
| 408 | void camera_shutdown_in_a_second(void); |
|---|
| 409 | |
|---|
| 410 | void disable_shutdown(); |
|---|
| 411 | void enable_shutdown(); |
|---|
| 412 | |
|---|
| 413 | void JogDial_CW(void); |
|---|
| 414 | void JogDial_CCW(void); |
|---|
| 415 | void change_video_tables(int a, int b); |
|---|
| 416 | int get_flash_params_count(void); |
|---|
| 417 | |
|---|
| 418 | /******************************************************************/ |
|---|
| 419 | void __attribute__((noreturn)) shutdown(); |
|---|
| 420 | void camera_set_led(int led, int state, int bright); |
|---|
| 421 | void debug_led(int state); |
|---|
| 422 | /****************************************/ |
|---|
| 423 | extern int canon_menu_active; |
|---|
| 424 | extern char canon_shoot_menu_active; |
|---|
| 425 | extern int recreview_hold; |
|---|
| 426 | |
|---|
| 427 | extern int movie_status; |
|---|
| 428 | unsigned int movie_reset; |
|---|
| 429 | unsigned int GetFreeCardSpaceKb(void); |
|---|
| 430 | unsigned int GetTotalCardSpaceKb(void); |
|---|
| 431 | |
|---|
| 432 | void swap_partitions(void); |
|---|
| 433 | int get_part_count(void); |
|---|
| 434 | void create_partitions(void); |
|---|
| 435 | extern char * camera_jpeg_count_str(); |
|---|
| 436 | |
|---|
| 437 | unsigned int GetJpgCount(void); |
|---|
| 438 | unsigned int GetRawCount(void); |
|---|
| 439 | |
|---|
| 440 | void MakeAFScan(void); |
|---|
| 441 | extern int movie_status; |
|---|
| 442 | extern int zoom_status; |
|---|
| 443 | void EnterToCompensationEVF(void); |
|---|
| 444 | void ExitFromCompensationEVF(void); |
|---|
| 445 | |
|---|
| 446 | void TurnOnBackLight(void); |
|---|
| 447 | void TurnOffBackLight(void); |
|---|
| 448 | |
|---|
| 449 | void wait_until_remote_button_is_released(void); |
|---|
| 450 | short shooting_get_ev_correction1(); |
|---|
| 451 | |
|---|
| 452 | //image_quality_override |
|---|
| 453 | void shooting_set_image_quality(int imq); |
|---|
| 454 | |
|---|
| 455 | int get_ev_video_avail(void); |
|---|
| 456 | void set_ev_video_avail(int); |
|---|
| 457 | int get_ev_video(void); |
|---|
| 458 | void set_ev_video(int); |
|---|
| 459 | //dng related |
|---|
| 460 | // new version to support DNG double buffer |
|---|
| 461 | void reverse_bytes_order2(char* from, char* to, int count); |
|---|
| 462 | // convert old version calls to new version (to minimise code changes) |
|---|
| 463 | #define reverse_bytes_order(start, count) reverse_bytes_order2(start,start,count) |
|---|
| 464 | void save_ext_for_dng(void); |
|---|
| 465 | void change_ext_to_dng(void); |
|---|
| 466 | void change_ext_to_default(void); |
|---|
| 467 | |
|---|
| 468 | void DoAFLock(void); |
|---|
| 469 | void UnlockAF(void); |
|---|
| 470 | |
|---|
| 471 | void drv_self_hide(void); |
|---|
| 472 | void drv_self_unhide(void); |
|---|
| 473 | |
|---|
| 474 | void PostLogicalEventForNotPowerType(unsigned event, unsigned unk); |
|---|
| 475 | void PostLogicalEventToUI(unsigned event, unsigned unk); |
|---|
| 476 | void SetLogicalEventActive(unsigned event, unsigned state); |
|---|
| 477 | void SetScriptMode(unsigned mode); |
|---|
| 478 | |
|---|
| 479 | /* |
|---|
| 480 | call C function with argument list created at runtime. |
|---|
| 481 | See lib/armutil/callfunc.S for documentation |
|---|
| 482 | */ |
|---|
| 483 | unsigned call_func_ptr(void *func, const unsigned *args, unsigned n_args); |
|---|
| 484 | |
|---|
| 485 | /* |
|---|
| 486 | reboot, optionally loading a different binary |
|---|
| 487 | see lib/armutil/reboot.c for documentation |
|---|
| 488 | */ |
|---|
| 489 | int reboot(const char *bootfile); |
|---|
| 490 | |
|---|
| 491 | #define started() debug_led(1) |
|---|
| 492 | #define finished() debug_led(0) |
|---|
| 493 | |
|---|
| 494 | |
|---|
| 495 | #ifdef CAM_CHDK_PTP |
|---|
| 496 | |
|---|
| 497 | typedef struct { |
|---|
| 498 | int code; |
|---|
| 499 | int sess_id; |
|---|
| 500 | int trans_id; |
|---|
| 501 | int num_param; |
|---|
| 502 | int param1; |
|---|
| 503 | int param2; |
|---|
| 504 | int param3; |
|---|
| 505 | int param4; |
|---|
| 506 | int param5; |
|---|
| 507 | } PTPContainer; |
|---|
| 508 | |
|---|
| 509 | typedef struct { |
|---|
| 510 | int handle; |
|---|
| 511 | int (*send_data)(int handle, const char *buf, int part_size, int total_size, int, int, int); // (0xFF9F525C), total_size should be 0 except for the first call |
|---|
| 512 | int (*recv_data)(int handle, char *buf, int size, int, int); // (0xFF9F5500) |
|---|
| 513 | int (*send_resp)(int handle, PTPContainer *resp); // (0xFF9F5688) |
|---|
| 514 | int (*get_data_size)(int handle); // (0xFF9F5830) |
|---|
| 515 | int (*send_err_resp)(int handle, PTPContainer *resp); // (0xFF9F5784) |
|---|
| 516 | int unknown1; // ??? |
|---|
| 517 | int (*f2)(); // ??? (0xFF8D5B24) |
|---|
| 518 | int (*f3)(); // ??? (0xFF8D5B5C) |
|---|
| 519 | // more?? |
|---|
| 520 | } ptp_data; |
|---|
| 521 | |
|---|
| 522 | typedef int (*ptp_handler)(int, ptp_data*, int, int, int, int, int, int, int, int); |
|---|
| 523 | |
|---|
| 524 | int add_ptp_handler(int opcode, ptp_handler handler, int unknown); |
|---|
| 525 | |
|---|
| 526 | void init_chdk_ptp(); |
|---|
| 527 | void init_chdk_ptp_task(); |
|---|
| 528 | |
|---|
| 529 | typedef struct { |
|---|
| 530 | unsigned size; |
|---|
| 531 | unsigned script_id; // id of script message is to/from |
|---|
| 532 | unsigned type; |
|---|
| 533 | unsigned subtype; |
|---|
| 534 | char data[]; |
|---|
| 535 | } ptp_script_msg; |
|---|
| 536 | int ptp_script_write_msg(ptp_script_msg *msg); |
|---|
| 537 | ptp_script_msg* ptp_script_read_msg(void); |
|---|
| 538 | ptp_script_msg* ptp_script_create_msg(unsigned type, unsigned subtype, unsigned datasize, const void *data); |
|---|
| 539 | int ptp_script_write_error_msg(unsigned errtype, const char *err); |
|---|
| 540 | |
|---|
| 541 | #endif // CAM_CHDK_PTP |
|---|
| 542 | |
|---|
| 543 | int switch_mode_usb(int mode); // 0 = playback, 1 = record; return indicates success |
|---|
| 544 | // N.B.: switch_mode only supported when USB is connected |
|---|
| 545 | |
|---|
| 546 | void ExitTask(); |
|---|
| 547 | |
|---|
| 548 | // Data returned from GetMemInfo & GetExMemInfo functions stored in this data structure |
|---|
| 549 | typedef struct { |
|---|
| 550 | int start_address; |
|---|
| 551 | int end_address; |
|---|
| 552 | int total_size; |
|---|
| 553 | int allocated_size; |
|---|
| 554 | int allocated_peak; |
|---|
| 555 | int allocated_count; |
|---|
| 556 | int free_size; |
|---|
| 557 | int free_block_max_size; |
|---|
| 558 | int free_block_count; |
|---|
| 559 | } cam_meminfo; |
|---|
| 560 | |
|---|
| 561 | #if defined(CAM_FIRMWARE_MEMINFO) |
|---|
| 562 | extern void GetMemInfo(cam_meminfo*); |
|---|
| 563 | #endif |
|---|
| 564 | |
|---|
| 565 | #ifdef OPT_EXMEM_MALLOC |
|---|
| 566 | void exmem_malloc_init(void); |
|---|
| 567 | void GetExMemInfo(cam_meminfo*); |
|---|
| 568 | #endif |
|---|
| 569 | |
|---|
| 570 | #endif |
|---|