root/platform/sx120is/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. get_flash_params_count
  6. JogDial_CW
  7. JogDial_CCW
  8. vid_get_palette_type
  9. vid_get_palette_size
  10. vid_get_bitmap_active_palette

   1 #include "platform.h"
   2 #include "lolevel.h"
   3 
   4 #define LED_AF          0xC022000C
   5 #define LED_ORANGE      0xC0220010
   6 #define LED_GREEN       0xC0220014
   7 
   8 
   9 extern int enabled_refresh_physical_screen;
  10 void vid_bitmap_refresh()
  11 {
  12     enabled_refresh_physical_screen=1;
  13         *(int*)0x829C=3;
  14         _RefreshPhysicalScreen(1);
  15         //_ScreenUnLock();
  16 }
  17 
  18 
  19 void shutdown()
  20 {
  21 
  22 /*
  23 ROM:FFC0CD8C                 LDR     R1, =0xC0220000
  24 ROM:FFC0CD90                 MOV     R0, #0x44
  25 ROM:FFC0CD94                 STR     R0, [R1,#0x54]
  26 ROM:FFC0CD98                 STR     R0, [R1,#0x4C]
  27 
  28 
  29 C0220000+54+4C=0xC02200A0
  30 
  31 */
  32 
  33         volatile long *p = (void*)0xC02200A0;    
  34         
  35         asm(
  36                 "MRS     R1, CPSR\n"
  37                 "AND     R0, R1, #0x80\n"
  38                 "ORR     R1, R1, #0x80\n"
  39                 "MSR     CPSR_cf, R1\n"
  40                 :::"r1","r0");
  41         
  42         *p = 0x44;  // power off.
  43         
  44         while(1);
  45 }
  46 
  47 
  48 void debug_led(int state)
  49 {
  50 // *(int*)LED_AF=state ? 0x46 : 0x44;
  51  *(int*)LED_GREEN=state ? 0x46 : 0x44;
  52 }
  53 
  54 void camera_set_led(int led, int state, __attribute__ ((unused))int bright) {
  55  static char led_table[5]={0,1,9,10,11};
  56  _LEDDrive(led_table[led%sizeof(led_table)], state<=1 ? !state : state);
  57 }
  58 
  59 int get_flash_params_count(void){
  60  return 132;    // at 0xFFD39830, DebugAssert if param_id >= 132
  61 }
  62 
  63 void JogDial_CW(void){
  64  _PostLogicalEventForNotPowerType(0x876, 1);  // RotateJogDialRight
  65 }
  66 
  67 void JogDial_CCW(void){
  68  _PostLogicalEventForNotPowerType(0x877, 1);  // RotateJogDialLeft
  69 }
  70 
  71 // Functions for PTP Live View system
  72 int vid_get_palette_type()                      { return 3 ; }
  73 int vid_get_palette_size()                      { return 256 * 4 ; }
  74 
  75 void *vid_get_bitmap_active_palette()
  76 {
  77     extern int active_palette_buffer;
  78     extern char** palette_buffer_ptr;
  79     return palette_buffer_ptr[active_palette_buffer]+8;
  80 }

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