root/platform/a2000/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. _GetBatteryTemperature

   1 #include "platform.h"
   2 #include "lolevel.h"
   3 
   4 #define LED_PR  0xc02200C4
   5 #define LED_RED 0xc02200C8
   6 #define LED_GRN 0xc02200CC
   7 #define LED_PWR 0xc02200D0
   8 
   9 void vid_bitmap_refresh()
  10 {
  11  extern int enabled_refresh_physical_screen;
  12  enabled_refresh_physical_screen=1;
  13  _RefreshPhysicalScreen(1);
  14 }
  15 
  16 
  17 void shutdown()
  18 {
  19 
  20 /*
  21 ROM:FFC0CD8C                 LDR     R1, =0xC0220000
  22 ROM:FFC0CD90                 MOV     R0, #0x44
  23 ROM:FFC0CD94                 STR     R0, [R1,#0x54]
  24 ROM:FFC0CD98                 STR     R0, [R1,#0x4C]
  25 
  26 
  27 C0220000+54+4C=0xC02200A0
  28 
  29 */
  30 
  31         volatile long *p = (void*)0xC02200A0;    
  32         
  33         asm(
  34                 "MRS     R1, CPSR\n"
  35                 "AND     R0, R1, #0x80\n"
  36                 "ORR     R1, R1, #0x80\n"
  37                 "MSR     CPSR_cf, R1\n"
  38                 :::"r1","r0");
  39         
  40         *p = 0x44;  // power off.
  41         
  42         while(1);
  43 }
  44 
  45 
  46 void debug_led(int state)
  47 {
  48  *(int*)LED_PR=state ? 0x46 : 0x44;
  49  *(int*)LED_GRN=state ? 0x46 : 0x44;
  50 }
  51 
  52 
  53 int get_flash_params_count(void){
  54  return 0x77; 
  55 }
  56 
  57 void camera_set_led(int led, int state, int bright) { 
  58         struct led_control led_c; 
  59         char convert_table[11]={0,1,2,3,0,2,3,1,8,10,10};  // s3 to a710 (and a720) convert table
  60 
  61         //char convert_table[6]={0,1,2,3,8,10};  // Test a720, values 0-5 are valid
  62 
  63         // 0 gr  
  64         // 1 red 
  65         // 2 yel 
  66         // 3 pw  
  67         // 8 dp  
  68         // 9 af  
  69 
  70         led_c.led_num=convert_table[led%11]; 
  71         led_c.action=state<=1 ? !state : state; 
  72         led_c.brightness=bright; 
  73         led_c.blink_count=255; 
  74         _PostLEDMessage(&led_c); 
  75 } 
  76 
  77 
  78 /*
  79 GetBatteryTemperature usually will get back temperature of battery compartment/batteries. GetBatteryTemperature is implemented in Canon's firmware for SX120IS.
  80 Firmware entry point is identified but function is not usable. 
  81 Camera will crash if Canon's GetBatteryTemperature is called by CHDK.
  82 To avoid a crash Canon's GetBatteryTemperature must not called. As long CHDK general code do not distinguish between cameras that support or don't support GetBatteryTemperature, 
  83 this function will be implemented as specific CHDK-code. It returns always with -99
  84 This overrides original canon entry point from stubs_entry.S
  85 */
  86 int _GetBatteryTemperature()
  87 {
  88       return -99;
  89 }
  90 

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