root/platform/g1x/sub/boot_hdr.c

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

DEFINITIONS

This source file includes following definitions.
  1. taskHook
  2. CreateTask_spytask

   1 #include "lolevel.h"
   2 #include "platform.h"
   3 #include "core.h"
   4 #include "dryos31.h"
   5 
   6 #define offsetof(TYPE, MEMBER) ((int) &((TYPE *)0)->MEMBER)
   7 
   8 const char * const new_sa = &_end;
   9 
  10 // Forward declarations
  11 extern volatile int jogdial_stopped;
  12 void JogDial_task_my(void);
  13 
  14 extern void task_CaptSeq();
  15 extern void task_DvlpSeqTask();
  16 extern void task_InitFileModules();
  17 extern void task_RotaryEncoder();
  18 extern void task_MovieRecord();
  19 extern void task_ExpDrv();
  20 extern void task_FileWrite();
  21 
  22 void __attribute__((naked,noinline)) taskHook(context_t **context)
  23 { 
  24     asm volatile("STMFD   SP!, {R0-R12,LR}\n");     // G1X crashes without this
  25     
  26         task_t *tcb=(task_t*)((char*)context-offsetof(task_t, context));
  27 
  28         // Replace firmware task addresses with ours
  29         if(tcb->entry == (void*)task_CaptSeq)                   tcb->entry = (void*)capt_seq_task; 
  30     if(tcb->entry == (void*)task_DvlpSeqTask)       tcb->entry = (void*)dvlp_seq_task;
  31         if(tcb->entry == (void*)task_InitFileModules)   tcb->entry = (void*)init_file_modules_task;
  32         if(tcb->entry == (void*)task_RotaryEncoder)             tcb->entry = (void*)JogDial_task_my;
  33         if(tcb->entry == (void*)task_MovieRecord)               tcb->entry = (void*)movie_record_task;
  34         if(tcb->entry == (void*)task_ExpDrv)                    tcb->entry = (void*)exp_drv_task;
  35     if(tcb->entry == (void*)task_FileWrite)         tcb->entry = (void*)filewritetask;
  36 
  37     asm volatile("LDMFD   SP!, {R0-R12,PC}\n");     // G1X crashes without this
  38 }
  39 
  40 /*----------------------------------------------------------------------
  41         CreateTask --> core_spytask
  42 -----------------------------------------------------------------------*/
  43 void CreateTask_spytask()
  44 {
  45         _CreateTask("SpyTask", 0x19, 0x2000, core_spytask, 0);
  46 }
  47 
  48 ///*----------------------------------------------------------------------
  49 // Pointer to stack location where jogdial task records previous and current
  50 // jogdial positions
  51 short *jog_position;
  52 
  53 /*----------------------------------------------------------------------
  54         boot()
  55 
  56         Main entry point for the CHDK code
  57 -----------------------------------------------------------------------*/

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