CHDK_DE Vorschauversion  Trunk Rev. 5547
 Alle Datenstrukturen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
main.c-Dateireferenz
#include "camera.h"
#include "lolevel.h"
#include "platform.h"
#include "core.h"
#include "keyboard.h"
#include "stdlib.h"
+ Include-Abhängigkeitsdiagramm für main.c:

gehe zum Quellcode dieser Datei

Makrodefinitionen

#define NUM_FL   9
 
#define NUM_DATA   3
 
#define CF_EFL   2800
 
#define CF_EFL_DIV   580
 

Funktionen

void boot ()
 
static void core_hook_task_create (void *tcb)
 
static void core_hook_task_delete (void *tcb)
 
void spytask (long ua, long ub, long uc, long ud, long ue, long uf)
 
static void task_start_hook (long p0, long p1, long p2, long p3, long p4, long p5, long p6, long p7, long p8, long p9)
 
static void remount_filesystem ()
 
static void init_file_modules_hook (long p0, long p1, long p2, long p3, long p4, long p5, long p6, long p7, long p8, long p9)
 
static void capt_seq_hook (long p0, long p1, long p2, long p3, long p4, long p5, long p6, long p7, long p8, long p9)
 
static void physw_hook (long p0, long p1, long p2, long p3, long p4, long p5, long p6, long p7, long p8, long p9)
 
static void movie_record_hook (long p0, long p1, long p2, long p3, long p4, long p5, long p6, long p7, long p8, long p9)
 
void task_JogDial_my ()
 
static void task_JogDial_hook (long p0, long p1, long p2, long p3, long p4, long p5, long p6, long p7, long p8, long p9)
 
static int my_ncmp (const char *s1, const char *s2, long len)
 
void createHook (void *pNewTcb)
 
void deleteHook (void *pTcb)
 
void startup ()
 
long get_vbatt_min ()
 
long get_vbatt_max ()
 
int get_effective_focal_length (int zp)
 
int get_focal_length (int zp)
 
int get_zoom_x (int zp)
 

Variablen

long link_bss_start
 
long link_bss_end
 
static int stop_hooking
 
static void(* task_prev )(long p0, long p1, long p2, long p3, long p4, long p5, long p6, long p7, long p8, long p9)
 
static void(* init_file_modules_prev )(long p0, long p1, long p2, long p3, long p4, long p5, long p6, long p7, long p8, long p9)
 
int focus_len_table [NUM_FL *NUM_DATA]
 
const int zoom_points = NUM_FL
 

Makro-Dokumentation

#define CF_EFL   2800

Definiert in Zeile 203 der Datei main.c.

#define CF_EFL_DIV   580

Definiert in Zeile 204 der Datei main.c.

#define NUM_DATA   3

Definiert in Zeile 195 der Datei main.c.

#define NUM_FL   9

Definiert in Zeile 194 der Datei main.c.

Dokumentation der Funktionen

void boot ( )

Definiert in Zeile 43 der Datei boot.c.

43  {
44 
45  long *canon_data_src = (void*)0xFFEDAC70; // value taken at ROM:FFC00188
46  long *canon_data_dst = (void*)0x1900;
47  long canon_data_len = 0xDF84 - 0x1900; // data_end - data_start 0xDF7C taken at ROM:FFC00138
48  long *canon_bss_start = (void*)0xDF84; // just after data
49  long canon_bss_len = 0xD4F38 - 0xDF84; // d4ec8 taken at ROM:FFC00FB4
50 
51  long i;
52 
53  // enable caches and write buffer...
54  // this is a carryover from old dryos ports, may not be useful
55  asm volatile (
56  "MRC p15, 0, R0,c1,c0\n"
57  "ORR R0, R0, #0x1000\n"
58  "ORR R0, R0, #4\n"
59  "ORR R0, R0, #1\n"
60  "MCR p15, 0, R0,c1,c0\n"
61  :::"r0"
62  );
63 
64  for(i=0;i<canon_data_len/4;i++)
65  canon_data_dst[i]=canon_data_src[i];
66 
67  for(i=0;i<canon_bss_len/4;i++)
68  canon_bss_start[i]=0;
69 
70  asm volatile ("B sub_FFC001A4_my\n");
71 };
static void capt_seq_hook ( long  p0,
long  p1,
long  p2,
long  p3,
long  p4,
long  p5,
long  p6,
long  p7,
long  p8,
long  p9 
)
static

Definiert in Zeile 68 der Datei main.c.

71 {
72  capt_seq_task();
73 }
static void core_hook_task_create ( void *  tcb)
static

Definiert in Zeile 13 der Datei main.c.

14 {
15 }
static void core_hook_task_delete ( void *  tcb)
static

Definiert in Zeile 17 der Datei main.c.

18 {
19  char *name = (char*)(*(long*)((char*)tcb+0x34));
20  if (strcmp(name,"tInitFileM")==0) core_spytask_can_start();
21 }
void createHook ( void *  pNewTcb)

Definiert in Zeile 109 der Datei main.c.

