root/platform/sx150is/lib.c

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

DEFINITIONS

This source file includes following definitions.
  1. debug_led
  2. vid_bitmap_refresh
  3. shutdown
  4. camera_set_led
  5. get_flash_params_count
  6. JogDial_CW
  7. JogDial_CCW
  8. vid_get_palette_type
  9. vid_get_palette_size
  10. vid_get_bitmap_active_buffer
  11. vid_get_bitmap_active_palette

   1 /*
   2 *********************
   3 SX150IS
   4 ********************** 
   5 */
   6 
   7 /*
   8 SX150
   9 LED address:
  10 orange 0xC0220010
  11 AF      0xC022000C
  12 */
  13 #define LED_AF          0xC022000C
  14 #define LED_GREEN       0xC0220014
  15 
  16 #define LED_ON          *((long*) LED_GREEN) = 0x46
  17 #define LED_OFF         *((long*) LED_GREEN) = 0x44
  18 
  19 void debug_led(int state)
  20 {
  21     if (state)
  22                 LED_ON;
  23     else
  24                 LED_OFF;
  25 } 
  26 
  27 #include "platform.h"
  28 #include "lolevel.h"
  29 
  30 /*
  31 void vid_bitmap_refresh()
  32 {
  33          extern int enabled_refresh_physical_screen; // screen lock counter
  34          extern void _ScreenUnlock();
  35 
  36 //     _LockAndRefresh();
  37          _ScreenLock();
  38         enabled_refresh_physical_screen=1;
  39 //      full_screen_refresh=3; //found in ScreenUnlock underneath a CameraLog.c call sub_FFA02598       //sx210
  40         _ScreenUnlock();
  41 //      _UnlockAndRefresh();    
  42 }
  43 */
  44 
  45 // Testing another refresh method
  46 void vid_bitmap_refresh()
  47 {
  48         extern int enabled_refresh_physical_screen;
  49         extern int full_screen_refresh;
  50 
  51         // i've tried refreshphysical screen (screen unlock) and that caused the canon and
  52         // function menu to not display at all. This seems to work and is called in a similar
  53         // way in other places where original OSD should be refreshed.
  54         extern void _LockAndRefresh(); // wrapper function for screen lock
  55         extern void _UnlockAndRefresh(); // wrapper function for screen unlock
  56 
  57         _LockAndRefresh();
  58 
  59         enabled_refresh_physical_screen=1;
  60         full_screen_refresh |= 3; 
  61 
  62         _UnlockAndRefresh();
  63 }
  64 
  65 void shutdown()
  66 {
  67         volatile long *p = (void*)0xC022001C;    
  68         
  69         asm(
  70                 "MRS     R1, CPSR\n"
  71                 "AND     R0, R1, #0x80\n"
  72                 "ORR     R1, R1, #0x80\n"
  73                 "MSR     CPSR_cf, R1\n"
  74                 :::"r1","r0");
  75         
  76         *p = 0x44;  // power off.
  77         
  78         while(1);
  79 }
  80 
  81 
  82 /*
  83 7 = green indicator
  84 9 = AF
  85 */
  86 void camera_set_led(int led, int state, int bright) {
  87  static char led_table[]={7,9};
  88  _LEDDrive(led_table[led%sizeof(led_table)], state<=1 ? !state : state);
  89 }
  90 
  91 int get_flash_params_count(void){
  92  return 0x9f; 
  93 }
  94 
  95 void JogDial_CW(void){
  96  _PostLogicalEventForNotPowerType(0x874, 2);  // RotateJogDialRight
  97 }
  98 
  99 void JogDial_CCW(void){
 100  _PostLogicalEventForNotPowerType(0x875, 2);  // RotateJogDialLeft
 101 }
 102 
 103 
 104 // Functions for PTP Live View system
 105 int vid_get_palette_type()                      { return 3; }
 106 int vid_get_palette_size()                      { return 256 * 4; }
 107 
 108 void *vid_get_bitmap_active_buffer()
 109 {
 110     extern int active_bitmap_buffer;
 111     extern char* bitmap_buffer[];
 112     return bitmap_buffer[active_bitmap_buffer];
 113 }
 114 
 115 void *vid_get_bitmap_active_palette()
 116 {
 117     extern int active_palette_buffer;
 118     extern char* palette_buffer[];
 119     return (palette_buffer[active_palette_buffer]+8);
 120 }

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