root/platform/ixus132_elph115/lib.c

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

DEFINITIONS

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

   1 #include "platform.h"
   2 #include "platform_palette.h"
   3 #include "lolevel.h"
   4 
   5 char *camera_jpeg_count_str()
   6 {
   7     extern char jpeg_count_str[];
   8     return jpeg_count_str;
   9 }
  10 
  11 void vid_bitmap_refresh()
  12 {
  13     extern int full_screen_refresh;
  14     extern void _ScreenLock();
  15     extern void _ScreenUnlock();
  16 
  17     full_screen_refresh |= 3;
  18     _ScreenLock();
  19     _ScreenUnlock();
  20 }
  21 
  22 // TODO not really complete, last call from task_Bye
  23 void shutdown()
  24 {
  25     extern void _TurnOffE1(void);
  26     _TurnOffE1();
  27     while(1);
  28 }
  29 
  30 //TODO check LED address
  31 #define LED_PR 0xC0220094 // Green (only non-AF)
  32 
  33 void debug_led(int state)
  34 {
  35     volatile long *p=(void*)LED_PR;
  36     if (state)
  37         p[0]=0x46;
  38     else
  39         p[0]=0x44;
  40 }
  41 
  42 void camera_set_led(int led, int state, __attribute__ ((unused))int bright) {
  43  static char led_table[]={0,12}; // status, AF
  44  _LEDDrive(led_table[led%sizeof(led_table)], state<=1 ? !state : state);
  45 }
  46 
  47 int vid_get_viewport_width()     { return 360;  }
  48 long vid_get_viewport_height()   { return 240;  }
  49 
  50 int get_flash_params_count(void) { return 0x91; }                          // Found @0xff207154
  51 
  52 void *vid_get_bitmap_fb()        { return (void*)0x406b1000; }             // Found @0xff08b488
  53 void *vid_get_viewport_fb()      { return (void*)0x40806b80; }             // Found @0xff411fc8
  54 void *vid_get_viewport_fb_d()
  55 {
  56     extern char *viewport_fb_d;
  57     return viewport_fb_d;
  58 }
  59 
  60 void *vid_get_viewport_live_fb()
  61 {
  62     extern char active_viewport_buffer;
  63     extern void* viewport_buffers[];
  64 
  65     // no distinct video mode
  66     if (/*mode_is_video(mode_get())*/ get_movie_status() == VIDEO_RECORD_IN_PROGRESS)
  67         return viewport_buffers[0];     // Video only seems to use the first viewport buffer.
  68     // Hopefully return the most recently used viewport buffer so that motion detect, histogram, zebra and edge overly are using current image data
  69     // verified -1 gives best response
  70     return viewport_buffers[(active_viewport_buffer-1)&3];
  71 }
  72 
  73 
  74 char *hook_raw_image_addr()
  75 {
  76     return (char*)0x42365c30; // Found @0xff4138e0
  77 }
  78 
  79 int vid_get_palette_type()                      { return 3; }
  80 int vid_get_palette_size()                      { return 256 * 4; }
  81 
  82 // Defined in stubs_min.S
  83 extern int active_bitmap_buffer;
  84 extern char* bitmap_buffer[];
  85 void *vid_get_bitmap_active_buffer()
  86 {
  87     return bitmap_buffer[active_bitmap_buffer];
  88 }
  89 
  90 void *vid_get_bitmap_active_palette()
  91 {
  92     extern int active_palette_buffer;
  93     extern int** palette_buffer_ptr;
  94     int *p = palette_buffer_ptr[active_palette_buffer];
  95     // active_palette_buffer can point at null when
  96     // func and menu are opened for the first time
  97     if(!p) {
  98         p = palette_buffer_ptr[0]; // rec mode buffer appears to always be initialized
  99     }
 100     return (p+1);
 101 }
 102 
 103 #ifdef CAM_LOAD_CUSTOM_COLORS
 104 // Function to load CHDK custom colors into active Canon palette
 105 void load_chdk_palette()
 106 {
 107     extern int active_palette_buffer;
 108     // Only load for the standard record and playback palettes
 109     // 0 = rec, 4 = func menu, 5 = playback, 6 = menu (play or rec), 
 110     if ((active_palette_buffer == 0) || (active_palette_buffer == 5) || (active_palette_buffer == 4))
 111     {
 112         int *pal = (int*)vid_get_bitmap_active_palette();
 113         if (pal[CHDK_COLOR_BASE+0] != 0x33ADF62)
 114         {
 115             pal[CHDK_COLOR_BASE+0]  = 0x33ADF62;  // Red
 116             pal[CHDK_COLOR_BASE+1]  = 0x326EA40;  // Dark Red
 117             pal[CHDK_COLOR_BASE+2]  = 0x34CD57F;  // Light Red
 118             pal[CHDK_COLOR_BASE+3]  = 0x373BFAE;  // Green
 119             pal[CHDK_COLOR_BASE+4]  = 0x34BD6CA;  // Dark Green
 120             pal[CHDK_COLOR_BASE+5]  = 0x395AB95;  // Light Green
 121             pal[CHDK_COLOR_BASE+6]  = 0x34766F0;  // Blue
 122             pal[CHDK_COLOR_BASE+7]  = 0x31250F3;  // Dark Blue
 123             pal[CHDK_COLOR_BASE+8]  = 0x37F408F;  // Cyan
 124             pal[CHDK_COLOR_BASE+9]  = 0x3512D5B;  // Magenta
 125             pal[CHDK_COLOR_BASE+10] = 0x3A9A917;  // Yellow
 126             pal[CHDK_COLOR_BASE+11] = 0x3819137;  // Dark Yellow
 127             pal[CHDK_COLOR_BASE+12] = 0x3DED115;  // Light Yellow
 128 
 129             extern char palette_control;
 130             palette_control = 1; // note appears to be a bitmask, bit 2 is also used
 131             vid_bitmap_refresh();
 132         }
 133     }
 134 }
 135 #endif
 136 

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