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 
 171 /* misc */
 172 extern const char aPhysw;
 173 extern long physw_run;
 174 extern long physw_sleep_delay;
 175 extern long _kbd_p1_f();
 176 extern void _kbd_p2_f();
 177 extern void _kbd_pwr_on();
 178 extern void _kbd_pwr_off();
 179 extern void _kbd_read_keys_r2(void*p);
 180 extern long physw_status[3], physw_copy[3];
 181 
 182 extern void __attribute__((naked,noinline)) mykbd_task();
 183 extern void capt_seq_task();
 184 extern void dvlp_seq_task();
 185 extern void movie_record_task();
 186 extern void init_file_modules_task();
 187 extern void exp_drv_task();
 188 extern void filewritetask();
 189 
 190 void kbd_fetch_data(long *dst);
 191 
 192 /*used to detect play or record mode without relying on physical switch positions
 193  values on most cameras:
 194   0 = startup in play
 195   1 = unknown, appears to happen in first play<->rec transition
 196   2 = record mode
 197   4 = canon menu in record mode
 198   3 = play after being in record mode at least once
 199   5 = transitioning between some record modes, such as movie
 200  values on very old vxworks cameras (ixus50_sd400, ixus700_sd500, s2is)
 201   0 = startup in play
 202   1 = rec
 203   2 = play
 204   3 = maybe transition ?
 205  address in all cases can be found with strings "MenuIn", "MenuOut"
 206 */
 207 extern long playrec_mode;
 208 
 209 extern void *led_table;
 210 extern void _UniqueLedOn(void *addr, long brightness);
 211 extern void _UniqueLedOff(void *addr);
 212 struct led_control {int led_num; int action; int brightness; int blink_count;};
 213 extern int _PostLEDMessage(struct led_control *);
 214 extern int _LEDDrive(int led, int action);
 215 
 216 
 217 extern long _LockMainPower();
 218 extern long _UnlockMainPower();
 219 extern void _SetAutoShutdownTime(int t);
 220 
 221 /*
 222 The following two functions post an event such as button press, switch change, cable connection change.
 223 event:
 224   A number identifying the event. This number may vary between camera models. 
 225   See levent.c and levent.h for methods to identify events by name.
 226 unk: 
 227   Unknown value, usually 0 in canon code. For jogdial messages, this is number of clicks.
 228 return value:
 229   Unknown, possibly void.
 230 */
 231 extern int  _PostLogicalEventForNotPowerType(int event, int unk);
 232 extern int  _PostLogicalEventToUI(int event, int unk);
 233 /*
 234 Used in the canon code to modify the generation or delivery of events. For example, Canon 
 235 mode override code sets 1 on the desired dial position, and zero on all others.
 236 event: as described above for PostLogicalEvent*
 237 state: if 1, the event will be generated/delivered as normal. If 0, the event is disabled/blocked.
 238 */
 239 extern void _SetLogicalEventActive(unsigned event, unsigned state);
 240 /* Somehow related to the above. Normally 0, set to 1 for script mode */
 241 extern void _SetScriptMode(unsigned mode);
 242 
 243 
 244 /* math */
 245 extern int _rand(void);
 246 extern void* _srand(unsigned int seed);
 247 
 248 extern double __log(double x);
 249 extern double __log10(double x);
 250 extern double __pow(double x, double y);
 251 extern double __sqrt(double x);
 252 
 253 /* time */
 254 extern int _utime(const char *file, void *newTimes);
 255 extern unsigned long _time(/*time_t*/ unsigned long *timer);
 256 extern void *_localtime(const /*time_t*/ unsigned long *_tod);
 257 extern void *_LocalTime(const /*time_t*/ unsigned long *_tod, void * t_m); // DRYOS
 258 extern long _strftime(char *s, unsigned long maxsize, const char *format, const /*struct tm*/ void *timp);
 259 extern /*time_t*/ long _mktime(/*struct tm*/ void *timp); // VXWORKS
 260 extern /*time_t*/ long _mktime_ext(void *tim_extp); // DRYOS, doesn't take a struct tm *
 261 extern int _SetDate(void *setdate_p); // expects ptr to year, month, day, hour, min, sec, not compatible with tm
 262                                       // appears to return non-DST adjusted time
 263 
 264 #ifdef CAM_DRYOS_2_3_R39
 265 extern int _SetFileTimeStamp(const char *file_path, int time1, int time2);
 266 extern int _SetFileAttributes(const char *fn, int attr);
 267 #else
 268 extern int _SetFileTimeStamp(int fd, int time1, int time2);
 269 extern void _SetFileAttributes(int fd, int attr);
 270 #endif
 271 
 272 /* file */
 273 extern int   _stat(const char *name, void *pStat);
 274 extern unsigned long _GetDrive_ClusterSize(int drive);
 275 extern unsigned long _GetDrive_TotalClusters(int drive);
 276 extern unsigned long _GetDrive_FreeClusters(int drive);
 277 extern int _WriteSDCard(unsigned int drive, unsigned int start_sect, unsigned int num_sect, void *buf);
 278 
 279 extern void _UnsetZoomForMovie(void);
 280 extern void _TurnOffMic(void);
 281 extern void _TurnOnMic(void);
 282 
 283 extern void _MakeAFScan(int*, int);
 284 extern void _ExpCtrlTool_StartContiAE(int, int);
 285 extern void _ExpCtrlTool_StopContiAE(int, int);
 286 
 287 extern int some_flag_for_af_scan;
 288 extern int parameter_for_af_scan;
 289 extern short _SetAE_ShutterSpeed(short* tv);
 290 
 291 extern void _EnterToCompensationEVF(void);
 292 extern void _ExitFromCompensationEVF(void);
 293 
 294 extern void _TurnOnBackLight(void);
 295 extern void _TurnOffBackLight(void);
 296 extern void _TurnOnDisplay(void);
 297 extern void _TurnOffDisplay(void);
 298 
 299 extern void _DoAELock(void);
 300 extern void _UnlockAE(void);
 301 extern void _DoAFLock(void);
 302 extern void _UnlockAF(void);
 303 extern void _MFOn(void);
 304 extern void _MFOff(void);
 305 extern void _PT_MFOn(void);
 306 extern void _PT_MFOff(void);
 307 extern void _SS_MFOn(void);
 308 extern void _SS_MFOff(void);
 309 
 310 extern int _EngDrvRead(int gpio_reg);
 311 
 312 extern int _apex2us(int);
 313 
 314 extern void _ScreenLock();
 315 extern void _SetCurrentCaptureModeType();
 316 extern unsigned _ExecuteEventProcedure(const char *name, ...);
 317 // known in CHDK as _RefreshPhysicalScreen
 318 //extern void _ScreenUnLock();
 319 
 320 // 7 calls functions and sets some MMIOs, but doesn't disable caches and actually restart
 321 // 3 skips one function call on some cameras, but does restart
 322 extern void _Restart(unsigned option);
 323 
 324 // boot an fir/fi2 file
 325 extern void _reboot_fw_update(const char* bootfile);
 326 
 327 // PTP
 328 extern int _add_ptp_handler(int, void*, int);
 329 extern void _set_control_event(int);
 330 extern void _PB2Rec();
 331 /* DryOS 54 and later Rec2PB appears expects argument, levent or -1 for none. String ref "AC:Rec2PB x Repost" */
 332 extern void _Rec2PB(int event); 
 333 extern int _get_ptp_buf_size(int slot);
 334 extern char *_get_ptp_file_buf(void);
 335 
 336 #ifdef OPT_EXMEM_MALLOC
 337 // dryos + some vxworks only takes 3 params in reality
 338 // on some vxworks the function that is easy to match with sig finder takes an additional param,
 339 // set to zero in the real AllocateExMem
 340 // versions that don't expect a 4th param will just ignore it
 341 extern void *_exmem_alloc(unsigned int pool_id,unsigned int size,int unk,int unk2); 
 342 #endif
 343 
 344 // exmem
 345 extern void *_exmem_ualloc(unsigned int type, unsigned int size, void *allocinf); 
 346 extern void _exmem_ufree(unsigned int type); 
 347 
 348 // vxworks only
 349 // used on a few cameras that don't have memPartInfoGet, see CAM_NO_MEMPARTINFO
 350 extern int _memPartFindMax(int mempart_id); 
 351 extern int _memPartInfoGet(int mempart_id,int *info);
 352 
 353 #ifdef CAM_HAS_GPS
 354 extern void _GPS_UpdateData();
 355 #endif
 356 
 357 #endif

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