root/platform/s3is/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. camera_set_led
  7. vid_get_bitmap_active_buffer
  8. vid_get_bitmap_active_palette
  9. vid_get_palette_type
  10. vid_get_palette_size

   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 108;
  57 }
  58 
  59 
  60 void camera_set_led(int led, int state, int bright)
  61 {
  62         if (state) {
  63                 if (bright > LED_BRIGHTNESS) bright = LED_BRIGHTNESS;
  64                 if (led == 6) { // yellow = red + green
  65                 led_on(4, bright);
  66                     led_on(5, bright);
  67                 } else
  68                         led_on(led, bright);
  69         }
  70     else
  71                 if (led == 6) {
  72                 led_off(4);
  73                     led_off(5);
  74                 } else
  75         led_off(led);
  76 }
  77 
  78 void *vid_get_bitmap_active_buffer()
  79 {
  80     return (void*)(*(int*)0x62f0);  // in sub_ff942918 for 100a
  81 }
  82 
  83 void *vid_get_bitmap_active_palette() {
  84     return (void *)0x5fa80;         // in sub_ff942918 for 100a
  85 }
  86 
  87 int vid_get_palette_type() { return 1; }
  88 int vid_get_palette_size() { return 16*4; }

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