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

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