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

gehe zum Quellcode dieser Datei

Makrodefinitionen

#define PARAM_FILE_COUNTER   0x2A
 
#define LED_PR   0xc0220088
 
#define LED_BRIGHTNESS   200
 
#define LED_GREEN   4
 
#define LED_YELLOW   5
 
#define LED_ORANGE   7
 
#define LED_BLUE   8
 
#define LED_AF_BEAM   9
 
#define LED_TIMER   10
 

Funktionen

void _sub_FF821D04 (long mem, long *data)
 
long _GetPropertyCase_orig (long opt_id, void *buf, long bufsize)
 
long _SetPropertyCase_orig (long opt_id, void *buf, long bufsize)
 
void _SetAFBeamBrightness (long val)
 
void _SetAFBeamOff ()
 
unsigned long _time_orig (unsigned long *timer)
 
unsigned long _time (unsigned long *timer)
 
void set_shooting_status (long l)
 
long _GetPropertyCase (long cse, void *ptr, long len)
 
long _SetPropertyCase (long cse, void *ptr, long len)
 
void shutdown ()
 
void dummy_nop ()
 
static void led_on (const int led, const int brightness)
 
static void led_off (const int led)
 
void debug_led (int state)
 
int get_flash_params_count (void)
 
void set_led (int led, int state)
 
void camera_set_led (int led, int state, int bright)
 
short get_uiprop_value (unsigned long id)
 

Variablen

static unsigned long bootuptime = 0
 
volatile long shooting_status_ =0
 

Makro-Dokumentation

#define LED_AF_BEAM   9

Definiert in Zeile 153 der Datei lib.c.

#define LED_BLUE   8

Definiert in Zeile 152 der Datei lib.c.

#define LED_BRIGHTNESS   200

Definiert in Zeile 148 der Datei lib.c.

#define LED_GREEN   4

Definiert in Zeile 149 der Datei lib.c.

#define LED_ORANGE   7

Definiert in Zeile 151 der Datei lib.c.

#define LED_PR   0xc0220088

Definiert in Zeile 147 der Datei lib.c.

#define LED_TIMER   10

Definiert in Zeile 154 der Datei lib.c.

#define LED_YELLOW   5

Definiert in Zeile 150 der Datei lib.c.

#define PARAM_FILE_COUNTER   0x2A

Definiert in Zeile 3 der Datei lib.c.

Dokumentation der Funktionen

long _GetPropertyCase ( long  cse,
void *  ptr,
long  len 
)

Definiert in Zeile 91 der Datei lib.c.

91  {
92  if (cse == PROPCASE_SHOOTING){
93  if (len==sizeof(long)){
94  *(long*)ptr = shooting_status_;
95  }else if (len==sizeof(short)){
96  *(short*)ptr = shooting_status_;
97  }else{
98  //??? FIXME
99  }
100  }else{
101  return _GetPropertyCase_orig(cse, ptr, len);
102  }
103  return 0;
104 }
long _GetPropertyCase_orig ( long  opt_id,
void *  buf,
long  bufsize 
)
void _SetAFBeamBrightness ( long  val)
void _SetAFBeamOff ( )
long _SetPropertyCase ( long  cse,
void *  ptr,
long  len 
)

Definiert in Zeile 106 der Datei lib.c.

106  {
107  if (cse == PROPCASE_SHOOTING){
108  //do nothing
109  return 0;
110  }else{
111  return _SetPropertyCase_orig(cse, ptr, len);
112  }
113 }
long _SetPropertyCase_orig ( long  opt_id,
void *  buf,
long  bufsize 
)
void _sub_FF821D04 ( long  mem,
long *  data 
)
unsigned long _time ( unsigned long *  timer)

Definiert in Zeile 14 der Datei lib.c.

14  {
15 /*
16 the original "time" function doesn't seem to work correctly
17 chdk's clock display runs at around 1/7 speed with it (the display is only correct right after bootup)
18 this hack provides a replacement using GetSystemTime (which incements every 1ms, I guess),
19 but it will be off by a few seconds.
20 There might be a fault in this chdk port somewhere...
21 */
22 unsigned long timer2; //unsigned long *timer will be NULL when called from chdk
23  _GetSystemTime((long*)&timer2);
24  if (bootuptime == 0) {
25  bootuptime = _time_orig((unsigned long*)0)-(timer2)/1000;
26  }
27  return bootuptime+(timer2)/1000;
28 }
unsigned long _time_orig ( unsigned long *  timer)
void camera_set_led ( int  led,
int  state,
int  bright 
)

Definiert in Zeile 245 der Datei lib.c.

