source: trunk/platform/g9/main.c @ 576

Revision 576, 2.6 KB checked in by phyrephox, 5 years ago (diff)

+ added preliminary support for the g9 100g (and 100f) - see http://chdk.setepontos.com/index.php/topic,2342.msg24443.html#msg24443
comment: needs the other firmwares as well
todo: fix the ixus80 / compiler isse, add a590, up the version to 0.7.9 - fix more bugs, release 0.8.0 RC, get things tested and fixed - make release party for 0.8.0!

  • Property svn:eol-style set to native
Line 
1#include "lolevel.h"
2#include "platform.h"
3#include "core.h"
4#include "keyboard.h"
5
6 
7
8extern long link_bss_start;
9extern long link_bss_end;
10extern void boot();
11
12
13void startup()
14{
15    long *bss = &link_bss_start;
16    long *ptr;
17
18    // sanity check
19    if ((long)&link_bss_end > (MEMISOSTART + MEMISOSIZE)){
20        started();
21        shutdown();
22    }
23
24    // initialize .bss senment
25    while (bss<&link_bss_end)
26        *bss++ = 0;
27
28    boot();
29}
30
31static struct {
32        int hackmode;
33        int canonmode;
34} modemap[] = {
35    { MODE_AUTO,               32768 },
36    { MODE_P,                  32772 },
37    { MODE_TV,                 32771 },
38    { MODE_AV,                 32770 },
39    { MODE_M,                  32769 },
40    { MODE_VIDEO_STD,          2597  },
41    { MODE_VIDEO_HIRES,        2600  },
42    { MODE_VIDEO_COMPACT,      2599  },
43    { MODE_VIDEO_COLOR_SWAP,   2596  },
44    { MODE_VIDEO_COLOR_ACCENT, 2595  },
45    { MODE_VIDEO_TIME_LAPSE,   2601  },
46    { MODE_STITCH,             33290 },
47    { MODE_PORTRAIT,               16397 },     
48    { MODE_SCN_NIGHT,          16398 },
49    { MODE_NIGHT_SNAPSHOT,     16395 },
50    { MODE_SCN_INDOOR,         16401 },
51    { MODE_SCN_SNOW,           16403 },
52    { MODE_SCN_FIREWORK,       16405 },
53    { MODE_SCN_WATER,          16406 },
54    { MODE_SCN_COLOR_ACCENT,   16922 },
55    { MODE_SCN_SPORT,          16903 },
56    { MODE_SCN_KIDS_PETS,      16400 },
57    { MODE_SCN_FOLIAGE,        16402 },
58    { MODE_SCN_BEACH,          16404 },
59    { MODE_SCN_AQUARIUM,       16407 },
60    { MODE_SCN_ISO_3200,       16412 },
61    { MODE_SCN_COLOR_SWAP,         16923 },
62    { MODE_LANDSCAPE,          16396 }
63
64};
65
66#define MODESCNT (sizeof(modemap)/sizeof(modemap[0]))
67
68
69static const int fl_tbl[] = {7400, 8210, 9040, 9860, 10670, 12730, 14780, 16820, 18890, 21970, 25030, 29170, 36780, 44400};
70#define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0]))
71#define CF_EFL 47297
72
73const int zoom_points = NUM_FL;
74
75int get_effective_focal_length(int zp) {
76    return (CF_EFL*get_focal_length(zp))/10000;
77}
78
79int get_focal_length(int zp) {
80    if (zp<0) return fl_tbl[0];
81    else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1];
82    else return fl_tbl[zp];
83}
84
85int get_zoom_x(int zp) {
86    if (zp<1) return 10;
87    else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]*10/fl_tbl[0];
88    else return fl_tbl[zp]*10/fl_tbl[0];
89}
90
91
92int mode_get() {
93    int mode, i, t=0xFF;
94
95    mode  = (playrec_mode==2)?MODE_REC:MODE_PLAY;               
96       
97    _GetPropertyCase(PROPCASE_SHOOTING_MODE, &t, 4);
98    for (i=0; i<MODESCNT; ++i) {
99        if (modemap[i].canonmode == t) {
100            return (mode | (modemap[i].hackmode & MODE_SHOOTING_MASK));
101        }
102    }
103    return (mode);
104}
105
106long get_vbatt_min()
107{
108    return 7000;
109}
110
111long get_vbatt_max()
112{
113    return 8300;
114}
115
116
Note: See TracBrowser for help on using the repository browser.