root/platform/g16/main.c

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

DEFINITIONS

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

   1 #include "lolevel.h"
   2 #include "platform.h"
   3 #include "core.h"
   4 #include "keyboard.h"
   5 
   6 extern long link_bss_start;
   7 extern long link_bss_end;
   8 extern void boot();
   9 
  10 void startup()
  11 {
  12 
  13     long *bss = &link_bss_start;
  14 
  15     // sanity check
  16     if ((long)&link_bss_end > (MEMISOSTART + MEMISOSIZE)) {      
  17         //started();
  18             #define LED_PR     0xd20b0994       // G16 green LED on OVF bezel   
  19             #define LED_PWR    0xd20b0884       // G16 green LED on power button
  20             #define LED_ORANGE 0xd20b0888       // G16 orange LED on OVF bezel   
  21             #define XDELAY 4000000         
  22             int j = 1000 ;
  23             while(j-- > 0) {
  24                 int i;
  25                 *(volatile int*)LED_PR = 0x4d0002;
  26                 *(volatile int*)LED_PWR = 0x4d0002;
  27                 *(volatile int*)LED_ORANGE = 0x4d0002;
  28                 for(i=0;i<XDELAY/10;i++) {
  29                     asm volatile(
  30                     "nop\n"
  31                     );
  32                 }
  33                 *(volatile int*)LED_PR = 0x4c0003;
  34                 *(volatile int*)LED_PWR = 0x4c0003;
  35                 *(volatile int*)LED_ORANGE = 0x4c0003;                                
  36                 for(i=0;i<XDELAY;i++) {
  37                     asm volatile(
  38                     "nop\n"
  39                     );
  40                 }
  41             }  
  42         shutdown();
  43     }
  44   
  45     // initialize .bss senment
  46     while (bss<&link_bss_end)
  47         *bss++ = 0;
  48     boot();
  49 }
  50 
  51 // Conversion factor lens FL --> 35mm equiv G16
  52 // lens      35mm     CF
  53 // ----      ----     --
  54 // 6.1       28       ( 28/ 6.1) * 61 = 280  (min FL)
  55 // 30.5      140      (140/30.5) * 61 = 280  (max FL)
  56 
  57 #define CF_EFL      280
  58 #define CF_EFL_DIV  61
  59 #define NUM_FL      122 // G16 1.01c 0xfdf2bd38 to 0xdf2c108
  60 #define NUM_DATA    2   // 2 x 32 bit words each entry, first is FL, second is multiplier (x100)
  61 
  62 extern int focus_len_table[NUM_FL*NUM_DATA];
  63 const int zoom_points = NUM_FL;
  64 
  65 int get_effective_focal_length(int zp)
  66 {
  67     return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV;
  68 }
  69 
  70 int get_focal_length(int zp)
  71 {
  72     if (zp < 0) zp = 0;
  73     else if (zp >= NUM_FL) zp = NUM_FL-1;
  74     return focus_len_table[zp*NUM_DATA];
  75 }
  76 
  77 int get_zoom_x(int zp)
  78 {
  79     return get_focal_length(zp)*10/focus_len_table[0];
  80 }
  81 
  82 // Battery voltage thresholds
  83 
  84 long get_vbatt_min() { return 6450; }
  85 long get_vbatt_max() { return 8250; }

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