root/platform/a800/lib.c

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

DEFINITIONS

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

   1 #include "platform.h"
   2 #include "lolevel.h"
   3 
   4 // only two LEDs in A495 - the same in a800
   5 #define LED_PR 0xC0220088  // green LED
   6 #define LED_AF 0xC0220080  // orange AF LED - não sei
   7 
   8 
   9 void shutdown()
  10 {
  11     volatile long *p = (void*)LED_PR;    // Green LED
  12 
  13     asm(
  14         "MRS     R1, CPSR\n"
  15         "AND     R0, R1, #0x80\n"
  16         "ORR     R1, R1, #0x80\n"
  17         "MSR     CPSR_cf, R1\n"
  18         :::"r1","r0");
  19 
  20     *p = 0x44;  // power off.
  21 
  22     while(1);
  23 }
  24 
  25 
  26 void debug_led(int state)
  27 {
  28     *(int*)LED_PR=state ? 0x46 : 0x44;
  29 }
  30 
  31 void camera_set_led(int led, int state, __attribute__ ((unused))int bright) {
  32     static char led_table[2]={7,9};
  33     if(state<=1) _LEDDrive(led_table[led%sizeof(led_table)], (!state)&1);
  34 }
  35 
  36 void vid_bitmap_refresh()
  37 {
  38         extern int full_screen_refresh;
  39         extern void _ScreenLock();
  40         extern void _ScreenUnlock();
  41 
  42         full_screen_refresh |= 3; //found in ScreenUnlock
  43         _ScreenLock();  
  44         _ScreenUnlock();
  45 }
  46 
  47 
  48 // Defined in stubs_entry.S
  49 extern char active_viewport_buffer;
  50 extern void* viewport_buffers[];
  51 
  52 void *vid_get_viewport_fb()
  53 {
  54     // Return first viewport buffer - for case when vid_get_viewport_live_fb not defined
  55     return viewport_buffers[0];
  56 }
  57 
  58 void *vid_get_viewport_live_fb()
  59 {
  60     if (MODE_IS_VIDEO(mode_get()))
  61         return viewport_buffers[0];     // Video only seems to use the first viewport buffer.
  62 
  63     // Hopefully return the most recently used viewport buffer so that motion detect, histogram, zebra and edge overly are using current image data
  64     return viewport_buffers[(active_viewport_buffer)&3];
  65 }
  66 
  67 // Near "PropertyTableManagerCore.c" ROM:FFD2ED94
  68 int get_flash_params_count(void) {
  69  return 0xa0; 
  70  }
  71 
  72 
  73 // PTP display stuff
  74 // 64 entry palette based on 100b 0xffcd86d4
  75 int vid_get_palette_type() { return 4; }
  76 int vid_get_palette_size() { return 16*4; }
  77 
  78 void *vid_get_bitmap_active_palette() {
  79     return (void *)*(unsigned int*)(0x49e8+0x20);  // sub_ffcd86d4, via sub_ffe51bf0 two refs to "Palette Class."
  80 }
  81 void *vid_get_bitmap_active_buffer()
  82 {
  83     return (void*)(*(int*)(0x49e8+0x0c)); //sub_ffcd8790, via sub_ffe70e04 "Add: %p Width : %ld Hight : %ld", 
  84 }

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