root/platform/ixus100_sd780/lib.c

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

DEFINITIONS

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

   1 #include "platform.h"
   2 #include "platform_palette.h"
   3 #include "lolevel.h"
   4 
   5 void vid_bitmap_refresh()
   6 {
   7         _ScreenLock();
   8     _RefreshPhysicalScreen(1);
   9 }
  10 
  11 void shutdown()
  12 {
  13     volatile long *p = (void*)0xc022001C; // from task_by (not really complete)
  14 
  15     asm(
  16          "MRS     R1, CPSR\n"
  17          "AND     R0, R1, #0x80\n"
  18          "ORR     R1, R1, #0x80\n"
  19          "MSR     CPSR_cf, R1\n"
  20          :::"r1","r0");
  21 
  22     *p = 0x44;
  23 
  24     while(1);
  25 }
  26 
  27 
  28 #define LED_PR 0xC0220128
  29 
  30 void debug_led(int state)
  31 {
  32     volatile long *p=(void*)LED_PR;
  33     if (state)
  34         p[0]=0x46;
  35     else
  36         p[0]=0x44;
  37 }
  38 
  39 int get_flash_params_count(void){
  40  return 120; // ? _sub_FF962AB8__PropertyTableManagerCore_c__6, similar to s5is
  41 }
  42 
  43 // based on SX10, values found by experiment
  44 void camera_set_led(int led, int state, int bright) {
  45  static char led_table[]={0, // green
  46                           1, // orange, right
  47                                                   2, // yellow, left
  48                                                   3, // power
  49                                                   // 4,5,6,7,
  50                                                   8, // blue
  51                                                   9 // af
  52                                                   };
  53  if((unsigned)led < sizeof(led_table))
  54   _LEDDrive(led_table[led], state<=1 ? !state : state);
  55 // _LEDDrive(led_table[led%sizeof(led_table)], state<=1 ? !state : state);
  56 }
  57 
  58 // from sx10
  59 void JogDial_CW(void){
  60  _PostLogicalEventForNotPowerType(0x874, 1);  // RotateJogDialRight
  61 }
  62 
  63 void JogDial_CCW(void){
  64  _PostLogicalEventForNotPowerType(0x875, 1);  // RotateJogDialLeft
  65 }
  66 
  67 
  68 void *vid_get_bitmap_active_palette()
  69 {
  70     extern int active_palette_buffer;
  71     extern char** palette_buffer_ptr;
  72     return palette_buffer_ptr[active_palette_buffer]+12;
  73 }
  74 
  75 void load_chdk_palette()
  76 {
  77     extern int active_palette_buffer;
  78 
  79     if ((active_palette_buffer == 0) || (active_palette_buffer == 1) || (active_palette_buffer == 5) || (active_palette_buffer == 7))
  80     {
  81         int *pal = (int*)vid_get_bitmap_active_palette();
  82         if (pal[CHDK_COLOR_BASE+0] != 0x33ADF62)
  83         {
  84             pal[CHDK_COLOR_BASE+0]  = 0x33ADF62;  // Red
  85             pal[CHDK_COLOR_BASE+1]  = 0x326EA40;  // Dark Red
  86             pal[CHDK_COLOR_BASE+2]  = 0x34CD57F;  // Light Red
  87             pal[CHDK_COLOR_BASE+3]  = 0x373BFAE;  // Green
  88             pal[CHDK_COLOR_BASE+4]  = 0x34BD6CA;  // Dark Green
  89             pal[CHDK_COLOR_BASE+5]  = 0x395AB95;  // Light Green
  90             pal[CHDK_COLOR_BASE+6]  = 0x34766F0;  // Blue
  91             pal[CHDK_COLOR_BASE+7]  = 0x31250F3;  // Dark Blue
  92             pal[CHDK_COLOR_BASE+8]  = 0x37F408F;  // Cyan
  93             pal[CHDK_COLOR_BASE+9]  = 0x3512D5B;  // Magenta
  94             pal[CHDK_COLOR_BASE+10] = 0x3A9A917;  // Yellow
  95             pal[CHDK_COLOR_BASE+11] = 0x3819137;  // Dark Yellow
  96             pal[CHDK_COLOR_BASE+12] = 0x3DED115;  // Light Yellow
  97             pal[CHDK_COLOR_BASE+13] = 0x0090000;  // Transparent dark grey
  98 
  99             vid_bitmap_refresh();
 100         }
 101     }
 102 }
 103 

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