root/platform/ixus285_elph360hs/lib.c

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

DEFINITIONS

This source file includes following definitions.
  1. debug_led
  2. hook_raw_image_addr
  3. hook_alt_raw_image_addr
  4. camera_jpeg_count_str
  5. vid_bitmap_refresh
  6. shutdown
  7. get_flash_params_count
  8. camera_set_led
  9. vid_get_bitmap_fb
  10. vid_get_viewport_fb
  11. vid_get_viewport_fb_d
  12. vid_get_viewport_live_fb
  13. vid_get_viewport_yscale
  14. vid_get_viewport_width
  15. vid_get_viewport_height
  16. vid_get_viewport_display_xoffset
  17. vid_get_viewport_display_xoffset_proper
  18. vid_get_viewport_display_yoffset_proper
  19. vid_get_viewport_height_proper
  20. vid_get_viewport_fullscreen_height
  21. vid_get_palette_type
  22. vid_get_palette_size
  23. vid_get_bitmap_active_buffer
  24. vid_get_bitmap_active_palette

   1 #include "platform.h"
   2 #include "platform_palette.h"
   3 #include "lolevel.h"
   4 
   5 #define LED_PR 0xc022d1fc
   6 #define LED_AF 0xc022d1b0
   7 
   8 void debug_led(int state)
   9 {
  10         *(int*)LED_PR=state ? 0x93d800 : 0x83dc00;
  11 }
  12 
  13 
  14 extern  int     active_raw_buffer;
  15 extern  char*   raw_buffers[];
  16 
  17 char *hook_raw_image_addr()
  18 {
  19     return raw_buffers[active_raw_buffer & 1];
  20 }
  21 
  22 char *hook_alt_raw_image_addr()
  23 {
  24     return raw_buffers[((active_raw_buffer & 1)^1)];
  25 }
  26 
  27 
  28 
  29 char *camera_jpeg_count_str()
  30 {
  31     extern char jpeg_count_str[];
  32     return jpeg_count_str;
  33 }
  34 
  35 void vid_bitmap_refresh()
  36 {
  37     extern int full_screen_refresh;
  38     extern void _ScreenLock();
  39     extern void _ScreenUnlock();
  40 
  41     full_screen_refresh |= 3;
  42     _ScreenLock();
  43     _ScreenUnlock();
  44 }
  45 
  46 
  47 void shutdown()
  48 {
  49     extern void _TurnOffE1(void);
  50     _TurnOffE1();
  51     while(1);
  52 }
  53 
  54 
  55 int get_flash_params_count(void) { return 0xf1; }     // Found @0xff237388
  56 
  57 
  58 
  59 void camera_set_led(int led, int state, int bright) {
  60     static char led_table[]={0,4}; // status, AF
  61     _LEDDrive(led_table[led%sizeof(led_table)], state<=1 ? !state : state);
  62 }
  63 
  64 
  65 void *vid_get_bitmap_fb()        { return (void*)0x40711000; }             // Found @0xff06cd40
  66 void *vid_get_viewport_fb()      { return (void*)0x40866b80; }             // Found @0xff4edb6c    
  67 void *vid_get_viewport_fb_d()
  68 {
  69     extern char *viewport_fb_d;
  70     return viewport_fb_d;
  71 }
  72 
  73 extern char active_viewport_buffer;
  74 extern void* viewport_buffers[];
  75 
  76 void *vid_get_viewport_live_fb()
  77 {
  78 //    if (MODE_IS_VIDEO(mode_get()) || is_video_recording())
  79 //        return viewport_buffers[0];     // Video only seems to use the first viewport buffer.
  80 
  81     // Hopefully return the most recently used viewport buffer so that motion detect, histogram, zebra and edge overly are using current image data
  82     // verified -1 gives best response
  83     return viewport_buffers[(active_viewport_buffer-1)&3];
  84 }
  85 
  86 // Y multiplier for cameras with 480 pixel high viewports (CHDK code assumes 240)
  87 int vid_get_viewport_yscale() {
  88     return 2;
  89 }
  90 
  91 
  92 
  93 int vid_get_viewport_width()
  94 {
  95     if (camera_info.state.mode_play)
  96     {
  97         return 360;
  98     }
  99     extern int _GetVRAMHPixelsSize();
 100     return _GetVRAMHPixelsSize() >> 1;
 101 }
 102 
 103 long vid_get_viewport_height()
 104 {
 105 
 106     int m = mode_get();
 107     int aspect_ratio=shooting_get_prop(PROPCASE_ASPECT_RATIO);
 108 
 109     if (MODE_IS_VIDEO(m) || is_video_recording())
 110         return 240;
 111 
 112     if ((m & MODE_MASK) != MODE_PLAY) 
 113     {
 114         // 0 = 4:3, 1 = 16:9, 2 = 3:2, 3 = 1:1
 115         if (aspect_ratio==1 || aspect_ratio==2)
 116             return 240;
 117     }
 118     extern int _GetVRAMVPixelsSize();    
 119     return ((m & MODE_MASK) == MODE_PLAY)?240:_GetVRAMVPixelsSize()>>1;
 120 }
 121 
 122 
 123 // viewport width offset table for each aspect ratio
 124 // 0 = 4:3, 1 = 16:9, 2 = 3:2, 3 = 1:1
 125 static long vp_xo[4] = { 0, 0, 0, 44 };        // should all be even values for edge overlay
 126 
 127 int vid_get_viewport_display_xoffset()
 128 {
 129     int m = mode_get();
 130     int aspect_ratio=shooting_get_prop(PROPCASE_ASPECT_RATIO);
 131 
 132     if ((m & MODE_MASK) != MODE_PLAY) {
 133         return (vp_xo[aspect_ratio]);
 134     }
 135     else
 136         return 0;
 137 }
 138 
 139 int vid_get_viewport_display_xoffset_proper()   { return vid_get_viewport_display_xoffset()<<1; }
 140 int vid_get_viewport_display_yoffset_proper()   { return vid_get_viewport_display_yoffset()<<1; }
 141 int vid_get_viewport_height_proper()            { return vid_get_viewport_height() * 2; }
 142 int vid_get_viewport_fullscreen_height()        { return 480; }
 143 int vid_get_palette_type()                      { return 3; }
 144 int vid_get_palette_size()                      { return 256 * 4; }
 145 
 146 // Defined in stubs_min.S
 147 extern int active_bitmap_buffer;
 148 extern char* bitmap_buffer[];
 149 void *vid_get_bitmap_active_buffer() {
 150     return bitmap_buffer[active_bitmap_buffer&1];
 151 }
 152 
 153 
 154 void *vid_get_bitmap_active_palette()
 155 {
 156     extern void *palette_buffer_ptr;
 157     return palette_buffer_ptr;
 158 }
 159 

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