246 {
247  if (state) {
248  if (bright > LED_BRIGHTNESS) bright = LED_BRIGHTNESS;
249  if (led == 6) {
250  led_on(4, bright);
251  led_on(5, bright);
252  } else
253  led_on(led, bright);
254  }
255  else
256  if (led == 6) {
257  led_off(4);
258  led_off(5);
259  } else
260  led_off(led);
261 }
void debug_led ( int  state)

Definiert in Zeile 226 der Datei lib.c.

227 {
228  if (state)
230  else
231  led_off(LED_BLUE);
232 }
void dummy_nop ( )

Definiert in Zeile 143 der Datei lib.c.

143  {
144 }
int get_flash_params_count ( void  )

Definiert in Zeile 234 der Datei lib.c.

234  {
235  return 70;
236 }
short get_uiprop_value ( unsigned long  id)

Definiert in Zeile 263 der Datei lib.c.

264 {
265  // avoid asserts: return 0 if id is above limit
266  if (id >= uiprop_count)
267  return 0;
268  return _PTM_GetCurrentItem(id);
269 }
static void led_off ( const int  led)
static

Definiert in Zeile 204 der Datei lib.c.

205 {
206  if (led < 4 || led > 10 || led == 6) return;
207 
208  volatile long *p;
209  switch(led){
210  case (LED_GREEN) : p=(void*)0xc02200D8; break;
211  case (LED_ORANGE): p=(void*)0xc02200DC; break;
212  case (LED_YELLOW): p=(void*)0xc02200E0; break;
213  case (LED_BLUE) : p=(void*)0xc02200E4; break;
214  case (LED_AF_BEAM): p=(void*)0xc02200EC; break;
215  default: return;
216  }
217 
218  if (led == LED_AF_BEAM){
219  _SetAFBeamOff();
220  }else{
221  *p=0x44;
222  }
223 
224 }
static void led_on ( const int  led,
const int  brightness 
)
static

Definiert in Zeile 171 der Datei lib.c.

172 {
173  if (led < 4 || led > 10 || led == 6) return;
174  //on sd400 the led stuff works like this:
175  //led_addr = led_table + (led * 0x40)
176  //
177  //if (mem(led_addr) == 0){
178  // mem(led_addr + 4) = 0x46; //=ON
179  //}else if (mem(led_addr) == 1){
180  // af_led_sub(led_addr)
181  //}
182  //
183  //ok on sd300 something like ledUniqueOn doesnt seem
184  //to exist. so build our own lib:
185 
186  volatile long *p;
187  switch(led){
188  case (LED_GREEN) : p=(void*)0xc02200D8; break;
189  case (LED_ORANGE): p=(void*)0xc02200DC; break;
190  case (LED_YELLOW): p=(void*)0xc02200E0; break;
191  case (LED_BLUE) : p=(void*)0xc02200E4; break;
192  case (LED_AF_BEAM): p=(void*)0xc02200EC; break;
193  default: return;
194  }
195 
196  if (led == LED_AF_BEAM){
198  }else{
199  *p=0x46;
200  }
201 }
void set_led ( int  led,
int  state 
)

Definiert in Zeile 238 der Datei lib.c.

239 {
240  if (state)
241  led_on(led, LED_BRIGHTNESS);
242  else
243  led_off(led);
244 }
void set_shooting_status ( long  l)

Definiert in Zeile 44 der Datei lib.c.

44  {
45 // if (shbufi<100){
46 // if (shbuf[shbufi] != l){
47 // shbufi++;
48 // shbuf[shbufi] = l;
49 // }
50 // }
51 
52  //shooting_status_=l;
53  //return;
54  switch(l){
55  case(0x0):
56  //picture mode: focussing
58  break;
59  case(0x1):
60  //picture mode: charge flash & do snapshot
62  break;
63  case(0x2):
64  //picture mode: maybe stitch assist related
66  break;
67  case(0x3):
68  //picture mode: idle
70  break;
71  case(0x6):
72  //video mode: focus & rec
74  break;
75  case(0x7):
76  //video mode: idle
78  break;
79  case (0xb):
80  //idle in play mode ?!
82  break;
83 
84  default:
86  break;
87  }
88 }
void shutdown ( )

Definiert in Zeile 115 der Datei lib.c.

116 {
117  volatile long *p = (void*)0xc022002c;
118 
119  asm(
120  "MRS R1, CPSR\n"
121  "AND R0, R1, #0x80\n"
122  "ORR R1, R1, #0x80\n"
123  "MSR CPSR_cf, R1\n"
124  :::"r1","r0");
125 
126  *p = 0x46;
127 
128  while(1);
129 }

Variablen-Dokumentation

unsigned long bootuptime = 0
static

Definiert in Zeile 12 der Datei lib.c.

volatile long shooting_status_ =0

Definiert in Zeile 39 der Datei lib.c.