root/platform/ixus115_elph100hs/kbd.c

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

DEFINITIONS

This source file includes following definitions.
  1. get_usb_bit
  2. get_hdmi_hpd_bit
  3. mykbd_task
  4. wrap_kbd_p1_f
  5. my_kbd_read_keys
  6. kbd_fetch_data

   1 #include "lolevel.h"
   2 #include "platform.h"
   3 #include "keyboard.h"
   4 #include "kbd_common.h"
   5 
   6 
   7 long kbd_new_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
   8 long kbd_prev_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
   9 long kbd_mod_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
  10 
  11 
  12 extern void _GetKbdState(long*);
  13 
  14 int get_usb_bit()
  15 {
  16                 long usb_physw[3];
  17                 usb_physw[USB_IDX] = 0;
  18                 _kbd_read_keys_r2(usb_physw);
  19                 return(( usb_physw[USB_IDX] & USB_MASK)==USB_MASK) ;
  20 }
  21 
  22 int get_hdmi_hpd_bit() {
  23     long hpd_physw[3];
  24     hpd_physw[HDMI_HPD_IDX] = 0;
  25     _GetKbdState(hpd_physw);
  26     return( ((hpd_physw[HDMI_HPD_IDX] & HDMI_HPD_FLAG)==HDMI_HPD_FLAG)?0:1) ;
  27 }
  28 
  29 KeyMap keymap[] = {
  30 
  31         // tiny bug: key order matters. KEY_SHOOT_FULL needs to come before KEY_SHOOT_HALF and KEY_SHOOT_FULL_ONLY
  32 
  33         { 0, KEY_PLAYBACK    ,0x00000001 },
  34         { 1, KEY_MENU        ,0x01000000 }, // Found @0xffb99680, levent 0x09
  35         { 1, KEY_SET         ,0x04000000 }, // Found @0xffb99688, levent 0x08
  36         { 1, KEY_ZOOM_OUT    ,0x10000000 }, // Found @0xffb99690, levent 0x03
  37         { 1, KEY_ZOOM_IN     ,0x20000000 }, // Found @0xffb99698, levent 0x02
  38         { 1, KEY_VIDEO       ,0x80000000 },
  39         { 2, KEY_UP          ,0x00000001 }, // Found @0xffb996b0, levent 0x04
  40         { 2, KEY_DOWN        ,0x00000002 }, // Found @0xffb996b8, levent 0x05
  41         { 2, KEY_LEFT        ,0x00000004 }, // Found @0xffb996c0, levent 0x06
  42         { 2, KEY_RIGHT       ,0x00000008 }, // Found @0xffb996c8, levent 0x07
  43         { 2, KEY_SHOOT_FULL  ,0x00000030 }, // Found @0xffb996d8, levent 0x01
  44         { 2, KEY_SHOOT_FULL_ONLY  ,0x00000020 },
  45         { 2, KEY_SHOOT_HALF  ,0x00000010 }, // Found @0xffb996d0, levent 0x00
  46         { 0, 0, 0 }
  47 };
  48 
  49 
  50 long __attribute__((naked)) wrap_kbd_p1_f();
  51 
  52 // no stack manipulation needed here, since we create the task directly
  53 void __attribute__((noinline)) mykbd_task() {
  54 
  55         while (physw_run) {
  56                 _SleepTask(physw_sleep_delay);// @FF834508
  57 
  58                 if (wrap_kbd_p1_f() == 1) {   // autorepeat ?
  59                         _kbd_p2_f();
  60                 }
  61         }
  62 
  63         _ExitTask();
  64 }
  65 
  66 //
  67 long __attribute__((naked,noinline)) wrap_kbd_p1_f() {
  68         asm volatile(
  69                                 "STMFD   SP!, {R1-R7,LR}\n"       //SX220 modified
  70                                 "MOV     R5, #0\n"
  71                                 "BL      my_kbd_read_keys\n"     // +
  72                                 "B       _kbd_p1_f_cont\n"       // continue
  73         );
  74 
  75         return 0;   // shut up the compiler
  76 }
  77 
  78 
  79 void my_kbd_read_keys() {
  80     kbd_update_key_state();
  81     kbd_update_physw_bits();
  82 
  83     extern void state_check_for_movie_af();
  84     state_check_for_movie_af(); // hack to prevent the "invisible af lock" caused by the movie af scan hack
  85 }
  86 
  87 void kbd_fetch_data(long *dst)
  88 {
  89     _GetKbdState(dst);
  90     _kbd_read_keys_r2(dst);
  91 }

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