root/platform/ixus870_sd880/lib.c

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

DEFINITIONS

This source file includes following definitions.
  1. vid_bitmap_refresh
  2. shutdown
  3. debug_led
  4. camera_set_led
  5. get_flash_params_count
  6. JogDial_CW
  7. JogDial_CCW
  8. vid_turn_off_updates
  9. vid_turn_on_updates

   1 #include "platform.h"
   2 #include "lolevel.h"
   3 
   4 void vid_bitmap_refresh()
   5 {
   6  extern int enabled_refresh_physical_screen; // screen lock counter
   7  int old_val = enabled_refresh_physical_screen;
   8  if ( old_val == 0 )
   9  {
  10    _ScreenLock(); // make sure code is called at least once
  11  } else {
  12    enabled_refresh_physical_screen=1; // forces actual redraw
  13  }
  14  _RefreshPhysicalScreen(1); // unlock/refresh
  15 
  16  // restore original situation
  17  if ( old_val > 0 )
  18  {
  19    _ScreenLock();
  20    enabled_refresh_physical_screen = old_val;
  21  }
  22 }
  23 
  24 
  25 void shutdown()
  26 {
  27         volatile long *p = (void*)0xC022001C; // from sub_FF829230 (e.g. called at end of task_Bye)
  28 
  29         // based on IRQdisable (why use CPSR_cf instead of CPSR_cxsf?)
  30         asm(
  31                 "MRS     R1, CPSR\n"
  32                 "AND     R0, R1, #0x80\n"
  33                 "ORR     R1, R1, #0x80\n"
  34                 "MSR     CPSR_cf, R1\n"
  35                 :::"r1","r0");
  36         
  37         *p = 0x44;  // power off.
  38         
  39         while(1); // no nothing while power is being switched off
  40 }
  41 
  42 void debug_led(int state)
  43 {
  44  // using direct-print led for debugging
  45  *((int*) 0xC02200D4) = state ? 0x46 : 0x44;
  46 }
  47 
  48 void camera_set_led(int led, int state, __attribute__ ((unused))int bright) {
  49   // approximation of behaviour advertised in documentation.
  50   long val = state ? 0x46 : 0x44;
  51   switch ( led )
  52   {
  53     case 4:
  54       *((volatile long *) 0xC0220136) = val;
  55       break;
  56     case 5:
  57       *((volatile long *) 0xC0220136) = val;
  58       *((volatile long *) 0xC0220133) = val;
  59       break;
  60     case 7:
  61       *((volatile long *) 0xC0220133) = val;
  62       break;
  63     case 8:
  64       *((volatile long *) 0xC02200D4) = val;
  65       break;
  66     case 9:
  67       *((volatile long *) 0xC0223030) = val;
  68       break;
  69     default:
  70       break;
  71   }
  72 }
  73 
  74 int get_flash_params_count(void){
  75  // Size of table at FlashParamTable (stubs_min.S)
  76  // ( <first unk_ after FlashParamTable> - FlashParamTable ) / 4
  77  return 120; 
  78 }
  79 
  80 void JogDial_CW(void){
  81  _PostLogicalEventForNotPowerType(0x874, 1);  // RotateJogDialRight
  82 }
  83 
  84 void JogDial_CCW(void){
  85  _PostLogicalEventForNotPowerType(0x875, 1);  // RotateJogDialLeft
  86 }
  87 
  88 void vid_turn_off_updates()
  89 {
  90   _ScreenLock();
  91 }
  92 
  93 void vid_turn_on_updates()
  94 {
  95   _RefreshPhysicalScreen(1);
  96 }

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