root/platform/ixus105_sd1300/lib.c

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

DEFINITIONS

This source file includes following definitions.
  1. hook_raw_image_addr
  2. camera_jpeg_count_str
  3. vid_bitmap_refresh
  4. shutdown
  5. debug_led
  6. camera_set_led
  7. get_flash_params_count
  8. vid_get_viewport_yscale
  9. vid_get_viewport_width
  10. vid_get_viewport_height
  11. vid_get_viewport_fb
  12. vid_get_viewport_live_fb
  13. vid_get_viewport_fb_d
  14. vid_get_bitmap_fb
  15. vid_get_palette_type
  16. vid_get_palette_size
  17. vid_get_bitmap_active_buffer
  18. vid_get_bitmap_active_palette

   1 #include "platform.h"
   2 #include "lolevel.h"
   3 
   4 char *hook_raw_image_addr()
   5 {
   6         //ffe7b424:     e59f60dc        ldr     r6, [pc, #220]  ; ffe7b508: (41d64ecc)  *"...AJPEG BUFF       %p ( %lx )"
   7         return (char*)(0x41d64ecc);
   8 }
   9 
  10 char *camera_jpeg_count_str()
  11 {
  12     extern char jpeg_count_str[];
  13         return jpeg_count_str;
  14 }
  15 
  16 void vid_bitmap_refresh()
  17 {
  18 /*  NOTE: This was the old method, i think the new one performs better
  19     extern int enabled_refresh_physical_screen;
  20     enabled_refresh_physical_screen=1;
  21     _RefreshPhysicalScreen(1);
  22 */
  23         extern int full_screen_refresh;
  24         extern void _ScreenUnlock();
  25         extern void _ScreenLock();
  26 
  27         full_screen_refresh |= 3;
  28         _ScreenLock();
  29         _ScreenUnlock();
  30 }
  31 
  32 void shutdown()
  33 {
  34     volatile long *p = (void*)0xc022001C;
  35 
  36     asm(
  37          "MRS     R1, CPSR\n"
  38          "AND     R0, R1, #0x80\n"
  39          "ORR     R1, R1, #0x80\n"
  40          "MSR     CPSR_cf, R1\n"
  41          :::"r1","r0");
  42 
  43     *p = 0x44;
  44 
  45     while(1);
  46 }
  47 
  48 
  49 #define LED_PR 0xC0220108
  50 
  51 void debug_led(int state)
  52 {
  53     volatile long *p=(void*)LED_PR;
  54     if (state)
  55         p[0]=0x46;
  56     else
  57         p[0]=0x44;
  58 }
  59 
  60 void camera_set_led(int led, int state, int bright)
  61 {
  62   static char led_table[7]={0,0,1,1,1,9,9};
  63  if(led >=4 && led <= 10)
  64   _LEDDrive(led_table[(led-4)%sizeof(led_table)], state<=1 ? !state : state);
  65 }
  66 
  67 int get_flash_params_count(void){
  68  return 0x94;
  69 }
  70 
  71 // Y multiplier for cameras with 480 pixel high viewports (CHDK code assumes 240)
  72 int vid_get_viewport_yscale() {
  73         return 2;
  74 }
  75 
  76 int vid_get_viewport_width()
  77 {
  78     if ((mode_get() & MODE_MASK) == MODE_PLAY)
  79     {
  80         return 360;
  81     }
  82     extern int _GetVRAMHPixelsSize();
  83     return _GetVRAMHPixelsSize() >> 1;
  84 }
  85 
  86 long vid_get_viewport_height()
  87 {
  88     if ((mode_get() & MODE_MASK) == MODE_PLAY)
  89     {
  90         return 240;
  91     }
  92     extern int _GetVRAMVPixelsSize();
  93     return _GetVRAMVPixelsSize() >> 1;
  94 }
  95 
  96 
  97 // Viewport and Bitmap values that shouldn't change across firmware versions.
  98 // Values that may change are in lib.c for each firmware version.
  99 
 100 // Defined in stubs_min.S
 101 extern char active_viewport_buffer;
 102 extern void* viewport_buffers[];
 103 
 104 void *vid_get_viewport_fb()
 105 {
 106     // Return first viewport buffer - for case when vid_get_viewport_live_fb not defined
 107     return viewport_buffers[0];
 108 }
 109 
 110 void *vid_get_viewport_live_fb()
 111 {
 112     if (camera_info.state.mode_video)
 113         return viewport_buffers[0];     // Video only seems to use the first viewport buffer.
 114 
 115     // Hopefully return the most recently used viewport buffer so that motion detect, histogram, zebra and edge overly are using current image data
 116     return viewport_buffers[(active_viewport_buffer)&3];
 117 }
 118 
 119 void *vid_get_viewport_fb_d()
 120 {
 121     extern char *viewport_fb_d;
 122         return viewport_fb_d;
 123 }
 124 
 125 void *vid_get_bitmap_fb()
 126 {
 127     return (void*)0x403f1000; // Found @0xffc43628
 128 }
 129 
 130 
 131 // Functions for PTP Live View system
 132 // 256 entry palette based on 100b 
 133 // sub_FFCD6110  <- Called for a function with 2 ref to **"Palette Class.
 134 int vid_get_palette_type()                      { return 3; }
 135 int vid_get_palette_size()                      { return 256 * 4; }
 136 
 137 void *vid_get_bitmap_active_buffer()
 138 {   //found @loc_ffcd61b4 ixus105 100b ->Called before *"..<GetBmpVramInfo> Add
 139     return (void*)(*(int*)(0x4AD0+0x18)); 
 140 }
 141 
 142 void *vid_get_bitmap_active_palette() {
 143         return (void*)(*(int*)(0x4AD0+0x2C));  //Found @ 0xffcd6110 ixus105 100b
 144 }

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