root/platform/ixus700_sd500/lib.c

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

DEFINITIONS

This source file includes following definitions.
  1. shutdown
  2. led_on
  3. led_off
  4. debug_led
  5. get_flash_params_count
  6. set_led
  7. camera_set_led

   1 #include "platform.h"
   2 #include "lolevel.h"
   3 
   4 void shutdown()
   5 {
   6     volatile long *p = (void*)0xc022002c;
   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 = 0x46;
  16 
  17     while(1);
  18 }
  19 
  20 
  21 #define LED_PR 0xc0220088
  22 
  23 #define LED_BRIGHTNESS  200
  24 #define LED_GREEN       4
  25 #define LED_YELLOW      5
  26 #define LED_ORANGE      7
  27 #define LED_BLUE        8
  28 #define LED_AF_BEAM     9
  29 #define LED_TIMER       10
  30   
  31 static void led_on(const int led, const int brightness)
  32 {
  33     if (led < 4 || led > 10 || led == 6) return;
  34     static void* addr;
  35     addr = led_table + (led * 0x40);
  36     _UniqueLedOn(addr,brightness);
  37 }
  38  
  39 static void led_off(const int led)
  40 {
  41     if (led < 4 || led > 10 || led == 6) return;
  42     static void* addr;
  43     addr = led_table + (led * 0x40);
  44     _UniqueLedOff(addr);
  45 }
  46 
  47 void debug_led(int state)
  48 {
  49     if (state)
  50         led_on(LED_BLUE, LED_BRIGHTNESS);
  51     else
  52         led_off(LED_BLUE);
  53 }
  54 
  55 int get_flash_params_count(void){
  56  return 83;
  57 }
  58 
  59 void set_led(int led, int state)
  60 {
  61     if (state)
  62         led_on(led, LED_BRIGHTNESS);
  63     else
  64         led_off(led);
  65 }
  66 void camera_set_led(int led, int state, int bright)
  67 {
  68         if (state) {
  69                 if (bright > LED_BRIGHTNESS) bright = LED_BRIGHTNESS;
  70                 if (led == 6) {
  71                 led_on(4, bright);
  72                     led_on(5, bright);
  73                 } else
  74                         led_on(led, bright);
  75         }
  76     else
  77                 if (led == 6) {
  78                 led_off(4);
  79                     led_off(5);
  80                 } else
  81         led_off(led);
  82 }

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