root/platform/s90/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_width
  7. vid_get_viewport_height
  8. vid_get_viewport_yscale
  9. vid_get_viewport_width_proper
  10. vid_get_viewport_height_proper
  11. vid_get_viewport_fullscreen_width
  12. vid_get_viewport_fullscreen_height
  13. vid_get_palette_type
  14. vid_get_palette_size

   1 #include "platform.h"
   2 #include "lolevel.h"
   3 
   4 void shutdown()
   5 {
   6     volatile long *p = (void*)0xc022012C; // S90
   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 0xc0220130 //DP LED
  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 void camera_set_led(int led, int state, int bright) {
  33         static char led_table[4]={0,1,9,10};
  34     _LEDDrive(led_table[led%sizeof(led_table)], state<=1 ? !state : state);
  35 }
  36 
  37 int get_flash_params_count(void){
  38  return 130; // ERR99 ToDo: Is this the correct S90 value?
  39 }
  40 
  41 void vid_bitmap_refresh()
  42 {
  43          extern int enabled_refresh_physical_screen; // screen lock counter
  44          extern void _ScreenUnlock();
  45 
  46          _ScreenLock();
  47           enabled_refresh_physical_screen = 1;
  48          _ScreenUnlock();
  49 }
  50 
  51 // Viewport and Bitmap values that shouldn't change across firmware versions.
  52 // Values that may change are in lib.c for each firmware version.
  53 
  54 int vid_get_viewport_width()
  55 {
  56         return 360;
  57 }
  58 
  59 long vid_get_viewport_height()
  60 {
  61    return 240;
  62 }
  63 
  64 // Y multiplier for cameras with 480 pixel high viewports (CHDK code assumes 240)
  65 int vid_get_viewport_yscale() {
  66         return 2;               // S90 viewport is 480 pixels high
  67 }
  68 
  69 extern int _GetVRAMHPixelsSize();
  70 extern int _GetVRAMVPixelsSize();
  71 
  72 int vid_get_viewport_width_proper() { 
  73     return ((mode_get()&MODE_MASK) == MODE_PLAY)?720:_GetVRAMHPixelsSize();
  74 }
  75 
  76 int vid_get_viewport_height_proper() {
  77     return ((mode_get()&MODE_MASK) == MODE_PLAY)?480:_GetVRAMVPixelsSize();
  78 }
  79 
  80 // assumes full screen, stitch not checked
  81 int vid_get_viewport_fullscreen_width() {
  82     return vid_get_viewport_width_proper();
  83 }
  84 int vid_get_viewport_fullscreen_height() {
  85     return vid_get_viewport_height_proper();
  86 }
  87 
  88 // 256 entry palette based on 101c sub_FF9152C4
  89 int vid_get_palette_type() { return 3; }
  90 int vid_get_palette_size() { return 256*4; }
  91 

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