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_width
  9. vid_get_viewport_height
  10. vid_get_viewport_fb
  11. vid_get_viewport_live_fb
  12. vid_get_viewport_fb_d
  13. vid_get_bitmap_fb
  14. vid_get_palette_type
  15. vid_get_palette_size
  16. vid_get_bitmap_active_buffer
  17. 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, __attribute__ ((unused))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 // following width and height works for most modes, except: 320x240 video, stitch, maybe more
  72 int vid_get_viewport_width()
  73 {
  74     return 360;
  75 }
  76 
  77 long vid_get_viewport_height()
  78 {
  79     return 240;
  80 }
  81 
  82 
  83 // Viewport and Bitmap values that shouldn't change across firmware versions.
  84 // Values that may change are in lib.c for each firmware version.
  85 
  86 // Defined in stubs_min.S
  87 extern char active_viewport_buffer;
  88 extern void* viewport_buffers[];
  89 
  90 void *vid_get_viewport_fb()
  91 {
  92     // Return first viewport buffer - for case when vid_get_viewport_live_fb not defined
  93     return viewport_buffers[0];
  94 }
  95 
  96 void *vid_get_viewport_live_fb()
  97 {
  98     if (camera_info.state.mode_video)
  99         return viewport_buffers[0];     // Video only seems to use the first viewport buffer.
 100 
 101     // Hopefully return the most recently used viewport buffer so that motion detect, histogram, zebra and edge overly are using current image data
 102     return viewport_buffers[(active_viewport_buffer)&3];
 103 }
 104 
 105 void *vid_get_viewport_fb_d()
 106 {
 107     extern char *viewport_fb_d;
 108         return viewport_fb_d;
 109 }
 110 
 111 void *vid_get_bitmap_fb()
 112 {
 113     return (void*)0x403f1000; // Found @0xffc43628
 114 }
 115 
 116 
 117 // Functions for PTP Live View system
 118 // 256 entry palette based on 100b 
 119 // sub_FFCD6110  <- Called for a function with 2 ref to **"Palette Class.
 120 int vid_get_palette_type()                      { return 3; }
 121 int vid_get_palette_size()                      { return 256 * 4; }
 122 
 123 void *vid_get_bitmap_active_buffer()
 124 {   //found @loc_ffcd61b4 ixus105 100b ->Called before *"..<GetBmpVramInfo> Add
 125     return (void*)(*(int*)(0x4AD0+0x18)); 
 126 }
 127 
 128 void *vid_get_bitmap_active_palette() {
 129         return (void*)(*(int*)(0x4AD0+0x2C));  //Found @ 0xffcd6110 ixus105 100b
 130 }

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