root/platform/sx150is/sub/100a/lib.c

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

DEFINITIONS

This source file includes following definitions.
  1. hook_raw_image_addr
  2. vid_get_viewport_live_fb
  3. vid_get_bitmap_fb
  4. vid_get_viewport_fb
  5. vid_get_viewport_fb_d
  6. camera_jpeg_count_str
  7. vid_get_viewport_width
  8. vid_get_viewport_height
  9. _GetBatteryTemperature

   1 /*
   2 *********************
   3 SX150IS 100.a firmware
   4 **********************
   5 */
   6 
   7 #include "platform.h"
   8 
   9 char *hook_raw_image_addr()
  10 {
  11 /*
  12 ROM:FFB4FFE8                 LDR     R5, =0x4159DBE0
  13 ROM:FFB4FFEC                 LDR     R4, =0x409DC9F0
  14 ROM:FFB4FFF0                 LDR     R6, =0x41D65F00  <<<<<<<<<<<<<<<
  15 ROM:FFB50008                 ADR     R0, aJpegBuffPLx ; "JPEG BUFF       %p ( %lx )"
  16 ROM:FFB50020                 BL      sub_FF950780
  17 ROM:FFB50024                 MOV     R1, R5
  18 ROM:FFB50028                 ADR     R0, aImgVramBuffP ; "IMG VRAM BUFF   %p"
  19 ROM:FFB5002C                 BL      sub_FF950780
  20 ROM:FFB50030                 MOV     R1, R4
  21 ROM:FFB50034                 ADR     R0, aThumVramBuffP ; "THUM VRAM BUFF  %p"
  22 ROM:FFB50038                 BL      sub_FF950780
  23 ROM:FFB5003C                 MOV     R1, R6
  24 ROM:FFB50040                 ADR     R0, aCrawBuffP  ; "CRAW BUFF       %p"
  25 ROM:FFB50044                 BL      sub_FF950780
  26 ROM:FFB50048                 LDR     R1, =0x14EB7E0
  27 ROM:FFB5004C                 ADR     R0, aCrawBuffSizeP ; "CRAW BUFF SIZE  %p"
  28 */
  29         return (char*)(0x41D65F00);
  30 }
  31 
  32 
  33 // Live view
  34 extern char active_viewport_buffer;
  35 extern void* viewport_buffers[];
  36 
  37 void *vid_get_viewport_live_fb()
  38 {
  39     // not verified on sx150, but on other ports Video only seems to use the first viewport buffer.
  40     if (MODE_IS_VIDEO(mode_get()) || get_movie_status() == VIDEO_RECORD_IN_PROGRESS)
  41         return viewport_buffers[0];     
  42 
  43     // Hopefully return the most recently used viewport buffer so that motion detect, histogram, zebra and edge overly are using current image data
  44     return viewport_buffers[(active_viewport_buffer-1)&3];
  45 }
  46 
  47 
  48 
  49 
  50 void *vid_get_bitmap_fb()
  51 {
  52 /*
  53 ROM:FF92A878 sub_FF92A878                            ; CODE XREF: sub_FFA2DAC0+48p
  54 ROM:FF92A878                 STMFD   SP!, {R4-R8,LR}
  55 ROM:FF92A87C                 LDR     R8, =0x5D88
  56 ROM:FF92A880                 MOV     R4, R0
  57 ROM:FF92A884                 LDR     R0, [R8,#0x10]
  58 ROM:FF92A888                 MOV     R5, R1
  59 ROM:FF92A88C                 CMP     R0, #1
  60 ROM:FF92A890                 MOV     R6, R2
  61 ROM:FF92A894                 MOV     R7, R3
  62 ROM:FF92A898                 MOVEQ   R1, #0x18C
  63 ROM:FF92A89C                 ADREQ   R0, aBmpddev_c  ; "BmpDDev.c"
  64 ROM:FF92A8A0                 BLEQ    sub_FF81EDBC
  65 ROM:FF92A8A4                 CMP     R4, #0
  66 ROM:FF92A8A8                 CMPNE   R5, #0
  67 ROM:FF92A8AC                 CMPNE   R6, #0
  68 ROM:FF92A8B0                 CMPNE   R7, #0
  69 ROM:FF92A8B4                 LDREQ   R1, =0x18F
  70 ROM:FF92A8B8                 ADREQ   R0, aBmpddev_c  ; "BmpDDev.c"
  71 ROM:FF92A8BC                 BLEQ    sub_FF81EDBC
  72 ROM:FF92A8C0                 MOV     R0, #0x2D0   <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<  Height  0x2D0 dec 720
  73 ROM:FF92A8C4                 MOV     R1, #0xF0    <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<  Width  0xF0   dec 240
  74 ROM:FF92A8C8                 STR     R0, [R4]
  75 ROM:FF92A8CC                 STR     R1, [R5]
  76 ROM:FF92A8D0                 STR     R0, [R6]
  77 ROM:FF92A8D4                 LDR     R0, =0x403F1000 <<<<<<<<<<<<<<<<<
  78 ROM:FF92A8D8                 STR     R0, [R7]
  79 ROM:FF92A8DC                 MOV     R0, #1
  80 ROM:FF92A8E0                 STR     R0, [R8,#0x10]
  81 ROM:FF92A8E4                 MOV     R0, #0
  82 ROM:FF92A8E8                 LDMFD   SP!, {R4-R8,PC}
  83 ROM:FF92A8E8 ; End of function sub_FF92A878
  84 */
  85         return (void*)0x403f1000;
  86 }
  87 
  88 
  89 // Live picture buffer (shoot half-pressed)
  90 void *vid_get_viewport_fb()
  91 {
  92 /*
  93 ROM:FFB4D218 loc_FFB4D218                            ; CODE XREF: sub_FFB4D1DC+28j
  94 ROM:FFB4D218                 MOV     R2, R7
  95 ROM:FFB4D21C                 MOV     R1, R6
  96 ROM:FFB4D220                 MOV     R0, R5
  97 ROM:FFB4D224                 BL      sub_FF855380
  98 ROM:FFB4D228                 LDR     R1, =0x40546B80  <<<<<<<<<<<<<<<<<<<
  99 ROM:FFB4D22C                 LDR     R0, =0x3F480
 100 ROM:FFB4D230                 STR     R1, [R4]
 101 ROM:FFB4D234                 STR     R0, [R4,#4]
 102 ROM:FFB4D238                 ADR     R0, aVramAddressP ; "VRAM Address  : %p\r"
 103 ROM:FFB4D23C                 BL      sub_FF950780
 104 ROM:FFB4D240                 LDR     R1, [R4,#4]
 105 ROM:FFB4D244                 ADR     R0, aVramSize0xX ; "VRAM Size     : 0x%x\r"
 106 ROM:FFB4D248                 BL      sub_FF950780
 107 ROM:FFB4D24C                 MOV     R0, #0
 108 ROM:FFB4D250                 LDMFD   SP!, {R4-R8,PC}
 109 ROM:FFB4D250 ; End of function sub_FFB4D1DC
 110 */
 111 
 112 
 113         return (void*)0x40546B80;
 114 }
 115 
 116 // Histo etc. when in play mode maybe ?
 117 void *vid_get_viewport_fb_d()
 118 {
 119 
 120 /*
 121 ROM:FF8780C4 ; =============== S U B R O U T I N E =======================================
 122 ROM:FF8780C4
 123 ROM:FF8780C4
 124 ROM:FF8780C4 sub_FF8780C4                            ; CODE XREF: sub_FF889880+1BCp
 125 ROM:FF8780C4                                         ; sub_FF889A5C+90p ...
 126 ROM:FF8780C4                 STMFD   SP!, {R1-R7,LR}
 127 ROM:FF8780C8                 LDR     R5, =0x2710
 128 ROM:FF8780CC                 LDR     R4, =0x2BA8   <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 129 ROM:FF8780D0                 LDR     R3, =0x6D1
 130 ROM:FF8780D4                 LDR     R2, =aImageplayer_c ; "ImagePlayer.c"
 131 ROM:FF8780D8                 LDR     R0, [R4,#0x4C]
 132 ROM:FF8780DC                 MOV     R1, R5
 133 ROM:FF8780E0                 BL      sub_FF83AB9C
 134 ROM:FF8780E4                 MOV     R0, #1
 135 ROM:FF8780E8                 BL      sub_FF8772A8
 136 ROM:FF8780EC                 CMN     R0, #1
 137 ROM:FF8780F0                 BEQ     loc_FF8781C0
 138 ROM:FF8780F4                 LDR     R6, =0x382F4
 139 ROM:FF8780F8                 ADD     R1, R0, R0,LSL#2
 140 ROM:FF8780FC                 LDR     R0, [R6,R1,LSL#2]
 141 ROM:FF878100                 ADD     R12, R6, R1,LSL#2
 142 ROM:FF878104                 STR     R0, [R4,#0x58]   <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 143 ROM:FF878108                 LDR     R1, [R12,#0xC]
 144 ROM:FF87810C                 LDR     R2, =sub_FF8779C4
 145 ROM:FF878110                 MOV     R3, #0
 146 ROM:FF878114                 STMEA   SP, {R1-R3}
 147 ROM:FF878118                 MOV     R2, #0
 148 ROM:FF87811C                 LDR     R3, [R12,#8]
 149 ROM:FF878120                 MOV     R1, R2
 150 ROM:FF878124                 BL      sub_FF92C098
 151 ROM:FF878128                 TST     R0, #1
 152 ROM:FF87812C                 LDRNE   R1, =0x6F7
 153 ROM:FF878130                 LDRNE   R0, =aImageplayer_c ; "ImagePlayer.c"
 154 */
 155 
 156     return (void*)(*(int*) (0x2BA8+0x58));
 157 }
 158 
 159 char *camera_jpeg_count_str()
 160 /*
 161 ROM:FFA1EA90 ; jumptable FFA1E9E8 entry 2
 162 ROM:FFA1EA90                 LDR     R0, =0x270F
 163 ROM:FFA1EA94                 CMP     R1, R0
 164 ROM:FFA1EA98                 BCC     loc_FFA1EAAC
 165 ROM:FFA1EA9C                 LDR     R0, =0xBA380  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 166 ROM:FFA1EAA0                 ADR     R1, a9999       ; "9999"
 167 ROM:FFA1EAA4                 BL      sprintf
 168 ROM:FFA1EAA8                 B       loc_FFA1EABC
 169 */
 170 {
 171  return (char*)0x000ba380;
 172 }
 173 
 174 int vid_get_viewport_width()
 175 {
 176     return 360;
 177 }
 178 
 179 long vid_get_viewport_height()
 180 {
 181     return 240;
 182 }
 183 
 184 
 185 //Copied from S95 section  END
 186 
 187 /*
 188 //  NEW NEW NEW
 189 //  Need checking
 190 
 191 void JogDial_CW(void){
 192  _PostLogicalEventForNotPowerType(0x874, 2);  // RotateJogDialRight
 193 }
 194 
 195 void JogDial_CCW(void){
 196  _PostLogicalEventForNotPowerType(0x875, 2);  // RotateJogDialLeft
 197 }
 198 */
 199 
 200 /*
 201 Note copied from SX110 IS
 202 GetBatteryTemperature usually will get back temperature of battery compartment/batteries. GetBatteryTemperature is implemented in Canon's firmware for SX120IS.
 203 Firmware entry point is identified (0xFFC394D8) but function is not usable. Camera will crash if Canon's GetBatteryTemperature is called by CHDK.
 204 To avoid a crash Canon's GetBatteryTemperature must not called. As long CHDK general code do not distinguish between cameras that support or don't support GetBatteryTemperature,
 205 this function will be implemented as specific CHDK-code. It returns always with -99 (which means -99 Celsius or -146 Fahrenheit).
 206 Original entry point in Canon's firmware is disabled (in stubs_entry.S).
 207 */
 208 
 209 int _GetBatteryTemperature()
 210 {
 211       return -99;
 212 }
 213 
 214 

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