root/platform/a3300/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. load_chdk_palette
  9. vid_get_palette_type
  10. 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, __attribute__ ((unused))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 @0xff994830  a3300is
  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     void* p = palette_buffer[active_palette_buffer];
  49     // Don't add offset if value is 0
  50     if (p) p += 8;
  51     return p;
  52 }
  53 
  54 #ifdef CAM_LOAD_CUSTOM_COLORS
  55 // Function to load CHDK custom colors into active Canon palette
  56 void load_chdk_palette() {
  57         
  58         extern int active_palette_buffer;
  59         // Only load for the standard record and playback palettes
  60         if ((active_palette_buffer == 0) || (active_palette_buffer == 4))
  61         {
  62                 int *pal = (int*)vid_get_bitmap_active_palette();
  63                 if (pal && pal[CHDK_COLOR_BASE+0] != 0x33ADF62)   // see if CHDK palette already loaded -- if not, load it
  64                 {
  65             pal[CHDK_COLOR_BASE+0]  = 0x33ADF62;  // Red
  66                         pal[CHDK_COLOR_BASE+1]  = 0x326EA40;  // Dark Red
  67                         pal[CHDK_COLOR_BASE+2]  = 0x34CD57F;  // Light Red
  68                         pal[CHDK_COLOR_BASE+3]  = 0x373BFAE;  // Green
  69                         pal[CHDK_COLOR_BASE+4]  = 0x34BD6CA;  // Dark Green
  70                         pal[CHDK_COLOR_BASE+5]  = 0x395AB95;  // Light Green
  71                         pal[CHDK_COLOR_BASE+6]  = 0x34766F0;  // Blue
  72                         pal[CHDK_COLOR_BASE+7]  = 0x31250F3;  // Dark Blue
  73                         pal[CHDK_COLOR_BASE+8]  = 0x37F408F;  // Cyan
  74                         pal[CHDK_COLOR_BASE+9]  = 0x3512D5B;  // Magenta
  75                         pal[CHDK_COLOR_BASE+10] = 0x3A9A917;  // Yellow
  76                         pal[CHDK_COLOR_BASE+11] = 0x3819137;  // Dark Yellow
  77                         pal[CHDK_COLOR_BASE+12] = 0x3DED115;  // Light Yellow
  78             pal[CHDK_COLOR_BASE+13] = 0x0090000;  // Transparent dark grey
  79                         
  80                         extern char palette_control;
  81                         palette_control = 1;
  82                         vid_bitmap_refresh();
  83         }
  84     }
  85 }
  86 #endif
  87 
  88 int vid_get_palette_type()                      { return 3; }
  89 int vid_get_palette_size()                      { return 256 * 4; }

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