root/platform/generic/capt_seq.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. capt_seq_hook_raw_here
  2. wait_until_remote_button_is_released
  3. hook_raw_save_complete
  4. capt_seq_hook_set_nr

   1 // generic capt_seq fuctions
   2 #include "asmsafe.h"
   3 #include "conf.h"
   4 
   5 #define RAWDATA_AVAILABLE (1)
   6 #define RAWDATA_SAVED (2)
   7 
   8 // some cams use different values
   9 // note: many cams ROM also accepts a value of 3, meaning unknown
  10 #ifndef NR_ON
  11 #define NR_ON (2)
  12 #endif
  13 #ifndef NR_OFF
  14 #define NR_OFF (1)
  15 #endif
  16 
  17 static long raw_save_stage;
  18 
  19 #include "remotecap_core.h"
  20 
  21 void __attribute__((naked,noinline)) capt_seq_hook_raw_here()
  22 {
  23  asm volatile("STMFD   SP!, {R0-R12,LR}\n");
  24 
  25 #ifdef PAUSE_FOR_FILE_COUNTER
  26     // Some cameras need a slight delay for the file counter to be updated correctly
  27     // before raw_savefile tries to get the file name & directory.
  28     // Add '#define PAUSE_FOR_FILE_COUNTER 100' in the camera firmware capt_seq.c file.
  29     // The value can be adjusted as needed for different cameras.
  30 
  31     if ((conf.save_raw && is_raw_enabled()) // Only delay if RAW enabled (prevents slowdown in HQ burst mode)
  32         || (remotecap_get_target()) //... or if remote shooting is active
  33     )
  34     {
  35         int fc = get_file_counter();
  36         int tc = get_tick_count() + PAUSE_FOR_FILE_COUNTER;
  37         while ((get_file_counter() == fc) && (get_tick_count() < tc)) {
  38             _SleepTask(10);
  39         }
  40     }
  41 #endif
  42 
  43     raw_save_stage = RAWDATA_AVAILABLE;
  44     core_rawdata_available(); //notifies spytask in core/main.c
  45     while (raw_save_stage != RAWDATA_SAVED){
  46     _SleepTask(10);
  47     }
  48  asm volatile("LDMFD   SP!, {R0-R12,PC}\n");
  49 }
  50 
  51 // wrapper function to store status on stack as this routine is called from assembly code in capt_seq_task()
  52 
  53 void __attribute__((naked,noinline)) wait_until_remote_button_is_released(  ) 
  54 { 
  55 asm volatile (
  56 ASM_SAFE("BL _wait_until_remote_button_is_released\n")
  57  "      BX      LR \n"
  58         ) ;
  59 }
  60 
  61 
  62 void hook_raw_save_complete()
  63 {
  64     raw_save_stage = RAWDATA_SAVED;
  65 }
  66 
  67 #if defined(USE_STUBS_NRFLAG)
  68 extern long _nrflag;
  69 #define set_nrflag(n)   _nrflag = n
  70 #else
  71 #define set_nrflag(n)   *nrflag = n
  72 #endif
  73 
  74 void __attribute__((naked,noinline)) capt_seq_hook_set_nr()
  75 {
  76  asm volatile("STMFD   SP!, {R0-R12,LR}\n");
  77     switch (conf.raw_nr){
  78     case NOISE_REDUCTION_AUTO_CANON:
  79         // leave it alone
  80 #if defined(NR_AUTO)                    // If value defined store it (e.g. for G12 & SX30 need to reset back to 0 to enable auto)
  81         set_nrflag(NR_AUTO);
  82 #endif
  83         break;
  84     case NOISE_REDUCTION_OFF:
  85         set_nrflag(NR_OFF);
  86         break;
  87     case NOISE_REDUCTION_ON:
  88         set_nrflag(NR_ON);
  89         break;
  90     };
  91 
  92  camera_info.state.shutter_open_time = _time((void*)0);
  93  camera_info.state.shutter_open_tick_count = get_tick_count();
  94 
  95  asm volatile("LDMFD   SP!, {R0-R12,PC}\n");
  96 }
  97 

/* [<][>][^][v][top][bottom][index][help] */