root/include/lolevel.h

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

INCLUDED FROM


   1 #ifndef LOLEVEL_H
   2 #define LOLEVEL_H
   3 
   4 #ifndef LOW_LEVEL
   5 #error File can be included when platform is built only!
   6 #endif
   7 
   8 #ifndef __arm__
   9 #error File can be included in ARM mode only!
  10 #endif
  11 
  12 /* Canon stuff */
  13 extern long *_GetSystemTime(long *t);
  14 extern long _GetZoomLensCurrentPosition();
  15 extern long _GetZoomLensCurrentPoint();
  16 extern long _MoveZoomLensWithPoint(short *pos);
  17 extern long _SetZoomActuatorSpeedPercent(short *perc);
  18 extern volatile long zoom_busy;
  19 extern long _GetFocusLensCurrentPosition();
  20 extern long _GetFocusLensSubjectDistance();
  21 extern long _GetFocusLensSubjectDistanceFromLens();
  22 extern void _MoveFocusLensToDistance(short *dist);
  23 #ifdef CAM_AV_OVERRIDE_IRIS_FIX
  24 extern int _MoveIrisWithAv(short*);
  25 #endif
  26 extern void _PutInNdFilter();
  27 extern void _PutOutNdFilter();
  28 extern short _get_nd_value(void);
  29 extern short _get_current_nd_value(void);
  30 extern volatile long focus_busy;
  31 extern long _GetCurrentShutterSpeed();
  32 extern long _GetCurrentAvValue();
  33 extern short _GetUsableMinAv(void);
  34 extern short _GetUsableMaxAv(void);
  35 extern long _GetCurrentTargetDistance();
  36 extern long _GetPropertyCase(long opt_id, void *buf, long bufsize);
  37 extern long _SetPropertyCase(long opt_id, void *buf, long bufsize);
  38 extern short _PTM_GetCurrentItem(long id);
  39 extern long _IsStrobeChargeCompleted();
  40 extern long _VbattGet();
  41 extern int _GetBatteryTemperature();
  42 extern int _GetCCDTemperature();
  43 extern int _GetOpticalTemperature();
  44 #ifdef CAM_DRYOS
  45 extern int _GetAdChValue(int) ;
  46 #else
  47 extern int _GetAdChValue(int*) ;
  48 #endif
  49 extern void _PT_PlaySound(short , void*);
  50 extern void _RefreshPhysicalScreen(long f);
  51 extern void _Unmount_FileSystem();
  52 extern void _Mount_FileSystem();
  53 extern void _SleepTask(long msec);
  54 extern int _CreateTask (const char *name, int prio, int stack_size /*?*/,
  55                         void *entry, long parm /*?*/);
  56 extern void _SleepTask(long msec);
  57 extern void __attribute__((noreturn)) _ExitTask();
  58 extern int _taskNameToId(char* taskName); // VxWorks only, task's name first letter must be 't', maximum 10 chars total 
  59 extern const char *_taskName(int taskID); // VxWorks only for now
  60 extern int _taskIdListGet(int *idlist,int max); // VxWorks only for now
  61 extern void _taskSuspend(int taskId);
  62 extern void _taskResume(int taskId);
  63 extern int _errnoOfTaskGet(int tid);
  64 
  65 extern long _SetEventFlag(void *flag, long what);
  66 extern long _CheckAnyEventFlag(void *flag, long mask, long *res);
  67 extern long _GetEventFlagValue(void *flag, long *res);
  68 
  69 extern long _ReceiveMessageQueue(void *msgq, long *dst, long unk1 /* maybe size? */);
  70 
  71 /* Canon stuff with nonoriginal naming */
  72 extern long _GetParameterData(long id, void *buf, long size);
  73 extern long _SetParameterData(long id, void *buf, long size);
  74 #ifdef  CAM_DRYOS_2_3_R47
  75 extern void _MakeSDCardBootable(int driveno);
  76 #else
  77 extern void _UpdateMBROnFlash(int driveno, long offset, char *str);
  78 #endif
  79 
  80 /* standart C library */
  81 //extern int _creat (const char *name, int flags);
  82 extern int _open (const char *name, int flags, int mode );
  83 extern int _close (int fd);
  84 //extern int _write (int fd, const void *buffer, long nbytes);
  85 //extern int _read (int fd, void *buffer, long nbytes);
  86 extern int _lseek (int fd, long offset, int whence);
  87 extern long _mkdir(const char *dirname);
  88 
  89 extern int _Open (const char *name, int flags, int mode );
  90 extern int _Close (int fd);
  91 extern int _Write (int fd, const void *buffer, long nbytes);
  92 extern int _Read (int fd, void *buffer, long nbytes);
  93 extern int _Lseek (int fd, long offset, int whence);
  94 extern int _Remove(const char *name);
  95 
  96 extern long _Fopen_Fut(const char *filename, const char *mode);
  97 extern long _Fclose_Fut(long file);
  98 extern long _Fread_Fut(void *buf, long elsize, long count, long f);
  99 extern long _Fwrite_Fut(const void *buf, long elsize, long count, long f);
 100 extern long _Fseek_Fut(long file, long offset, long whence);
 101 extern long _Fflush_Fut(long file);
 102 extern long _Feof_Fut(long file);
 103 extern long _Fflush_Fut(long file);
 104 extern char *_Fgets_Fut(char *buf, int n, long f);
 105 extern long _RenameFile_Fut(const char *oldname, const char *newname);
 106 extern long _DeleteFile_Fut(const char *name);
 107 extern long _MakeDirectory_Fut(const char *name,int unk);
 108 extern long _DeleteDirectory_Fut(const char *name);
 109 
 110 extern int _isdigit(int c);
 111 extern int _isspace(int c);
 112 extern int _isalpha(int c);
 113 extern int _isupper(int c);
 114 extern int _islower(int c);
 115 extern int _ispunct(int c);
 116 extern int _isxdigit(int c);
 117 
 118 extern long _strlen(const char *s);
 119 extern int _strcmp(const char *s1, const char *s2);
 120 extern int _strncmp(const char *s1, const char *s2, long n);
 121 extern char *_strchr(const char *s, int c);
 122 extern char *_strcpy(char *dest, const char *src);
 123 extern char *_strncpy(char *dest, const char *src, long n);
 124 extern char *_strcat(char *dest, const char *app);
 125 extern char *_strrchr(const char *s, int c);
 126 extern char *_strpbrk(const char *s, const char *accept);
 127 
 128 extern long _strtol(const char *nptr, char **endptr, int base);
 129 extern unsigned long _strtoul(const char *nptr, char **endptr, int base);
 130 // DRYOS: this function is called by strtol (mode=1) and strtoul (mode=0)
 131 // easier to match with sig finder
 132 extern long _strtolx(const char *nptr, char **endptr, int base, int mode);
 133 
 134 extern int _tolower(int c);
 135 extern int _toupper(int c);
 136 
 137 extern int _vsprintf(char *buf, const char *fmt, __builtin_va_list va_list);
 138 
 139 /**
 140  * No STUBS!
 141  * You can't use these two directly from THUMB code (core), only from platform.
 142  */
 143 //extern int fprintf(FILE *fd, char*buf, ...);
 144 extern int _printf(char *buf, ...);
 145 
 146 extern void *_malloc(long size);
 147 extern void _free(void *p);
 148 extern void *_AllocateUncacheableMemory(long size);
 149 extern void _FreeUncacheableMemory(void *p);
 150 
 151 extern void *_memchr(const void *s, int c, int n);
 152 extern void *_memcpy(void *dest, const void *src, long n);
 153 extern void *_memset(void *s, int c, int n);
 154 extern int _memcmp(const void *s1, const void *s2, long n);
 155 
 156 extern void _qsort (void *__base, int __nelem, int __size, int (*__cmp)(const void *__e1, const void *__e2));
 157 
 158 /* VxWorks */
 159 extern long _taskLock();
 160 extern long _taskUnlock();
 161 extern int _taskCreateHookAdd (void *createHook);
 162 extern int _taskDeleteHookAdd (void *deleteHook);
 163 extern long _iosDevAdd(void*,void*,int);
 164 extern long _iosDevDelete(void*);
 165 extern long _iosDrvInstall(void*,void*,void*,void*,void*,void*,void*);
 166 extern int _TakeSemaphore(int sem, int timeout);
 167 extern void _GiveSemaphore(int sem);
 168 
 169 /* misc */
 170 extern const char aPhysw;
 171 extern long physw_run;
 172 extern long physw_sleep_delay;
 173 extern long _kbd_p1_f();
 174 extern void _kbd_p2_f();
 175 extern void _kbd_pwr_on();
 176 extern void _kbd_pwr_off();
 177 extern void _kbd_read_keys_r2(void*p);
 178 extern long physw_status[3], physw_copy[3];
 179 
 180 extern void __attribute__((naked,noinline)) mykbd_task();
 181 extern void capt_seq_task();
 182 extern void dvlp_seq_task();
 183 extern void movie_record_task();
 184 extern void init_file_modules_task();
 185 extern void exp_drv_task();
 186 extern void filewritetask();
 187 
 188 void kbd_fetch_data(long *dst);
 189 
 190 /*used to detect play or record mode without relying on physical switch positions
 191  values on most cameras:
 192   0 = startup in play
 193   1 = unknown, appears to happen in first play<->rec transition
 194   2 = record mode
 195   4 = canon menu in record mode
 196   3 = play after being in record mode at least once
 197   5 = transitioning between some record modes, such as movie
 198  values on very old vxworks cameras (ixus50_sd400, ixus700_sd500, s2is)
 199   0 = startup in play
 200   1 = rec
 201   2 = play
 202   3 = maybe transition ?
 203  address in all cases can be found with strings "MenuIn", "MenuOut"
 204 */
 205 extern long playrec_mode;
 206 
 207 extern void *led_table;
 208 extern void _UniqueLedOn(void *addr, long brightness);
 209 extern void _UniqueLedOff(void *addr);
 210 struct led_control {int led_num; int action; int brightness; int blink_count;};
 211 extern int _PostLEDMessage(struct led_control *);
 212 extern int _LEDDrive(int led, int action);
 213 
 214 
 215 extern long _LockMainPower();
 216 extern long _UnlockMainPower();
 217 extern void _SetAutoShutdownTime(int t);
 218 
 219 /*
 220 The following two functions post an event such as button press, switch change, cable connection change.
 221 event:
 222   A number identifying the event. This number may vary between camera models. 
 223   See levent.c and levent.h for methods to identify events by name.
 224 unk: 
 225   Unknown value, usually 0 in canon code. For jogdial messages, this is number of clicks.
 226 return value:
 227   Unknown, possibly void.
 228 */
 229 extern int  _PostLogicalEventForNotPowerType(int event, int unk);
 230 extern int  _PostLogicalEventToUI(int event, int unk);
 231 /*
 232 Used in the canon code to modify the generation or delivery of events. For example, Canon 
 233 mode override code sets 1 on the desired dial position, and zero on all others.
 234 event: as described above for PostLogicalEvent*
 235 state: if 1, the event will be generated/delivered as normal. If 0, the event is disabled/blocked.
 236 */
 237 extern void _SetLogicalEventActive(unsigned event, unsigned state);
 238 /* Somehow related to the above. Normally 0, set to 1 for script mode */
 239 extern void _SetScriptMode(unsigned mode);
 240 
 241 
 242 /* math */
 243 extern int _rand(void);
 244 extern void* _srand(unsigned int seed);
 245 
 246 extern double __log(double x);
 247 extern double __log10(double x);
 248 extern double __pow(double x, double y);
 249 extern double __sqrt(double x);
 250 
 251 /* time */
 252 extern int _utime(const char *file, void *newTimes);
 253 extern unsigned long _time(/*time_t*/ unsigned long *timer);
 254 extern void *_localtime(const /*time_t*/ unsigned long *_tod);
 255 extern void *_LocalTime(const /*time_t*/ unsigned long *_tod, void * t_m); // DRYOS
 256 extern long _strftime(char *s, unsigned long maxsize, const char *format, const /*struct tm*/ void *timp);
 257 extern /*time_t*/ long _mktime(/*struct tm*/ void *timp); // VXWORKS
 258 extern /*time_t*/ long _mktime_ext(void *tim_extp); // DRYOS, doesn't take a struct tm *
 259 
 260 #ifdef CAM_DRYOS_2_3_R39
 261 extern int _SetFileTimeStamp(const char *file_path, int time1, int time2);
 262 extern int _SetFileAttributes(const char *fn, int attr);
 263 #else
 264 extern int _SetFileTimeStamp(int fd, int time1, int time2);
 265 extern void _SetFileAttributes(int fd, int attr);
 266 #endif
 267 
 268 /* file */
 269 extern int   _stat(const char *name, void *pStat);
 270 extern unsigned long _GetDrive_ClusterSize(int drive);
 271 extern unsigned long _GetDrive_TotalClusters(int drive);
 272 extern unsigned long _GetDrive_FreeClusters(int drive);
 273 extern int _WriteSDCard(unsigned int drive, unsigned int start_sect, unsigned int num_sect, void *buf);
 274 
 275 extern void _UnsetZoomForMovie(void);
 276 extern void _TurnOffMic(void);
 277 extern void _TurnOnMic(void);
 278 
 279 extern void _MakeAFScan(int*, int);
 280 extern void _ExpCtrlTool_StartContiAE(int, int);
 281 extern void _ExpCtrlTool_StopContiAE(int, int);
 282 
 283 extern int some_flag_for_af_scan;
 284 extern int parameter_for_af_scan;
 285 extern short _SetAE_ShutterSpeed(short* tv);
 286 
 287 extern void _EnterToCompensationEVF(void);
 288 extern void _ExitFromCompensationEVF(void);
 289 
 290 extern void _TurnOnBackLight(void);
 291 extern void _TurnOffBackLight(void);
 292 extern void _TurnOnDisplay(void);
 293 extern void _TurnOffDisplay(void);
 294 
 295 extern void _DoAELock(void);
 296 extern void _UnlockAE(void);
 297 extern void _DoAFLock(void);
 298 extern void _UnlockAF(void);
 299 extern void _MFOn(void);
 300 extern void _MFOff(void);
 301 extern void _PT_MFOn(void);
 302 extern void _PT_MFOff(void);
 303 extern void _SS_MFOn(void);
 304 extern void _SS_MFOff(void);
 305 
 306 extern int _EngDrvRead(int gpio_reg);
 307 
 308 extern int _apex2us(int);
 309 
 310 extern void _ScreenLock();
 311 extern void _SetCurrentCaptureModeType();
 312 extern unsigned _ExecuteEventProcedure(const char *name, ...);
 313 // known in CHDK as _RefreshPhysicalScreen
 314 //extern void _ScreenUnLock();
 315 
 316 // 7 calls functions and sets some MMIOs, but doesn't disable caches and actually restart
 317 // 3 skips one function call on some cameras, but does restart
 318 extern void _Restart(unsigned option);
 319 
 320 // boot an fir/fi2 file
 321 extern void _reboot_fw_update(const char* bootfile);
 322 
 323 // PTP
 324 extern int _add_ptp_handler(int, void*, int);
 325 extern void _set_control_event(int);
 326 extern void _PB2Rec();
 327 extern void _Rec2PB();
 328 
 329 #ifdef OPT_EXMEM_MALLOC
 330 // dryos + some vxworks only takes 3 params in reality
 331 // on some vxworks the function that is easy to match with sig finder takes an additional param,
 332 // set to zero in the real AllocateExMem
 333 // versions that don't expect a 4th param will just ignore it
 334 extern void *_exmem_alloc(int pool_id,int size,int unk,int unk2); 
 335 #endif
 336 
 337 // vxworks only
 338 // used on a few cameras that don't have memPartInfoGet, see CAM_NO_MEMPARTINFO
 339 extern int _memPartFindMax(int mempart_id); 
 340 extern int _memPartInfoGet(int mempart_id,int *info);
 341 
 342 #ifdef CAM_HAS_GPS
 343 extern void _GPS_UpdateData();
 344 #endif
 345 
 346 #endif

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