110 {
111  char *name = (char*)(*(long*)((char*)pNewTcb+0x34));
112  long *entry = (long*)((char*)pNewTcb+0x74);
113 
114  // always hook first task creation
115  // to create SpyProc
116  if (!stop_hooking){
117  task_prev = (void*)(*entry);
118  *entry = (long)task_start_hook;
119  stop_hooking = 1;
120  } else {
121  // hook/replace another tasks
122  if (my_ncmp(name, "tPhySw", 6) == 0){
123  *entry = (long)physw_hook;
124  }
125 
126  if (my_ncmp(name, "tInitFileM", 10) == 0){
127  init_file_modules_prev = (void*)(*entry);
128  #if CAM_MULTIPART
129  *entry = (long)init_file_modules_task;
130  #else
131  *entry = (long)init_file_modules_hook;
132  #endif
133  }
134 
135  if (my_ncmp(name, "tCaptSeqTa", 10) == 0){
136  *entry = (long)capt_seq_hook;
137  }
138 
139  if (my_ncmp(name, "tJogDial", 8) == 0){
140  *entry = (long)task_JogDial_hook;
141  }
142 
143  if (my_ncmp(name, "tMovieReco", 10) == 0){
144  #if CAM_CHDK_HAS_EXT_VIDEO_MENU
145  *entry = (long)movie_record_hook;
146  #endif
147  }
148 
149  #if CAM_EXT_TV_RANGE
150  if (my_ncmp(name, "tExpDrvTas", 10) == 0){
151  *entry = (long)exp_drv_task;
152  }
153  #endif
154 
155  core_hook_task_create(pNewTcb);
156  }
157 }
void deleteHook ( void *  pTcb)

Definiert in Zeile 159 der Datei main.c.

160 {
161  core_hook_task_delete(pTcb);
162 }
int get_effective_focal_length ( int  zp)

Definiert in Zeile 208 der Datei main.c.

208  {
210 }
int get_focal_length ( int  zp)

Definiert in Zeile 212 der Datei main.c.

212  {
213  if (zp < 0) zp = 0;
214  else if (zp >= NUM_FL) zp = NUM_FL-1;
215  return focus_len_table[zp*NUM_DATA];
216 }
long get_vbatt_max ( )

Definiert in Zeile 188 der Datei main.c.

189 {
190  return 8100;
191 }
long get_vbatt_min ( )

Definiert in Zeile 183 der Datei main.c.

184 {
185  return 6700;
186 }
int get_zoom_x ( int  zp)

Definiert in Zeile 218 der Datei main.c.

218  {
219  return get_focal_length(zp)*10/focus_len_table[0];
220 }
static void init_file_modules_hook ( long  p0,
long  p1,
long  p2,
long  p3,
long  p4,
long  p5,
long  p6,
long  p7,
long  p8,
long  p9 
)
static

Definiert in Zeile 59 der Datei main.c.

62 {
64  init_file_modules_prev(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9 );
65 }
static void movie_record_hook ( long  p0,
long  p1,
long  p2,
long  p3,
long  p4,
long  p5,
long  p6,
long  p7,
long  p8,
long  p9 
)
static

Definiert in Zeile 83 der Datei main.c.

86 {
88 }
static int my_ncmp ( const char *  s1,
const char *  s2,
long  len 
)
static

Definiert in Zeile 99 der Datei main.c.

100 {
101  int i;
102  for (i=0;i<len;i++){
103  if (s1[i] != s2[i])
104  return 1;
105  }
106  return 0;
107 }
static void physw_hook ( long  p0,
long  p1,
long  p2,
long  p3,
long  p4,
long  p5,
long  p6,
long  p7,
long  p8,
long  p9 
)
static

Definiert in Zeile 76 der Datei main.c.

79 {
80  mykbd_task();
81 }
static void remount_filesystem ( )
static

Definiert in Zeile 52 der Datei main.c.

53 {
56 }
void spytask ( long  ua,
long  ub,
long  uc,
long  ud,
long  ue,
long  uf 
)

Definiert in Zeile 36 der Datei main.c.

37 {
38  core_spytask();
39 }
void startup ( )

Definiert in Zeile 164 der Datei main.c.

165 {
166  long *bss = &link_bss_start;
167 
168  // sanity check
169  if ((long)&link_bss_end > (MEMISOSTART + MEMISOSIZE)){
170  started();
171  shutdown();
172  }
173 
174  // initialize .bss senment
175  while (bss<&link_bss_end)
176  *bss++ = 0;
177 
178  boot();
179 }
static void task_JogDial_hook ( long  p0,
long  p1,
long  p2,
long  p3,
long  p4,
long  p5,
long  p6,
long  p7,
long  p8,
long  p9 
)
static

Definiert in Zeile 92 der Datei main.c.

95 {
97 }
void task_JogDial_my ( )
static void task_start_hook ( long  p0,
long  p1,
long  p2,
long  p3,
long  p4,
long  p5,
long  p6,
long  p7,
long  p8,
long  p9 
)
static

Definiert in Zeile 42 der Datei main.c.

45 {
46  _CreateTask("SpyTask", 0x19, 0x2000, spytask, 0);
47 
48  task_prev(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9 );
49 }

Variablen-Dokumentation

int focus_len_table[NUM_FL *NUM_DATA]
void(* init_file_modules_prev)(long p0, long p1, long p2, long p3, long p4, long p5, long p6, long p7, long p8, long p9)
static

Definiert in Zeile 30 der Datei main.c.

long link_bss_end
long link_bss_start
int stop_hooking
static

Definiert in Zeile 24 der Datei main.c.

void(* task_prev)(long p0, long p1, long p2, long p3, long p4, long p5, long p6, long p7, long p8, long p9)
static

Definiert in Zeile 26 der Datei main.c.

const int zoom_points = NUM_FL

Definiert in Zeile 206 der Datei main.c.