root/platform/a2100/lib.c

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

DEFINITIONS

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

   1 /*
   2 ###########################################################
   3 ###########################################################
   4 #############[ FINISHED ] #################################
   5 ###########################################################
   6 ###########################################################
   7 */ 
   8 
   9 #include "platform.h"
  10 #include "lolevel.h"
  11 
  12 void vid_bitmap_refresh()    // G10 : ixus980_sd990 version seems to work well
  13 {
  14         _ScreenLock();
  15     _RefreshPhysicalScreen(1);
  16 }
  17 
  18 // converted to A2100
  19 void shutdown()    // G10 sub_FF829EC8
  20 {
  21         volatile long *p = (void*)0xC0220084;    // G10 @ 0xFF829EE4,0xFF829EE8 & 0xFF829EEC 
  22                                                                                         // A2100IS: C0220000 + 84 @0xFFC18434
  23         
  24         asm(
  25                 "MRS     R1, CPSR\n"
  26                 "AND     R0, R1, #0x80\n"
  27                 "ORR     R1, R1, #0x80\n"
  28                 "MSR     CPSR_cf, R1\n"
  29                 :::"r1","r0");
  30         
  31         *p = 0x44;  // power off.
  32         
  33         while(1);
  34 }
  35 
  36 
  37 void debug_led(int state)
  38 {
  39 #define LED_AF 0xC022000C               // A2100IS Red - AutoFocus led
  40   *(int*)LED_AF=state ? 0x46 : 0x44;
  41 }
  42 
  43 /*
  44 // G10 has 8 led values - tested with uBasic  set_led n, 1   (no brightness control implemented)
  45 // #  Index   LED
  46 // 1   0      Upper indicator Green
  47 // 2   1      Upper indicator Orange
  48 // 3   2      Lower indicator Yellow
  49 // 4   3      Power LED Green
  50 // 5   8      Blue print button LED
  51 // 6   9      AF Assist Lamp
  52 //     10     "
  53 //     11     "
  54 // 7   14     ISO LED
  55 // 8   15     EV LED
  56 */
  57 // converted to A2100
  58 void camera_set_led(int led, int state, __attribute__ ((unused))int bright) {
  59  static char led_table[3]={3,8,9};
  60  _LEDDrive(led_table[led%sizeof(led_table)], state<=1 ? !state : state);
  61 }
  62 
  63 // int get_flash_params_count(void){
  64  // return 0x78 ;               // G10 per SD990 & finsig2 - _sub_FF971C10__PropertyTableManagerCore.c__6 value at 0xff971c50 in 1.02a
  65  // // found in GetParameterData
  66 // }
  67 
  68 // Viewport and Bitmap values that shouldn't change across firmware versions.
  69 // Values that may change are in lib.c for each firmware version.
  70 
  71 int vid_get_viewport_width()
  72 {
  73         return 360 ;   //  G10
  74 }
  75 
  76 long vid_get_viewport_height()
  77 {
  78    return 240;    //  G10
  79 }
  80 
  81 //1024 entry palette based on 100a ffcad26c
  82 int vid_get_palette_type()                      { return 3; }
  83 int vid_get_palette_size()                      { return 256 * 4; }
  84 
  85 void *vid_get_bitmap_active_buffer()
  86 {
  87     return (void*)(*(int*)(0x49a8+0x28)); //100a: sub_ffcad26c, via sub_ffd672b4 two refs to "Palette Class."
  88 }
  89 
  90 
  91 void *vid_get_bitmap_active_palette()
  92 {
  93     extern int active_palette_buffer;
  94     extern char* palette_buffer_ptr[];
  95     return (palette_buffer_ptr[active_palette_buffer]+12);
  96 }
  97 

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