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. JogDial_CW
  5. JogDial_CCW
  6. get_flash_params_count
  7. vid_bitmap_refresh
  8. vid_get_viewport_width
  9. vid_get_viewport_height
  10. vid_get_viewport_yscale
  11. vid_get_viewport_width_proper
  12. vid_get_viewport_height_proper
  13. vid_get_viewport_fullscreen_width
  14. vid_get_viewport_fullscreen_height
  15. vid_get_palette_type
  16. 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, __attribute__ ((unused))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 void JogDial_CW(void){
  38  _PostLogicalEventForNotPowerType(0x876, 1);  // RotateJogDialRight
  39 }
  40 
  41 void JogDial_CCW(void){
  42  _PostLogicalEventForNotPowerType(0x877, 1);  // RotateJogDialLeft
  43 }
  44 
  45 int get_flash_params_count(void){
  46  return 130; // ERR99 ToDo: Is this the correct S90 value?
  47 }
  48 
  49 void vid_bitmap_refresh()
  50 {
  51          extern int enabled_refresh_physical_screen; // screen lock counter
  52          extern void _ScreenUnlock();
  53 
  54          _ScreenLock();
  55           enabled_refresh_physical_screen = 1;
  56          _ScreenUnlock();
  57 }
  58 
  59 // Viewport and Bitmap values that shouldn't change across firmware versions.
  60 // Values that may change are in lib.c for each firmware version.
  61 
  62 int vid_get_viewport_width()
  63 {
  64         return 360;
  65 }
  66 
  67 long vid_get_viewport_height()
  68 {
  69    return 240;
  70 }
  71 
  72 // Y multiplier for cameras with 480 pixel high viewports (CHDK code assumes 240)
  73 int vid_get_viewport_yscale() {
  74         return 2;               // S90 viewport is 480 pixels high
  75 }
  76 
  77 extern int _GetVRAMHPixelsSize();
  78 extern int _GetVRAMVPixelsSize();
  79 
  80 int vid_get_viewport_width_proper() { 
  81     return ((mode_get()&MODE_MASK) == MODE_PLAY)?720:_GetVRAMHPixelsSize();
  82 }
  83 
  84 int vid_get_viewport_height_proper() {
  85     return ((mode_get()&MODE_MASK) == MODE_PLAY)?480:_GetVRAMVPixelsSize();
  86 }
  87 
  88 // assumes full screen, stitch not checked
  89 int vid_get_viewport_fullscreen_width() {
  90     return vid_get_viewport_width_proper();
  91 }
  92 int vid_get_viewport_fullscreen_height() {
  93     return vid_get_viewport_height_proper();
  94 }
  95 
  96 // 256 entry palette based on 101c sub_FF9152C4
  97 int vid_get_palette_type() { return 3; }
  98 int vid_get_palette_size() { return 256*4; }
  99 

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