root/platform/a3100/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_bitmap_refresh
  6. vid_get_viewport_live_fb
  7. vid_get_bitmap_active_palette
  8. vid_get_palette_type
  9. vid_get_palette_size
  10. vid_get_bitmap_active_buffer

   1 #include "platform.h"
   2 #include "lolevel.h"
   3 
   4 void shutdown()
   5 {
   6     volatile long *p = (void*)0xC0220010;
   7     
   8     asm(
   9          "MRS     R1, CPSR\n"
  10          "AND     R0, R1, #0x80\n"
  11          "ORR     R1, R1, #0x80\n"
  12          "MSR     CPSR_cf, R1\n"
  13          :::"r1","r0");
  14         
  15     *p = 0x44;
  16 
  17     while(1);
  18 }
  19 
  20 
  21 #define LED_PR 0xC0220010
  22 
  23 void debug_led(int state)
  24 {
  25     volatile long *p=(void*)LED_PR;
  26     if (state)
  27         p[0]=0x46;
  28     else
  29         p[0]=0x44;
  30 }
  31 
  32 /*
  33 M:FFC24CDC sub_FFC24CDC                            ; CODE XREF: sub_FFC24E54+48
  34 ROM:FFC24CDC                                         ; DATA XREF: sub_FFC24E54+34
  35 ROM:FFC24CDC                 STMFD   SP!, {R4,LR}
  36 ROM:FFC24CE0                 MOV     R1, #0
  37 ROM:FFC24CE4                 MOV     R0, #4
  38 ROM:FFC24CE8                 BL      LEDDrive
  39 ROM:FFC24CEC                 MOV     R1, #0
  40 ROM:FFC24CF0                 MOV     R0, #2
  41 ROM:FFC24CF4                 BL      LEDDrive
  42 ROM:FFC24CF8                 MOV     R1, #0
  43 ROM:FFC24CFC                 MOV     R0, #0
  44 ROM:FFC24D00                 BL      LEDDrive
  45 ROM:FFC24D04                 MOV     R1, #0
  46 ROM:FFC24D08                 MOV     R0, #7
  47 ROM:FFC24D0C                 BL      LEDDrive
  48 ROM:FFC24D10                 LDMFD   SP!, {R4,LR}
  49 ROM:FFC24D14                 MOV     R1, #0
  50 ROM:FFC24D18                 MOV     R0, #8
  51 ROM:FFC24D1C                 B       LEDDrive
  52 ROM:FFC24D1C ; End of function sub_FFC24CDC
  53 
  54 */
  55 #define LED_BASE 0xc0220000
  56 
  57 void camera_set_led(int led, int state, int bright)
  58 
  59 {
  60   int leds[] = {16,0,5,4,0,9,0}; // power, backlight bright, backlight normal, af assist
  61   if(led < 4 || led > 10) return;
  62   led -= 4;
  63   if (leds[led])
  64   {
  65     volatile long *p=(void*)LED_BASE + leds[led];
  66     if (state)
  67         p[0]=0x46;
  68     else
  69         p[0]=0x44;
  70   }
  71 }
  72 
  73 
  74 /*void camera_set_led(int led, int state, int bright) {
  75         
  76         static char led_table[10]={0,9};
  77         _LEDDrive(led_table[led%sizeof(led_table)], state<=1 ? !state : state);
  78 }*/
  79 
  80 
  81 int get_flash_params_count(void){
  82 /*
  83 ROM:FFD36E08                 BIC     R4, R4, #0x4000
  84 ROM:FFD36E0C                 CMP     R4, #0x94
  85 ROM:FFD36E10                 LDRCS   R0, =aPropertytablem ; "PropertyTableManagerCore.c"
  86 */
  87  return 0x94;
  88 }
  89 void vid_bitmap_refresh() {
  90     extern int enabled_refresh_physical_screen;
  91     extern int full_screen_refresh;
  92 
  93     // asm1989: i've tried refreshphysical screen (screen unlock) and that caused the canon and
  94     // function menu to not display at all. This seems to work and is called in a similar
  95     // way in other places where original OSD should be refreshed.
  96     extern void _ScreenLock();
  97     extern void _ScreenUnlock();
  98 
  99     _ScreenLock();
 100 
 101     enabled_refresh_physical_screen=1;
 102     full_screen_refresh=3;   // found in ScreenUnlock underneath a CameraLog.c call
 103 
 104     _ScreenUnlock();
 105 }
 106 
 107 // Defined in stubs_min.S
 108 extern char active_viewport_buffer;
 109 extern void* viewport_buffers[];
 110 
 111 // Live picture buffer (shoot not pressed)
 112 void *vid_get_viewport_live_fb()
 113 {
 114     unsigned char buff = (unsigned char) active_viewport_buffer;
 115     if (buff == 0) buff = 2;  else buff--;
 116     return viewport_buffers[buff];
 117 }
 118 
 119 // Functions for PTP Live View system
 120 
 121 void *vid_get_bitmap_active_palette() {
 122         return (void*)(*(int*)(0x4c18+0x20));  //Found @ 0xff8ebce8 a3100 100a
 123 }
 124 
 125 // 64 entry palette based on 100a 0xff8ebce8
 126 int vid_get_palette_type()                      { return 4; }
 127 int vid_get_palette_size()                      { return 16*4; }
 128 
 129 void *vid_get_bitmap_active_buffer()
 130 {
 131     return (void*)(*(int*)(0x4c18+0xC)); //found @ 0xff8ebda4 a3100 100a
 132 }

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