root/platform/a1000/lib.c

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

DEFINITIONS

This source file includes following definitions.
  1. shutdown
  2. debug_led
  3. get_flash_params_count
  4. camera_jpeg_count_str
  5. camera_set_led
  6. vid_bitmap_refresh
  7. vid_get_palette_type
  8. vid_get_palette_size
  9. vid_get_bitmap_active_palette
  10. vid_get_bitmap_active_buffer
  11. vid_get_viewport_fb_d
  12. vid_get_bitmap_fb
  13. vid_get_viewport_fb
  14. vid_get_viewport_yoffset
  15. vid_get_viewport_width
  16. vid_get_viewport_width_proper
  17. vid_get_viewport_height
  18. vid_get_viewport_height_proper
  19. vid_get_viewport_fullscreen_height
  20. vid_get_viewport_display_xoffset_proper
  21. vid_get_viewport_display_yoffset_proper

   1 #include "platform.h"
   2 #include "lolevel.h"
   3 
   4 void shutdown()
   5 {
   6     volatile long *p = (void*)0xc02200a0;
   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 0xc02200C4
  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 #define LED_AF 0xc0220080
  33 
  34 int get_flash_params_count(void){
  35         return 119; // Found at ROM:FF972F9C (S5IS 1.01b) => ROM:FF93D3E4
  36 }
  37 
  38 char *camera_jpeg_count_str()
  39 {
  40     extern char jpeg_count_str[];
  41     return jpeg_count_str;
  42 }
  43 
  44 void camera_set_led(int led, int state, int bright) { 
  45         struct led_control led_c; 
  46         char convert_table[11]={0,1,2,3,0,2,3,1,8,10,10};  // s3 to a710 (and a720) convert table
  47 
  48         //char convert_table[6]={0,1,2,3,8,10};  // Test a720, values 0-5 are valid
  49 
  50         // 0 gr  
  51         // 1 red 
  52         // 2 yel 
  53         // 3 pw  
  54         // 8 dp  
  55         // 9 af  
  56 
  57         led_c.led_num=convert_table[led%11]; 
  58         led_c.action=state<=1 ? !state : state; 
  59         led_c.brightness=bright; 
  60         led_c.blink_count=255; 
  61         _PostLEDMessage(&led_c); 
  62 } 
  63 
  64 void vid_bitmap_refresh() //as used in other models
  65 {
  66         extern int enabled_refresh_physical_screen;
  67         enabled_refresh_physical_screen=1;
  68         _RefreshPhysicalScreen(1);
  69 }
  70 
  71 // PTP display stuff
  72 // 64 entry palette based on 100a 0xffcc4f24 by comparison to a495 100f
  73 int vid_get_palette_type() { return 4; }
  74 int vid_get_palette_size() { return 16*4; }
  75 
  76 void *vid_get_bitmap_active_palette() {
  77     return (void *)*(unsigned int*)(0x7534+0x20);  // 100a/100b: sub_ffcc4f24, via sub_ffd75e50 two refs to "Palette Class."
  78 }
  79 void *vid_get_bitmap_active_buffer()
  80 {
  81     return (void*)(*(int*)(0x7534+0x0c)); // 100a/100b: sub_ffcc4fe8, via "Add: %p Width : %ld Hight : %ld"
  82 }
  83 
  84 
  85 // Viewport and Bitmap values that shouldn't change across firmware versions.
  86 // Values that may change are in lib.c for each firmware version.
  87 
  88 void *vid_get_viewport_fb_d()
  89 {
  90     extern char *viewport_fb_d;
  91     return viewport_fb_d;
  92 }
  93 
  94 void *vid_get_bitmap_fb(){
  95     return (void*)0x10361000;
  96 }
  97 
  98 void *vid_get_viewport_fb()
  99 {
 100         return (void*)0x10659DE0;
 101 }
 102 
 103 int vid_get_viewport_yoffset() {
 104     return 0;
 105 }
 106 
 107 extern int _GetVRAMHPixelsSize();
 108 extern int _GetVRAMVPixelsSize();
 109 
 110 int vid_get_viewport_width() {
 111     return 360;
 112 }
 113 
 114 int vid_get_viewport_width_proper() {
 115     return ((mode_get()&MODE_MASK) == MODE_PLAY)?720:_GetVRAMHPixelsSize();
 116 }
 117 
 118 long vid_get_viewport_height() {
 119     return 240;
 120 }
 121 
 122 int vid_get_viewport_height_proper() {
 123     int m = mode_get();
 124     // special case: W resolution
 125     if ((m&MODE_MASK) != MODE_PLAY && shooting_get_prop(PROPCASE_RESOLUTION) == 8) {
 126         return 240;
 127     }
 128     return ((mode_get()&MODE_MASK) == MODE_PLAY)?240:_GetVRAMVPixelsSize();
 129 }
 130 
 131 int vid_get_viewport_fullscreen_height() {
 132     int m = mode_get();
 133     // special case: W resolution
 134     if ((m&MODE_MASK) != MODE_PLAY && shooting_get_prop(PROPCASE_RESOLUTION) == 8) {
 135         return 120;
 136     }
 137     return ((mode_get()&MODE_MASK) == MODE_PLAY)?240:_GetVRAMVPixelsSize();
 138 }
 139 
 140 int vid_get_viewport_display_xoffset_proper()   { return vid_get_viewport_display_xoffset(); }
 141 int vid_get_viewport_display_yoffset_proper()   { return vid_get_viewport_display_yoffset(); }
 142 

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