root/platform/s5is/main.c

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

DEFINITIONS

This source file includes following definitions.
  1. startup
  2. screen_opened
  3. screen_rotated
  4. rec_switch_state
  5. get_effective_focal_length
  6. get_focal_length
  7. get_zoom_x
  8. get_vbatt_min
  9. 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 
  30 int screen_opened(void) {
  31 //      mode |= (physw_status[1] & 0x00000100)?0:MODE_SCREEN_OPENED;
  32         return !(physw_status[1] & 0x00000100);
  33 }
  34 
  35 int screen_rotated(void) {
  36 //      mode |= (physw_status[1] & 0x00000200)?0:MODE_SCREEN_ROTATED;
  37         return !(physw_status[1] & 0x00000200);
  38 }
  39 
  40 #if 0
  41 int rec_switch_state(void) {
  42 // not sure what this was checking
  43 //      volatile int *physw_mmio = (int *) 0xC0220200; // I don't know where else I can find this...
  44 //      mode  = (physw_mmio[1] & 0x00010000)?MODE_REC:MODE_PLAY;
  45 }
  46 #endif
  47 
  48 static const struct {
  49         int zp, fl;
  50 } fl_tbl[] = {
  51         {   0,   6000 },
  52         {  11,   6400 },
  53         {  41,  12100 },
  54         {  64,  21300 },
  55         {  86,  41600 },
  56         { 105,  61400 },
  57         { 128,  72000 },
  58 };
  59 #define NUM_FL (int)(sizeof(fl_tbl)/sizeof(fl_tbl[0]))
  60 #define CF_EFL 6000
  61 
  62 const int zoom_points = 129;
  63 
  64 int get_effective_focal_length(int zp) {
  65         return (CF_EFL*get_focal_length(zp))/1000;
  66 }
  67 
  68 int get_focal_length(int zp) {
  69         int i;
  70 
  71         if (zp<fl_tbl[0].zp)
  72                 return fl_tbl[0].fl;
  73         else if (zp>fl_tbl[NUM_FL-1].zp)
  74                 return fl_tbl[NUM_FL-1].fl;
  75         else 
  76                 for (i=1; i<NUM_FL; ++i) {
  77                         if (zp==fl_tbl[i-1].zp) 
  78                                 return fl_tbl[i-1].fl;
  79                         else if (zp==fl_tbl[i].zp) 
  80                                 return fl_tbl[i].fl;
  81                         else if (zp<fl_tbl[i].zp)
  82                                 return fl_tbl[i-1].fl+(zp-fl_tbl[i-1].zp)*(fl_tbl[i].fl-fl_tbl[i-1].fl)/(fl_tbl[i].zp-fl_tbl[i-1].zp);
  83                 }
  84         return fl_tbl[NUM_FL-1].fl;
  85 }
  86 
  87 int get_zoom_x(int zp) {
  88         return get_focal_length(zp)*10/fl_tbl[0].fl;
  89 }
  90 
  91 long get_vbatt_min()
  92 {
  93         return 4700;
  94 }
  95 
  96 long get_vbatt_max()
  97 {
  98         return 5500;
  99 }
 100 

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