root/platform/tx1/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. set_led
  6. camera_set_led
  7. get_flash_params_count
  8. vid_get_bitmap_active_buffer
  9. vid_get_bitmap_active_palette
  10. vid_get_palette_type
  11. vid_get_palette_size

   1 #include "platform.h"
   2 #include "lolevel.h"
   3 
   4 void shutdown()
   5 {
   6     volatile long *p = (void*)0xc02200a0;
   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 
  22 #define LED_BRIGHTNESS  200
  23 #define LED_GREEN       4
  24 #define LED_YELLOW      5
  25 #define LED_ORANGE      7
  26 #define LED_BLUE        8
  27 #define LED_AF_BEAM     9
  28 #define LED_TIMER       10
  29 
  30   
  31 static void led_on(const int led, const int brightness)
  32 {
  33 
  34     if (led < 4 || led > 10 || led == 6) return;
  35     static void* addr;
  36     addr = led_table + (led * 0x40);
  37     _UniqueLedOn(addr,brightness);
  38 
  39 }
  40  
  41 static void led_off(const int led)
  42 {
  43 
  44     if (led < 4 || led > 10 || led == 6) return;
  45     static void* addr;
  46     addr = led_table + (led * 0x40);
  47     _UniqueLedOff(addr);
  48 
  49 }
  50 
  51 void debug_led(int state)
  52 {
  53 
  54     if (state)
  55         led_on(LED_BLUE, LED_BRIGHTNESS);
  56     else
  57         led_off(LED_BLUE);
  58 
  59 }
  60 
  61 void set_led(int led, int state)
  62 {
  63     if (state)
  64         led_on(led, LED_BRIGHTNESS);
  65     else
  66         led_off(led);
  67 
  68 }
  69 
  70 void camera_set_led(int led, int state, int bright)
  71 {
  72         if (state) {
  73                 if (bright > LED_BRIGHTNESS) bright = LED_BRIGHTNESS;
  74         led_on(led, bright);
  75         }
  76     else
  77         led_off(led);
  78 }
  79 
  80 int get_flash_params_count(void){
  81  return 111;
  82 }
  83 
  84 void *vid_get_bitmap_active_buffer()
  85 {
  86     //???
  87     return (void*)(*(int*)0x8478);  // in sub_ffa387ac for 101b
  88 }
  89 
  90 void *vid_get_bitmap_active_palette() {
  91     return (void *)0x64ac8; // in sub_ffa387ac for 101b
  92 }
  93 
  94 int vid_get_palette_type() { return 1; }
  95 int vid_get_palette_size() { return 16*4; }

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