root/platform/ixus130_sd1400/lib.c

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

DEFINITIONS

This source file includes following definitions.
  1. vid_bitmap_refresh
  2. shutdown
  3. get_flash_params_count
  4. camera_set_led
  5. debug_led
  6. JogDial_CW
  7. JogDial_CCW
  8. vid_get_viewport_fb
  9. vid_get_viewport_live_fb
  10. vid_get_viewport_fb_d
  11. vid_get_bitmap_fb
  12. vid_get_palette_type
  13. vid_get_palette_size
  14. vid_get_bitmap_active_buffer
  15. vid_get_bitmap_active_palette

   1 #include "platform.h"
   2 #include "lolevel.h"
   3 
   4 #define LED_IO_G 0xC0220130
   5 #define LED_IO_R 0xC0220134
   6 #define LED_IO_Y 0xC0220134
   7 #define LED_AF   0xC0223030
   8 
   9 
  10 // Force Screen to refresh like original Firmware
  11 // from SX210, thanks asm1989
  12 void vid_bitmap_refresh() {
  13     extern int enabled_refresh_physical_screen;
  14     extern int full_screen_refresh;
  15  
  16     // asm1989: i've tried refreshphysical screen (screen unlock) and that caused the canon and
  17     // function menu to not display at all. This seems to work and is called in a similar
  18     // way in other places where original OSD should be refreshed.
  19     extern void _ScreenLock();
  20     extern void _ScreenUnlock();
  21 
  22     _ScreenLock();
  23  
  24     enabled_refresh_physical_screen=1;
  25     full_screen_refresh=3;   // found in ScreenUnlock underneath a CameraLog.c call
  26  
  27     _ScreenUnlock();
  28 }
  29 
  30 void shutdown() {
  31   volatile long *p = (void*)0xc022001C; // from task_by (not really complete)
  32 
  33   asm(
  34     "MRS     R1, CPSR\n"
  35     "AND     R0, R1, #0x80\n"
  36     "ORR     R1, R1, #0x80\n"
  37     "MSR     CPSR_cf, R1\n"
  38     :::"r1","r0");
  39 
  40   *p = 0x44;
  41 
  42   while (1) {
  43     asm volatile ("nop\n");
  44   }
  45 }
  46 
  47 int get_flash_params_count(void) { return 0x94; }                          // Found @0xff986190
  48 
  49 // based on SX10, values found by experiment
  50 void camera_set_led(int led, int state, __attribute__ ((unused))int bright) {
  51   return; // doesn't seem to work
  52   static char led_table[]={0, // green
  53                            1, // orange, right
  54                            2, // yellow, left
  55                            3, // power
  56                            // 4,5,6,7,
  57                            8, // blue
  58                            9 // af
  59   };
  60   if ((unsigned)led < sizeof(led_table)) {
  61     _LEDDrive(led_table[led], state<=1 ? !state : state);
  62   }
  63 }
  64 
  65 #define DEBUG_LED LED_IO_Y
  66 void debug_led(int state)
  67 {
  68     * (int *) DEBUG_LED = state ? 0x46 : 0x44;
  69 }
  70 
  71 // from sx10
  72 void JogDial_CW(void){
  73   //_PostLogicalEventForNotPowerType(0x874, 2);  // RotateJogDialRight
  74 }
  75 
  76 void JogDial_CCW(void){
  77   //_PostLogicalEventForNotPowerType(0x875, 2);  // RotateJogDialLeft
  78 }
  79 
  80 // Viewport and Bitmap values that shouldn't change across firmware versions.
  81 // Values that may change are in lib.c for each firmware version.
  82 
  83 // Defined in stubs_min.S
  84 extern char active_viewport_buffer;
  85 extern void* viewport_buffers[];
  86 
  87 void *vid_get_viewport_fb()
  88 {
  89     // Return first viewport buffer - for case when vid_get_viewport_live_fb not defined
  90     return viewport_buffers[0];
  91 }
  92 
  93 void *vid_get_viewport_live_fb()
  94 {
  95     if (camera_info.state.mode_video)
  96         return viewport_buffers[0];     // Video only seems to use the first viewport buffer.
  97 
  98     // Hopefully return the most recently used viewport buffer so that motion detect, histogram, zebra and edge overly are using current image data
  99     return viewport_buffers[(active_viewport_buffer)&3];
 100 }
 101 
 102 void *vid_get_viewport_fb_d()
 103 {
 104     extern char *viewport_fb_d;
 105         return viewport_fb_d;
 106 }
 107 
 108 void *vid_get_bitmap_fb()
 109 {
 110     return (void*)0x40431000;               // Found @0xff859828
 111 }
 112 
 113 
 114 // Functions for PTP Live View system
 115 // 256 entry palette based on 100a
 116 // sub_ff90ce84  <- Called for a function with 2 ref to **"Palette Class.
 117 int vid_get_palette_type()                      { return 3; }
 118 int vid_get_palette_size()                      { return 256 * 4; }
 119 
 120 void *vid_get_bitmap_active_buffer()
 121 {   //found @loc_ff90cf28 ixus130 100a ->Called before *"..<GetBmpVramInfo> Add
 122     return (void*)(*(int*)(0x556C+0x18)); 
 123 }
 124 
 125 void *vid_get_bitmap_active_palette() {
 126         return (void*)(*(int*)(0x556C+0x2C));  //Found @ 0xff90ce84 ixus130 100a
 127 }

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