root/platform/a540/sub/100b/filewrite.c

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

DEFINITIONS

This source file includes following definitions.
  1. filewritetask
  2. sub_FFC564A4_my
  3. sub_FFC56350_my

   1 #include "lolevel.h"
   2 #include "platform.h"
   3 
   4 typedef struct {
   5     unsigned int address;
   6     unsigned int length;
   7 } cam_ptp_data_chunk; //camera specific structure
   8 
   9 #define MAX_CHUNKS_FOR_JPEG 3 //model specific
  10 /*
  11  * fwt_data_struct: defined here as it's camera dependent
  12  * unneeded members are designated with unkn
  13  * file_offset, full_size, seek_flag only needs to be defined for DryOS>=r50 generation cameras
  14  * pdc is always required
  15  * name is not currently used
  16  */
  17 typedef struct
  18 {
  19     int unkn1;
  20     cam_ptp_data_chunk pdc[MAX_CHUNKS_FOR_JPEG];
  21     char name[32];
  22 } fwt_data_struct;
  23 
  24 #include "../../../generic/filewrite.c"
  25 
  26 void __attribute__((naked,noinline)) filewritetask(  ) { //0xFFC5655C
  27 asm volatile (
  28 "                STMFD   SP!, {R4,LR}\n"
  29 "                LDR     R4, =0x19924\n"
  30 "                SUB     SP, SP, #4\n"
  31 "                B       loc_FFC56590\n"
  32 "loc_FFC5656C:\n"
  33 "                TST     R3, #4\n"
  34 "                BEQ     loc_FFC5658C\n"
  35 "                LDR     R0, [R4]\n"
  36 "                BL      sub_FFC0FB44\n" // ClearEventFlag
  37 "                LDR     R0, [R4]\n"
  38 "                MOV     R1, #8\n"
  39 "                BL      sub_FFC0F9A8\n" // SetEventFlag
  40 "                B       loc_FFC56590\n"
  41 "loc_FFC5658C:\n"
  42 "                BL      sub_FFC564A4_my\n" // ->
  43 "loc_FFC56590:\n"
  44 "                MOV     R1, #7\n"
  45 "                LDR     R0, [R4]\n"
  46 "                MOV     R2, #0\n"
  47 "                BL      sub_FFC0F988\n"
  48 "                CMP     R0, #0\n"
  49 "                MOV     R1, SP\n"
  50 "                BEQ     loc_FFC565C0\n"
  51 "                MOV     R1, #0x2B0\n"
  52 "                LDR     R0, =0xFFC563F8\n" // "dwFWrite.c"
  53 "                ADD     R1, R1, #1\n"
  54 "                BL      sub_FFC03AE8\n" // DebugAssert
  55 "                B       loc_FFC565D8\n"
  56 "loc_FFC565C0:\n"
  57 "                LDR     R0, [R4]\n"
  58 "                BL      sub_FFC0FB94\n"  // GetEventFlagValue
  59 "                LDR     R3, [SP]\n"
  60 "                TST     R3, #2\n"
  61 "                MOV     R1, #5\n"
  62 "                BEQ     loc_FFC5656C\n"
  63 "loc_FFC565D8:\n"
  64 "                LDR     R3, =0x19928\n"
  65 "                LDR     R0, [R3]\n"
  66 "                BL      sub_FFC10E54\n" // Givesemaphore
  67 "                BL      _ExitTask\n"
  68 "                ADD     SP, SP, #4\n"
  69 "                LDMFD   SP!, {R4,PC}\n"
  70     );
  71 }
  72 
  73 void __attribute__((naked,noinline)) sub_FFC564A4_my(  ) {
  74 asm volatile (
  75 "                STMFD   SP!, {R4,R5,LR}\n"
  76 "                LDR     R2, =0x19908\n"
  77 "                LDRH    R3, [R2]\n"
  78 "                SUB     R3, R3, #1\n"
  79 "                CMP     R3, #3\n"
  80 "                LDRLS   PC, [PC,R3,LSL#2]\n"
  81 //"                B       loc_FFC564F0\n"
  82 "                LDR     PC, =0xFFC564F0\n"
  83 "                .long loc_FFC564D0\n"
  84 "                .long 0xFFC564E0\n"
  85 "                .long 0xFFC564E0\n"
  86 "                .long 0xFFC564E0\n"
  87 // only the first case is hooked, remaining jump directly back to firmware
  88 /*
  89 "                DCD loc_FFC564E0\n"
  90 "                DCD loc_FFC564E0\n"
  91 "                DCD loc_FFC564E0\n"
  92 */
  93 "loc_FFC564D0:\n"
  94 "                LDR     R0, =0x198C8\n"
  95 "                BL      sub_FFC56350_my\n" // ->
  96 "                MOV     R4, R0\n"
  97 //"                B       loc_FFC564F4\n"
  98 "                LDR     PC,=0xFFC564F4\n" // jump back to frimware
  99 /*
 100 "loc_FFC564E0:\n"
 101 "                LDR     R0, =0x198C8\n"
 102 "                BL      sub_FFC56404\n" // LOCATION: dwFWrite.c:604
 103 "                MOV     R4, R0\n"
 104 "                B       loc_FFC564F4\n"
 105 "loc_FFC564F0:\n"
 106 "                MOV     R4, #1\n"
 107 "loc_FFC564F4:\n"
 108 "                CMP     R4, #0\n"
 109 "                MOV     R1, #1\n"
 110 "                LDMEQFD SP!, {R4,R5,PC}\n"
 111 "                LDR     R3, =0x19924\n"
 112 "                LDR     R0, [R3]\n"
 113 "                BL      ClearEventFlag\n"
 114 "                LDR     R3, =0x19930\n"
 115 "                LDR     R5, [R3]\n"
 116 "                LDR     R1, =0x1992C\n"
 117 "                LDR     R12, =0x279C\n"
 118 "                MOV     R3, #1\n"
 119 "                MOV     R2, #0\n"
 120 "                CMP     R5, #0\n"
 121 "                STR     R3, [R1]\n"
 122 "                MOV     R0, R4\n"
 123 "                STR     R2, [R12]\n"
 124 "                LDMEQFD SP!, {R4,R5,PC}\n"
 125 "                MOV     LR, PC\n"
 126 "                MOV     PC, R5\n"
 127 "                LDMFD   SP!, {R4,R5,PC}\n"
 128 */
 129     );
 130 }
 131 
 132 void __attribute__((naked,noinline)) sub_FFC56350_my(  ) {
 133 asm volatile (
 134 "                STMFD   SP!, {R4-R6,LR}\n"
 135 "                MOV     R4, R0\n"
 136 "                ADD     R5, R4, #0x1C\n"
 137 "                MOV     R0, R5\n"
 138 "                BL      sub_FFC56028\n"
 139 "                LDR     R0, [R4,#0x3C]\n"
 140 "                BL      sub_FFC5F0CC\n"
 141 "                LDR     R3, [R4]\n"
 142 "                MOV     R1, #0x600\n"
 143 "                TST     R3, #0x10000\n"
 144 "                ADD     R1, R1, #1\n"
 145 "                MOV     R2, #0x1B4\n"
 146 "                ORRNE   R1, R1, #0x8000\n"
 147 "                LDR     R3, [R4,#0x3C]\n"
 148 "                ADD     R2, R2, #2\n"
 149 // hook
 150       "STMFD SP!, {R1-R12,LR}\n"
 151       "MOV R0, R4\n"
 152       "BL filewrite_main_hook\n"
 153       "BL filewrite_jpeg_complete\n"
 154       "CMP R0, #0\n"
 155       "LDRNE R0, =0xFFC01A04\n" // "/null" as file name (works only on VxWorks)
 156       "LDMFD SP!, {R1-R12,LR}\n"
 157       "MOVEQ R0, R5\n" //canon file name
 158 //hook end
 159 //"                MOV     R0, R5\n"
 160 "                LDR   PC, =0xFFC56390\n" // jump back to firmware
 161 /*
 162 "                BL      sub_FFC5612C\n"
 163 "                MOV     R1, R4\n"
 164 "                MOV     R2, R0\n"
 165 "                MOV     R4, #0\n"
 166 "                LDR     R3, =0x1990C\n"
 167 "                CMP     R2, R4\n"
 168 "                LDR     R6, =0x19908\n"
 169 "                MOV     R0, R5\n"
 170 "                STR     R2, [R3]\n"
 171 "                BGT     loc_FFC563D0\n"
 172 "                BL      sub_FFC5603C\n"
 173 "                MOVL    R0, 0x9200001\n"
 174 "                BL      sub_FFC53D30\n"
 175 "                MOV     R0, #2\n"
 176 "                LDMFD   SP!, {R4-R6,PC}\n"
 177 "loc_FFC563D0:\n"
 178 "                LDR     R3, =0x19910\n"
 179 "                LDRH    R0, [R6]\n"
 180 "                STR     R4, [R3]\n"
 181 "                BL      sub_FFC562A0\n"
 182 "                STRH    R0, [R6]\n"
 183 "                MOV     R0, R4\n"
 184 "                LDMFD   SP!, {R4-R6,PC}\n"
 185 */
 186     );
 187 }
 188 

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