root/platform/a3200/lib.c

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

DEFINITIONS

This source file includes following definitions.
  1. shutdown
  2. debug_led
  3. camera_set_led
  4. get_flash_params_count
  5. vid_get_viewport_height
  6. vid_bitmap_refresh
  7. vid_get_bitmap_active_palette
  8. vid_get_viewport_fb
  9. vid_get_viewport_live_fb
  10. load_chdk_palette
  11. vid_get_palette_type
  12. vid_get_palette_size

   1 #include "platform.h"
   2 #include "platform_palette.h"
   3 #include "lolevel.h"
   4 
   5 void shutdown() // method taken from the ixus140_elph130 port
   6 {
   7     extern void _TurnOffE1(void);
   8     _TurnOffE1();
   9     while(1);
  10 }
  11 
  12 #define LED_PR 0xC02200F0
  13 
  14 
  15 void debug_led(int state)
  16 {
  17  *(int*)LED_PR=state ? 0x46 : 0x44;
  18 }
  19 
  20 void camera_set_led(int led, int state, int bright) {
  21  static char led_table[2]={0,9};
  22  _LEDDrive(led_table[led%sizeof(led_table)], state<=1 ? !state : state);
  23 }
  24 
  25 int get_flash_params_count(void){
  26  return 0xa0;   // Found @0xff9941e4
  27 }
  28 
  29 long vid_get_viewport_height()
  30 {
  31         return 240;
  32 }
  33 
  34 void vid_bitmap_refresh() {
  35         
  36         extern int full_screen_refresh;
  37         extern void _ScreenUnlock();
  38         extern void _ScreenLock();
  39 
  40         full_screen_refresh |= 3;
  41         _ScreenLock();
  42         _ScreenUnlock();
  43 }
  44 
  45 void *vid_get_bitmap_active_palette() {
  46         extern int active_palette_buffer;
  47         extern char* palette_buffer[];
  48         return (palette_buffer[active_palette_buffer]+8);
  49 }
  50 
  51 extern char active_viewport_buffer;
  52 extern void* viewport_buffers[];
  53 
  54 void *vid_get_viewport_fb()
  55 {
  56     // Return first viewport buffer - for case when vid_get_viewport_live_fb not defined
  57     return viewport_buffers[0];
  58 }
  59 
  60 void *vid_get_viewport_live_fb()
  61 {
  62     if (camera_info.state.mode_video)
  63         return viewport_buffers[0];     // Video only seems to use the first viewport buffer.
  64 
  65    // Hopefully return the most recently used viewport buffer
  66     return viewport_buffers[(active_viewport_buffer-1)&3];
  67 }
  68 
  69 #ifdef CAM_LOAD_CUSTOM_COLORS
  70 // Function to load CHDK custom colors into active Canon palette
  71  
  72 void load_chdk_palette() {
  73 
  74     extern int active_palette_buffer;
  75     // Only load for the standard record (0) and playback (4) palettes
  76     if ((active_palette_buffer == 0) || (active_palette_buffer == 4))
  77     {
  78         int *pal = (int*)vid_get_bitmap_active_palette();
  79         if (pal[CHDK_COLOR_BASE+0] != 0x33ADF62)
  80         {
  81             pal[CHDK_COLOR_BASE+0]  = 0x33ADF62;  // Red
  82             pal[CHDK_COLOR_BASE+1]  = 0x326EA40;  // Dark Red
  83             pal[CHDK_COLOR_BASE+2]  = 0x34CD57F;  // Light Red
  84             pal[CHDK_COLOR_BASE+3]  = 0x373BFAE;  // Green
  85             pal[CHDK_COLOR_BASE+4]  = 0x34BD6CA;  // Dark Green
  86             pal[CHDK_COLOR_BASE+5]  = 0x395AB95;  // Light Green
  87             pal[CHDK_COLOR_BASE+6]  = 0x34766F0;  // Blue
  88             pal[CHDK_COLOR_BASE+7]  = 0x31250F3;  // Dark Blue
  89             pal[CHDK_COLOR_BASE+8]  = 0x37F408F;  // Cyan
  90             pal[CHDK_COLOR_BASE+9]  = 0x3512D5B;  // Magenta
  91             pal[CHDK_COLOR_BASE+10] = 0x3A9A917;  // Yellow
  92             pal[CHDK_COLOR_BASE+11] = 0x3819137;  // Dark Yellow
  93             pal[CHDK_COLOR_BASE+12] = 0x3DED115;  // Light Yellow
  94             pal[CHDK_COLOR_BASE+13] = 0x0090000;  // Transparent dark grey
  95 
  96             extern char palette_control;
  97             palette_control = 1;
  98             vid_bitmap_refresh();
  99         }
 100 
 101 /*          // completely transparent palette for special use
 102             int n;
 103             if (pal[0] != 0) {
 104                 for (n=0; n<256; n++) {
 105                     pal[n] = 0;
 106                 }
 107                 extern char palette_control;
 108                 palette_control = 1;
 109                 vid_bitmap_refresh();
 110             }
 111 */
 112     }
 113 }
 114 #endif
 115 
 116 int vid_get_palette_type()                      { return 3; }
 117 int vid_get_palette_size()                      { return 256 * 4; }

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