root/platform/ixus95_sd1200/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. load_chdk_palette
  7. vid_get_palette_type
  8. vid_get_palette_size
  9. vid_get_bitmap_active_buffer
  10. vid_get_bitmap_active_palette

   1 #include "platform.h"
   2 #include "platform_palette.h"
   3 #include "lolevel.h"
   4 #include "sd1200_debug.h"
   5 
   6 void vid_bitmap_refresh()
   7 {
   8     _ScreenLock();
   9     _RefreshPhysicalScreen(1);
  10 }
  11 
  12 void shutdown()
  13 {
  14     volatile long *p = (void*)0xc022001C; // from task_by (not really complete)
  15 
  16     asm(
  17          "MRS     R1, CPSR\n"
  18          "AND     R0, R1, #0x80\n"
  19          "ORR     R1, R1, #0x80\n"
  20          "MSR     CPSR_cf, R1\n"
  21          :::"r1","r0");
  22 
  23     *p = 0x44;
  24 
  25     while(1);
  26 }
  27 
  28 int get_flash_params_count(void){
  29  return 0x7a;   // Found @0xffd1c038
  30 }
  31 
  32 
  33 // from  Microfunguy in
  34 // http://chdk.setepontos.com/index.php/topic,4324.msg55475.html#msg55475
  35 void camera_set_led(int led, int state, __attribute__ ((unused))int bright)
  36 {
  37    int leds[] = {0x134,0x138,0x134,0x130,0x134,0x3030,0x3030};  //  green=4 | (yellow) | (not used) | orange | (not used) | af beam | timer
  38    volatile long *p=(void*)0xc0220000 + leds[(led-4)%sizeof(leds)];
  39    if (state)
  40       p[0]=0x46;
  41    else
  42       p[0]=0x44;
  43 }
  44 
  45 #define DEBUG_LED LED_IO_Y
  46 void debug_led(int state)
  47 {
  48     * (int *) DEBUG_LED = state ? 0x46 : 0x44;
  49 }
  50 
  51 
  52 // Function to load CHDK custom colors into active Canon palette
  53 void load_chdk_palette() {
  54 
  55     extern int active_palette_buffer;
  56     // Only load for the standard record and playback palettes
  57     if ((active_palette_buffer == 0) || (active_palette_buffer == 1))
  58     {
  59         int *pal = (int*)vid_get_bitmap_active_palette();
  60         if (pal[CHDK_COLOR_BASE+0] != 0x33ADF62)
  61         {
  62             pal[CHDK_COLOR_BASE+0]  = 0x33ADF62;  // Red
  63             pal[CHDK_COLOR_BASE+1]  = 0x326EA40;  // Dark Red
  64             pal[CHDK_COLOR_BASE+2]  = 0x34CD57F;  // Light Red
  65             pal[CHDK_COLOR_BASE+3]  = 0x373BFAE;  // Green
  66             pal[CHDK_COLOR_BASE+4]  = 0x34BD6CA;  // Dark Green
  67             pal[CHDK_COLOR_BASE+5]  = 0x395AB95;  // Light Green
  68             pal[CHDK_COLOR_BASE+6]  = 0x34766F0;  // Blue
  69             pal[CHDK_COLOR_BASE+7]  = 0x31250F3;  // Dark Blue
  70             pal[CHDK_COLOR_BASE+8]  = 0x37F408F;  // Cyan
  71             pal[CHDK_COLOR_BASE+9]  = 0x3512D5B;  // Magenta
  72             pal[CHDK_COLOR_BASE+10] = 0x3A9A917;  // Yellow
  73             pal[CHDK_COLOR_BASE+11] = 0x3819137;  // Dark Yellow
  74             pal[CHDK_COLOR_BASE+12] = 0x3DED115;  // Light Yellow
  75             pal[CHDK_COLOR_BASE+13] = 0x0090000;  // Transparent dark grey
  76 
  77             vid_bitmap_refresh();
  78         }
  79     }
  80 }
  81 
  82 // PTP display stuff
  83 int vid_get_palette_type()                      { return 3; }
  84 int vid_get_palette_size()                      { return 256 * 4; }  //Found @ 0xffcadeb0 fw 100b
  85 
  86 void *vid_get_bitmap_active_buffer()
  87 {
  88     return (void*)(*(int*)(0x49d4+0x14)); // "Add: %p Width : %ld Hight : %ld", sub_ffcadf5c
  89 }
  90 
  91 
  92 void *vid_get_bitmap_active_palette()
  93 {
  94     extern int active_palette_buffer;
  95     extern char** palette_buffer_ptr;
  96     return (palette_buffer_ptr[active_palette_buffer]+16);
  97 }

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