root/platform/sx170is/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. vid_get_bitmap_fb
  6. get_flash_params_count
  7. debug_led
  8. camera_set_led
  9. vid_get_viewport_fb
  10. vid_get_viewport_fb_d
  11. vid_get_viewport_live_fb
  12. vid_get_viewport_height
  13. vid_get_palette_type
  14. vid_get_palette_size
  15. vid_get_bitmap_active_palette
  16. load_chdk_palette
  17. JogDial_CW
  18. JogDial_CCW

   1 #include "platform.h"
   2 #include "platform_palette.h"
   3 #include "lolevel.h"
   4 
   5 char *hook_raw_image_addr()
   6 {
   7     return (char*)0x420e5c30; //(Found @0xffb64e18)
   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     extern int full_screen_refresh;
  19     extern void _ScreenLock();
  20     extern void _ScreenUnlock();
  21 
  22     full_screen_refresh |= 3;
  23     _ScreenLock();
  24     _ScreenUnlock();
  25 }
  26 
  27 #define LED_PR 0xC0220120
  28 #define AF_LED 0xC0223030
  29 void shutdown()
  30 {
  31     extern void _TurnOffE1(void);
  32     _TurnOffE1();
  33     while(1);
  34 }
  35 
  36 void *vid_get_bitmap_fb()        { return (void*)0x40431000; }             // Found @0xff8539b0
  37 //void *vid_get_viewport_fb()      { return (void*)0x40586b80; }             // Found @0xffb63494
  38 int get_flash_params_count(void) { return 0x99; }                          // Found @0xff9a6220
  39 
  40 
  41 void debug_led(int state)
  42 {
  43     volatile long *p=(void*)LED_PR;
  44     if (state)
  45         p[0]=0x46;
  46     else
  47         p[0]=0x44;
  48 }
  49 
  50 void camera_set_led(int led, int state, __attribute__ ((unused))int bright) {
  51     static char led_table[]={0,12}; // status, AF
  52     _LEDDrive(led_table[led%sizeof(led_table)], state<=1 ? !state : state);
  53 }
  54 
  55 extern char active_viewport_buffer;
  56 extern void* viewport_buffers[];
  57 
  58 void *vid_get_viewport_fb()
  59 {
  60     // Return first viewport buffer - for case when vid_get_viewport_live_fb not defined
  61     return viewport_buffers[0];
  62 }
  63 
  64 void *vid_get_viewport_fb_d()
  65 {
  66     extern char *viewport_fb_d;
  67     return viewport_fb_d;
  68 }
  69 
  70 void *vid_get_viewport_live_fb()
  71 {
  72     // no distinct video mode
  73     if (/*mode_is_video(mode_get())*/ get_movie_status() == VIDEO_RECORD_IN_PROGRESS)
  74         return viewport_buffers[0];     // Video only seems to use the first viewport buffer.
  75 
  76     // Hopefully return the most recently used viewport buffer so that motion detect, histogram, zebra and edge overly are using current image data
  77     // verified -1 gives best response
  78     return viewport_buffers[(active_viewport_buffer-1)&3];
  79 }
  80 
  81 extern int _GetVRAMHPixelsSize();
  82 extern int _GetVRAMVPixelsSize();
  83 
  84 long vid_get_viewport_height()
  85 {
  86     return 240;
  87 }
  88 
  89 // Functions for PTP Live View system
  90 int vid_get_palette_type()                      { return 3; }
  91 int vid_get_palette_size()                      { return 256 * 4; }
  92 
  93 
  94 #ifdef CAM_LOAD_CUSTOM_COLORS
  95 void *vid_get_bitmap_active_palette()
  96 {
  97     extern int active_palette_buffer;
  98     extern int** palette_buffer_ptr;
  99     int *p = palette_buffer_ptr[active_palette_buffer];
 100     // active_palette_buffer can point at null when
 101     // func and menu are opened for the first time
 102     if(!p) {
 103         p = palette_buffer_ptr[0]; // rec mode buffer appears to always be initialized
 104     }
 105     return (p+1);
 106 }
 107 
 108 // Function to load CHDK custom colors into active Canon palette
 109 void load_chdk_palette()
 110 {
 111     extern int active_palette_buffer;
 112     // Only load for the standard record and playback palettes
 113     if ((active_palette_buffer == 0) || (active_palette_buffer == 5))
 114     {
 115         int *pal = (int*)vid_get_bitmap_active_palette();
 116         if (pal[CHDK_COLOR_BASE+0] != 0x3F3ADF62)
 117         {
 118             pal[CHDK_COLOR_BASE+0]  = 0x3F3ADF62;  // Red
 119             pal[CHDK_COLOR_BASE+1]  = 0x3F26EA40;  // Dark Red
 120             pal[CHDK_COLOR_BASE+2]  = 0x3F4CD57F;  // Light Red
 121             pal[CHDK_COLOR_BASE+3]  = 0x3F73BFAE;  // Green
 122             pal[CHDK_COLOR_BASE+4]  = 0x3F4BD6CA;  // Dark Green
 123             pal[CHDK_COLOR_BASE+5]  = 0x3F95AB95;  // Light Green
 124             pal[CHDK_COLOR_BASE+6]  = 0x3F4766F0;  // Blue
 125             pal[CHDK_COLOR_BASE+7]  = 0x3F1250F3;  // Dark Blue
 126             pal[CHDK_COLOR_BASE+8]  = 0x3F7F408F;  // Cyan
 127             pal[CHDK_COLOR_BASE+9]  = 0x3F512D5B;  // Magenta
 128             pal[CHDK_COLOR_BASE+10] = 0x3FA9A917;  // Yellow
 129             pal[CHDK_COLOR_BASE+11] = 0x3F819137;  // Dark Yellow
 130             pal[CHDK_COLOR_BASE+12] = 0x3FDED115;  // Light Yellow
 131 
 132             extern char palette_control;
 133             palette_control = 1;
 134             vid_bitmap_refresh();
 135         }
 136     }
 137 }
 138 #endif
 139 
 140 void JogDial_CW(void)
 141 {
 142     _PostLogicalEventToUI(0x872, 1);  // RotateJogDialRight (in table @ ????, fw 1.01a)
 143 }
 144 
 145 void JogDial_CCW(void)
 146 {
 147     _PostLogicalEventToUI(0x873, 1);  // RotateJogDialLeft (in table @ ???, fw 1.01a)
 148 }

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