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_proceed
  4. mykbd_task
  5. wrap_kbd_p1_f
  6. my_kbd_read_keys
  7. 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 static void __attribute__((noinline)) mykbd_task_proceed() {
  53 }
  54 
  55 // no stack manipulation needed here, since we create the task directly
  56 void __attribute__((noinline)) mykbd_task() {
  57 
  58         while (physw_run) {
  59                 _SleepTask(physw_sleep_delay);// @FF834508
  60 
  61                 if (wrap_kbd_p1_f() == 1) {   // autorepeat ?
  62                         _kbd_p2_f();
  63                 }
  64         }
  65 
  66         _ExitTask();
  67 }
  68 
  69 //
  70 long __attribute__((naked,noinline)) wrap_kbd_p1_f() {
  71         asm volatile(
  72                                 "STMFD   SP!, {R1-R7,LR}\n"       //SX220 modified
  73                                 "MOV     R5, #0\n"
  74                                 "BL      my_kbd_read_keys\n"     // +
  75                                 "B       _kbd_p1_f_cont\n"       // continue
  76         );
  77 
  78         return 0;   // shut up the compiler
  79 }
  80 
  81 
  82 void my_kbd_read_keys() {
  83     kbd_update_key_state();
  84     kbd_update_physw_bits();
  85 
  86     extern void state_check_for_movie_af();
  87     state_check_for_movie_af(); // hack to prevent the "invisible af lock" caused by the movie af scan hack
  88 }
  89 
  90 void kbd_fetch_data(long *dst)
  91 {
  92     _GetKbdState(dst);
  93     _kbd_read_keys_r2(dst);
  94 }

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