root/platform/g7x2/lib.c

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

DEFINITIONS

This source file includes following definitions.
  1. vid_bitmap_refresh
  2. vid_get_bitmap_fb
  3. vid_get_opacity_active_buffer
  4. camera_jpeg_count_str
  5. shutdown
  6. debug_led
  7. camera_set_led
  8. shutdown_soft
  9. get_flash_params_count
  10. JogDial_CW
  11. JogDial_CCW
  12. hook_raw_image_addr
  13. vid_get_viewport_fb_d
  14. vid_get_viewport_fb
  15. vid_get_viewport_live_fb
  16. vid_get_viewport_width
  17. vid_get_viewport_height
  18. vid_get_viewport_byte_width
  19. vid_get_viewport_display_xoffset_proper
  20. vid_get_viewport_display_yoffset_proper
  21. vid_get_viewport_fullscreen_width
  22. vid_get_viewport_fullscreen_height
  23. vid_get_viewport_buffer_width_proper
  24. vid_get_viewport_type
  25. vid_get_aspect_ratio

   1 
   2 #include "platform.h"
   3 #include "lolevel.h"
   4 #include "live_view.h"
   5 
   6 extern int active_bitmap_buffer;
   7 extern char* bitmap_buffer[];
   8 
   9 void vid_bitmap_refresh()
  10 {
  11     extern void _transfer_src_overlay(int);
  12     extern void _VTMLock();
  13     extern void _VTMUnlock();
  14     _VTMLock();
  15     int n = active_bitmap_buffer;
  16     _transfer_src_overlay(n^1);
  17     _transfer_src_overlay(n);
  18     _VTMUnlock();
  19 }
  20 
  21 void *vid_get_bitmap_fb()
  22 {
  23     // For live view send YUV instead of RGBA
  24     return bitmap_buffer[active_bitmap_buffer&1];
  25 }
  26 
  27 // the opacity buffer defines opacity for the bitmap overlay's pixels
  28 // found near BmpDDev.c
  29 void *opacity_buffer[2] = { (void*)0x7FC40000, (void*)0x7FB80000 };
  30 
  31 void *vid_get_opacity_active_buffer()
  32 {
  33     return opacity_buffer[active_bitmap_buffer&1];
  34 }
  35 
  36 char *camera_jpeg_count_str()
  37 {
  38     extern char jpeg_count_str[];
  39     return jpeg_count_str;
  40 }
  41 
  42 void shutdown()
  43 {
  44     // TODO:
  45     while (1)
  46         ;
  47 }
  48 
  49 #define LED_PR 0xd20b0994 // green LED on the back
  50 
  51 void debug_led(int state)
  52 {
  53     volatile long *p = (void*) LED_PR;
  54     *p = ((state) ? 0x4d0002 : 0x4c0003);
  55 }
  56 
  57 // Power Led = first entry in table (led 0)
  58 // AF Assist Lamp = second entry in table (led 1)
  59 void camera_set_led(int led, int state, int bright) {
  60     static char led_table[2] = { 0, 4 };
  61     _LEDDrive(led_table[led % sizeof(led_table)], state <= 1 ? !state : state);
  62 }
  63 
  64 void shutdown_soft()
  65 {
  66     _PostLogicalEventForNotPowerType(0x1005, 0);
  67 }
  68 
  69 int get_flash_params_count(void)
  70 {
  71     return 241;
  72 }
  73 
  74 void JogDial_CW(void)
  75 {
  76     _PostLogicalEventToUI(0x872, 1);    //RotateJogDialRight
  77 }
  78 
  79 void JogDial_CCW(void)
  80 {
  81     _PostLogicalEventToUI(0x873, 1);    //RotateJogDialLeft
  82 }
  83 
  84 // updated by using function in capt_seq, valid between shot start and raw hook end
  85 extern  char*   current_raw_addr;
  86 
  87 char *hook_raw_image_addr()
  88 {
  89     return current_raw_addr;
  90 }
  91 
  92 // TODO:
  93 //char *hook_alt_raw_image_addr()
  94 //{
  95 //}
  96 
  97 extern void* viewport_buffers[];
  98 extern void *current_viewport_buffer;
  99 
 100 void *vid_get_viewport_fb_d()
 101 {
 102     extern void *current_fb_d;
 103     return current_fb_d;
 104 }
 105 
 106 void *vid_get_viewport_fb()
 107 {
 108     return viewport_buffers[0];
 109 }
 110 
 111 void *vid_get_viewport_live_fb()
 112 {
 113     int i;
 114     for(i=0;i<4;i++) {
 115         if(current_viewport_buffer == viewport_buffers[i]) {
 116             return viewport_buffers[(i+1)&3];
 117         }
 118     }
 119     return 0;
 120 }
 121 
 122 int vid_get_viewport_width() {
 123     if (camera_info.state.mode_play)
 124     {
 125         return 720;
 126     }
 127     extern int _GetVRAMHPixelsSize();
 128     return _GetVRAMHPixelsSize();
 129 }
 130 
 131 long vid_get_viewport_height() {
 132     if (camera_info.state.mode_play)
 133     {
 134         return 480;
 135     }
 136     extern int _GetVRAMVPixelsSize();
 137     return _GetVRAMVPixelsSize();
 138 }
 139 
 140 int vid_get_viewport_byte_width()
 141 {
 142     return 736*2;     // buffer is 736 wide (720 image pixels) UYVY
 143 }
 144 
 145 // Functions for PTP Live View system
 146 int vid_get_viewport_display_xoffset_proper()   { return vid_get_viewport_display_xoffset(); }
 147 int vid_get_viewport_display_yoffset_proper()   { return vid_get_viewport_display_yoffset(); }
 148 int vid_get_viewport_fullscreen_width()         { return 720; }
 149 int vid_get_viewport_fullscreen_height()        { return 480; }
 150 int vid_get_viewport_buffer_width_proper()      { return 736; }
 151 int vid_get_viewport_type()                     { return LV_FB_YUV8B; }
 152 int vid_get_aspect_ratio()                      { return LV_ASPECT_3_2; }

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