root/platform/ixus175_elph180/lib.c

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

DEFINITIONS

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

   1 #include "platform.h"
   2 #include "platform_palette.h"
   3 #include "lolevel.h"
   4 
   5 #define LED_PR 0xc022d1fc
   6 #define LED_AF 0xc022d200
   7 
   8 
   9 void debug_led(int state)
  10 {
  11         *(int*)LED_PR=state ? 0x93d800 : 0x83dc00;
  12 }
  13 
  14 void shutdown()
  15 {
  16     extern void _TurnOffE1(void);
  17     _TurnOffE1();
  18     while(1);
  19 }
  20 
  21 // Power Led = first entry in table (led 0)
  22 // AF Assist Lamp = second entry in table (led 1)
  23 void camera_set_led(int led, int state, int bright) {
  24     static char led_table[2]={0,4};
  25     if(state<=1) _LEDDrive(led_table[led%sizeof(led_table)], (!state)&1);
  26 }
  27 
  28 void *vid_get_viewport_fb()      { return (void*)0x40866b80; }             // Found @0xffb93e14
  29 char *camera_jpeg_count_str()    { return (char*)0x000d77d4; }             // Found @0xffa13d38
  30 int get_flash_params_count(void) { return 0xF1; }                          // Found @0xff9c3e58
  31 
  32 extern int active_bitmap_buffer;
  33 extern char* bitmap_buffer[];
  34 
  35 void *vid_get_bitmap_fb()        { return (void*)0x40711000; }             // Found @0xff86689c
  36 
  37 void *vid_get_bitmap_active_buffer() {
  38     return bitmap_buffer[active_bitmap_buffer&1];
  39 }
  40 
  41 // Palette colour tables  found @ 0xffbec15c
  42 void *vid_get_bitmap_active_palette()
  43 {
  44     extern int active_palette_buffer;
  45     extern int** palette_buffer_ptr;
  46     int *p = palette_buffer_ptr[active_palette_buffer];
  47     if(!p) {
  48         p = palette_buffer_ptr[0];
  49     }
  50     return (p+1);
  51 }
  52 
  53 extern int _GetVRAMHPixelsSize();
  54 extern int _GetVRAMVPixelsSize();
  55 
  56 //taken from n
  57 int vid_get_viewport_width()
  58 {
  59     if ((mode_get() & MODE_MASK) == MODE_PLAY)
  60     {
  61         return 360;
  62     }
  63     return _GetVRAMHPixelsSize() >> 1;
  64 }
  65 // taken from n
  66 long vid_get_viewport_height()
  67 {
  68   if ((mode_get() & MODE_MASK) == MODE_PLAY)
  69   {
  70        return 240;
  71   }
  72   return _GetVRAMVPixelsSize();
  73 }
  74 
  75 void *vid_get_viewport_fb_d()
  76 {
  77     extern char *viewport_fb_d;
  78     return viewport_fb_d;
  79 }
  80 
  81 void *vid_get_viewport_live_fb()
  82 {
  83     extern char active_viewport_buffer;
  84     extern void* viewport_buffers[];
  85 
  86     // no distinct video mode
  87     if (get_movie_status() == VIDEO_RECORD_IN_PROGRESS)
  88         return viewport_buffers[0];     // Video only seems to use the first viewport buffer.
  89     // Hopefully return the most recently used viewport buffer so that motion detect, histogram, zebra and edge overly are using current image data
  90     // verified -1 gives best response (50 .. 90 ms)
  91     return viewport_buffers[(active_viewport_buffer-1)&3];
  92 }
  93 
  94 char *hook_raw_image_addr()
  95 {
  96     return (char*) 0x43727660;  //found by campare "JPEG BUFF" at FFB95894 and compare to ixus 160
  97 }
  98 
  99 void vid_bitmap_refresh()
 100 {
 101     extern int full_screen_refresh;
 102     extern void _ScreenLock();
 103     extern void _ScreenUnlock();
 104 
 105     full_screen_refresh |= 3;
 106     _ScreenLock();
 107     _ScreenUnlock();
 108 }
 109 
 110 int vid_get_palette_type()   { return 5; }
 111 int vid_get_palette_size()   { return 256 * 4 ; }
 112 
 113 #ifdef CAM_LOAD_CUSTOM_COLORS
 114 // Function to load CHDK custom colors into active Canon palette
 115 void load_chdk_palette()
 116 {
 117     extern int active_palette_buffer;
 118         // Only load for the standard record and playback palettes
 119         if ((active_palette_buffer == 0) || (active_palette_buffer == 5))
 120     {
 121         int *pal = (int*)vid_get_bitmap_active_palette();
 122 
 123 
 124         if (pal[CHDK_COLOR_BASE+0] != 0x3F3ADF62)
 125         {
 126             pal[CHDK_COLOR_BASE+0]  = 0x3F3ADF62;  // Red
 127             pal[CHDK_COLOR_BASE+1]  = 0x3F26EA40;  // Dark Red
 128             pal[CHDK_COLOR_BASE+2]  = 0x3F4CD57F;  // Light Red
 129             pal[CHDK_COLOR_BASE+3]  = 0x3F73BFAE;  // Green
 130             pal[CHDK_COLOR_BASE+4]  = 0x3F4BD6CA;  // Dark Green
 131             pal[CHDK_COLOR_BASE+5]  = 0x3F95AB95;  // Light Green
 132             pal[CHDK_COLOR_BASE+6]  = 0x3F4766F0;  // Blue
 133             pal[CHDK_COLOR_BASE+7]  = 0x3F1250F3;  // Dark Blue
 134             pal[CHDK_COLOR_BASE+8]  = 0x3F7F408F;  // Cyan
 135             pal[CHDK_COLOR_BASE+9]  = 0x3F512D5B;  // Magenta
 136             pal[CHDK_COLOR_BASE+10] = 0x3FA9A917;  // Yellow
 137             pal[CHDK_COLOR_BASE+11] = 0x3F819137;  // Dark Yellow
 138             pal[CHDK_COLOR_BASE+12] = 0x3FDED115;  // Light Yellow
 139             pal[CHDK_COLOR_BASE+13] = 0x00090000;  // Transparent dark grey
 140 
 141             extern char palette_control;
 142             palette_control = 1;
 143             vid_bitmap_refresh();
 144         }
 145     }
 146 }
 147 #endif

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