root/platform/sx420is/lib.c

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

DEFINITIONS

This source file includes following definitions.
  1. debug_led
  2. hook_raw_image_addr
  3. camera_jpeg_count_str
  4. vid_bitmap_refresh
  5. shutdown
  6. get_flash_params_count
  7. camera_set_led
  8. vid_get_bitmap_fb
  9. vid_get_viewport_fb
  10. vid_get_viewport_fb_d
  11. vid_get_viewport_live_fb
  12. vid_get_viewport_width
  13. vid_get_viewport_height
  14. vid_get_viewport_display_xoffset
  15. vid_get_palette_type
  16. vid_get_palette_size
  17. vid_get_bitmap_active_buffer
  18. 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 0xc022d200
   7 
   8 void debug_led(int state)
   9 {
  10         *(int*)LED_PR=state ? 0x93d800 : 0x83dc00;
  11 }
  12 
  13 char *hook_raw_image_addr()
  14 {
  15     return (char*)0x454a8d60; 
  16 }
  17 
  18 
  19 char *camera_jpeg_count_str()
  20 {
  21     extern char jpeg_count_str[];
  22     return jpeg_count_str;
  23 }
  24 
  25 void vid_bitmap_refresh()
  26 {
  27     extern int full_screen_refresh;
  28     extern void _ScreenLock();
  29     extern void _ScreenUnlock();
  30 
  31     full_screen_refresh |= 3;
  32     _ScreenLock();
  33     _ScreenUnlock();
  34 }
  35 
  36 
  37 void shutdown()
  38 {
  39     extern void _TurnOffE1(void);
  40     _TurnOffE1();
  41     while(1);
  42 }
  43 
  44 
  45 int get_flash_params_count(void) { return 0xf1; }
  46 
  47 
  48 
  49 void camera_set_led(int led, int state, int bright) {
  50     static char led_table[]={0,4}; // status, AF
  51     _LEDDrive(led_table[led%sizeof(led_table)], state<=1 ? !state : state);
  52 }
  53 
  54 
  55 void *vid_get_bitmap_fb()        { return (void*)0x40711000; }
  56 void *vid_get_viewport_fb()      { return (void*)0x40866b80; }             
  57 void *vid_get_viewport_fb_d()
  58 {
  59     extern char *viewport_fb_d;
  60     return viewport_fb_d;
  61 }
  62 
  63 extern char active_viewport_buffer;
  64 extern void* viewport_buffers[];
  65 
  66 void *vid_get_viewport_live_fb()
  67 {
  68     if (MODE_IS_VIDEO(mode_get()) || is_video_recording())
  69         return viewport_buffers[0];     // Video only seems to use the first viewport buffer.
  70 
  71     // Hopefully return the most recently used viewport buffer so that motion detect, histogram, zebra and edge overly are using current image data
  72     // verified -1 gives best response
  73     return viewport_buffers[(active_viewport_buffer-1)&3];
  74 }
  75 
  76 extern int _GetVRAMHPixelsSize();
  77 extern int _GetVRAMVPixelsSize();
  78 
  79 //taken from n
  80 int vid_get_viewport_width()
  81 {
  82     if ((mode_get() & MODE_MASK) == MODE_PLAY)
  83     {
  84         return 360;
  85     }
  86     return _GetVRAMHPixelsSize() >> 1;
  87 }
  88 // taken from n
  89 long vid_get_viewport_height()
  90 {
  91   if ((mode_get() & MODE_MASK) == MODE_PLAY)
  92   {
  93        return 240;
  94   }
  95   return _GetVRAMVPixelsSize();
  96 }
  97 
  98 // viewport width offset table for each aspect ratio
  99 // 0 = 4:3, 1 = 16:9, 2 = 3:2, 3 = 1:1
 100 static long vp_xo[4] = { 0, 0, 0, 44 };        // should all be even values for edge overlay
 101 
 102 int vid_get_viewport_display_xoffset()
 103 {
 104     int m = mode_get();
 105     int aspect_ratio=shooting_get_prop(PROPCASE_ASPECT_RATIO);
 106 
 107     if ((m & MODE_MASK) != MODE_PLAY) {
 108         return (vp_xo[aspect_ratio]);
 109     }
 110     else
 111         return 0;
 112 }
 113 
 114 //int vid_get_viewport_display_xoffset_proper()   { return vid_get_viewport_display_xoffset()<<1; }
 115 //int vid_get_viewport_display_yoffset_proper()   { return vid_get_viewport_display_yoffset()<<1; }
 116 //int vid_get_viewport_height_proper()            { return vid_get_viewport_height() * 2; }
 117 //int vid_get_viewport_fullscreen_height()        { return 240; }
 118 //int vid_get_viewport_fulllscreen_width()        { return 720; }
 119 int vid_get_palette_type()                      { return 3; }
 120 int vid_get_palette_size()                      { return 256 * 4; }
 121 
 122 // Defined in stubs_min.S
 123 extern int active_bitmap_buffer;
 124 extern char* bitmap_buffer[];
 125 void *vid_get_bitmap_active_buffer()
 126 {
 127     return bitmap_buffer[active_bitmap_buffer&1];
 128 }
 129 
 130 void *vid_get_bitmap_active_palette()
 131 {
 132     extern void *palette_buffer_ptr;
 133     return palette_buffer_ptr;
 134 }
 135 

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