root/platform/ixus220_elph300hs/lib.c

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

DEFINITIONS

This source file includes following definitions.
  1. vid_bitmap_refresh
  2. shutdown
  3. debug_led
  4. camera_set_led
  5. get_flash_params_count
  6. vid_get_viewport_width
  7. vid_get_viewport_xoffset
  8. vid_get_viewport_height
  9. vid_get_viewport_yoffset
  10. vid_get_palette_type
  11. vid_get_palette_size
  12. vid_get_bitmap_active_palette
  13. vid_get_bitmap_active_buffer

   1 #include "platform.h"
   2 #include "lolevel.h"
   3 
   4 void vid_bitmap_refresh()
   5 {
   6         extern int full_screen_refresh;
   7         extern void _ScreenLock(); // wrapper function for screen lock
   8         extern void _ScreenUnlock(); // wrapper function for screen unlock
   9 
  10         full_screen_refresh |= 3; //found in ScreenUnlock
  11         _ScreenLock();  
  12         _ScreenUnlock();
  13 }
  14 
  15 
  16 void shutdown()
  17 {
  18         volatile long *p = (void*)0xC022001C;
  19 
  20         asm(
  21                 "MRS     R1, CPSR\n"
  22                 "AND     R0, R1, #0x80\n"
  23                 "ORR     R1, R1, #0x80\n"
  24                 "MSR     CPSR_cf, R1\n"
  25                 :::"r1","r0");
  26 
  27         *p = 0x44;  // power off.
  28 
  29         while(1);
  30 }
  31 
  32 #define LED_PR 0xC0220130
  33 
  34 
  35 void debug_led(int state)
  36 {
  37  *(int*)LED_PR=state ? 0x46 : 0x44;
  38 }
  39 
  40 
  41 
  42 
  43 void camera_set_led(int led, int state, int bright) {
  44  static char led_table[2]={0,9};
  45  _LEDDrive(led_table[led%sizeof(led_table)], state<=1 ? !state : state);
  46 }
  47 
  48 int get_flash_params_count(void){
  49  return 0xA0;  //@FF1B33A0 in GetParameterData
  50 }
  51 
  52 // Viewport and Bitmap values that shouldn't change across firmware versions.
  53 // Values that may change are in lib.c for each firmware version.
  54 
  55 int vid_get_viewport_width()
  56 {
  57         // viewport width table for each image size
  58         // 0 = 4:3, 1 = 16:9, 2 = 3:2, 3 = 1:1
  59         static long vp_w[5] = { 360, 360, 360, 272 };
  60         return vp_w[shooting_get_prop(PROPCASE_ASPECT_RATIO)];
  61 }
  62 
  63 int vid_get_viewport_xoffset()
  64 {
  65         // viewport width offset table for each image size
  66         // 0 = 4:3, 1 = 16:9, 2 = 3:2, 3 = 1:1
  67         static long vp_w[5] = { 0, 0, 0, 44 };                          // should all be even values for edge overlay
  68         return vp_w[shooting_get_prop(PROPCASE_ASPECT_RATIO)];
  69 }
  70 
  71 long vid_get_viewport_height()
  72 {
  73         // viewport height table for each image size
  74         // 0 = 4:3, 1 = 16:9, 2 = 3:2, 3 = 1:1
  75         static long vp_h[5] = { 240, 180, 214, 240 };
  76         return vp_h[shooting_get_prop(PROPCASE_ASPECT_RATIO)];
  77 }
  78 
  79 int vid_get_viewport_yoffset()
  80 {
  81         // viewport height offset table for each image size
  82         // 0 = 4:3, 1 = 16:9, 2 = 3:2, 3 = 1:1
  83         static long vp_h[5] = { 0, 30, 13, 0 };
  84         return vp_h[shooting_get_prop(PROPCASE_ASPECT_RATIO)];
  85 }
  86 
  87 
  88 // Functions for PTP Live View system
  89 // 256 entry palette based on 100c @ 0xff929a6c
  90 int vid_get_palette_type()                      { return 3; }
  91 int vid_get_palette_size()                      { return 256 * 4; }
  92 
  93 void *vid_get_bitmap_active_palette() {
  94         extern int active_palette_buffer;
  95         extern char* palette_buffer[];
  96         return (palette_buffer[active_palette_buffer]+8);
  97 }
  98 
  99 extern int active_bitmap_buffer;
 100 extern char* bitmap_buffer[];
 101 
 102 void *vid_get_bitmap_active_buffer() {
 103     return bitmap_buffer[active_bitmap_buffer];
 104 }

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