root/platform/g1x/main.c

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

DEFINITIONS

This source file includes following definitions.
  1. startup
  2. screen_opened
  3. screen_rotated
  4. get_effective_focal_length
  5. get_focal_length
  6. get_zoom_x
  7. get_vbatt_min
  8. get_vbatt_max

   1 #include "lolevel.h"
   2 #include "platform.h"
   3 #include "core.h"
   4 #include "keyboard.h"
   5 
   6 
   7 extern long link_bss_start;
   8 extern long link_bss_end;
   9 extern void boot();
  10 
  11 
  12 void startup()
  13 {
  14         long *bss = &link_bss_start;
  15 
  16         // sanity check
  17         if ((long)&link_bss_end > (MEMISOSTART + MEMISOSIZE)){
  18                 started();
  19                 shutdown();
  20         }
  21 
  22         // initialize .bss senment
  23         while (bss<&link_bss_end)
  24                 *bss++ = 0;
  25 
  26         boot();
  27 }
  28 
  29 int screen_opened(void) {
  30         return (physw_status[2] & 0x00002000);
  31 }
  32 
  33 int screen_rotated(void) {
  34         return !(physw_status[2] & 0x00001000);
  35 }
  36 
  37 // Focus length table in firmware @ FFFEA5CC
  38 #define NUM_FL      101 // 0 - 100, entries in firmware
  39 #define NUM_DATA    2   // 2 words each entry, first is FL
  40 extern int focus_len_table[NUM_FL*NUM_DATA];
  41 
  42 // Conversion factor lens FL --> 35mm equiv
  43 // lens      35mm     CF
  44 // ----      ----     --
  45 // 15.1       28      ( 28/15.1) * 151 = 280  (min FL)
  46 // 60.4      112      (112/60.4) * 151 = 280  (max FL)
  47 #define CF_EFL      280
  48 #define CF_EFL_DIV  151
  49 
  50 const int zoom_points = NUM_FL;
  51 
  52 int get_effective_focal_length(int zp) {
  53         return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV;
  54 }
  55 
  56 int get_focal_length(int zp) {
  57         if (zp < 0) zp = 0;
  58         else if (zp >= NUM_FL) zp = NUM_FL-1;
  59         return focus_len_table[zp*NUM_DATA];
  60 }
  61 
  62 int get_zoom_x(int zp) {
  63         return get_focal_length(zp)*10/focus_len_table[0];
  64 }
  65 
  66 long get_vbatt_min()
  67 {
  68         return 6450;    // TODO
  69 }
  70 
  71 long get_vbatt_max()
  72 {
  73         return 8300;    // TODO
  74 }
  75 

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