root/platform/sx20/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. JogDial_CW
  7. JogDial_CCW
  8. vid_get_viewport_live_fb
  9. vid_get_palette_type
  10. vid_get_palette_size
  11. vid_get_bitmap_active_palette

   1 #include "platform.h"
   2 #include "lolevel.h"
   3 
   4 void vid_bitmap_refresh()
   5 {
   6         extern int enabled_refresh_physical_screen;
   7         extern int full_screen_refresh;
   8 
   9         // i've tried refreshphysical screen (screen unlock) and that caused the canon and
  10         // function menu to not display at all. This seems to work and is called in a similar
  11         // way in other places where original OSD should be refreshed.
  12         extern void _ScreenLock();
  13         extern void _ScreenUnlock();
  14 
  15         _ScreenLock();
  16 
  17         enabled_refresh_physical_screen=1;
  18         full_screen_refresh=3; //found in ScreenUnlock underneath a CameraLog.c call sub_FFA02598
  19 
  20         _ScreenUnlock();
  21 }
  22 
  23 
  24 void shutdown()
  25 {
  26         volatile long *p = (void*)0xC022001C;    
  27         
  28         asm(
  29                 "MRS     R1, CPSR\n"
  30                 "AND     R0, R1, #0x80\n"
  31                 "ORR     R1, R1, #0x80\n"
  32                 "MSR     CPSR_cf, R1\n"
  33                 :::"r1","r0");
  34         
  35         *p = 0x44;  // power off.
  36         
  37         while(1);
  38 }
  39 
  40 #define LED_PR 0xC02200B6  // tally
  41 
  42 void debug_led(__attribute__ ((unused))int state)
  43 {
  44  //*(int*)LED_PR=state ? 0x46 : 0x44;
  45 }
  46 
  47 void camera_set_led(int led, int state, __attribute__ ((unused))int bright) {
  48  static char led_table[5]={4,5,7,8,9};
  49  _LEDDrive(led_table[led%sizeof(led_table)], state<=1 ? !state : state);
  50 }
  51 
  52 int get_flash_params_count(void){
  53  return 120; 
  54 }
  55 
  56 void JogDial_CW(void){
  57         _PostLogicalEventToUI(0x876, 1);  // RotateJogDialRight
  58 }
  59 
  60 void JogDial_CCW(void){
  61         _PostLogicalEventToUI(0x877, 1);  // RotateJogDialLeft
  62 }
  63 
  64 void *vid_get_viewport_live_fb() // found in sub_FF84DDB8
  65 {
  66   void **fb=(void **)0x222C;
  67   unsigned char buff = *((unsigned char*)0x206C);
  68   if (buff == 0) buff = 2;  else buff--;    
  69   return fb[buff];
  70 }
  71 
  72 //TODO
  73 // Functions for PTP Live View system
  74 int vid_get_palette_type()                      { return 3 ; }
  75 int vid_get_palette_size()                      { return 256 * 4 ; }
  76 
  77 void *vid_get_bitmap_active_palette()
  78 {
  79     extern int active_palette_buffer;
  80     extern char** palette_buffer_ptr;
  81     return palette_buffer_ptr[active_palette_buffer]+8;
  82 }

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