root/platform/ixus200_sd980/kbd.c

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

DEFINITIONS

This source file includes following definitions.
  1. get_usb_bit
  2. mykbd_task
  3. wrap_kbd_p1_f
  4. my_kbd_read_keys
  5. kbd_fetch_data
  6. jogdial_control
  7. Get_JogDial
  8. get_jogdial_direction

   1 #include "lolevel.h"
   2 #include "platform.h"
   3 #include "keyboard.h"
   4 #include "kbd_common.h"
   5 
   6 long kbd_new_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
   7 long kbd_prev_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
   8 long kbd_mod_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
   9 
  10 extern void _platformsub_kbd_fetch_data(long*);
  11 
  12 int get_usb_bit() 
  13 {
  14         long usb_physw[3];
  15         usb_physw[USB_IDX] = 0;
  16         _kbd_read_keys_r2(usb_physw);
  17         return(( usb_physw[USB_IDX] & USB_MASK)==USB_MASK) ; 
  18 }
  19 
  20 KeyMap keymap[] = {
  21         /* tiny bug: key order matters. see kbd_get_pressed_key()
  22          * for example
  23          */
  24 
  25         { 2, KEY_SHOOT_FULL     , 0x00000300 },
  26     { 2, KEY_SHOOT_FULL_ONLY, 0x00000200 },
  27         { 2, KEY_SHOOT_HALF     , 0x00000100 },
  28 
  29         { 2, KEY_UP                     , 0x00000080 },
  30         { 2, KEY_DOWN           , 0x00000040 },
  31         { 2, KEY_LEFT           , 0x00000010 },
  32         { 2, KEY_RIGHT          , 0x00000020 },
  33         { 2, KEY_SET            , 0x00000002 },
  34         { 2, KEY_ZOOM_IN        , 0x00000004 },
  35         { 2, KEY_ZOOM_OUT       , 0x00000008 },
  36         { 2, KEY_MENU           , 0x00000001 },
  37         { 2, KEY_DISPLAY        , 0x00000040 },
  38     { 2, KEY_PLAYBACK   , 0x00000800 },
  39         /*
  40         { 1, KEY_ERASE          , 0x00000080 },
  41         { 1, KEY_EXPO_CORR      , 0x00000040 },
  42         { 1, KEY_FLASH          , 0x00100000 },
  43         { 1, KEY_VIDEO          , 0x00000020 },*/
  44         { 0, 0, 0 }
  45 };
  46 
  47 
  48 long __attribute__((naked)) wrap_kbd_p1_f() ;
  49 
  50 void __attribute__((noinline)) mykbd_task()
  51 {
  52         while (physw_run){
  53                 _SleepTask(10);
  54 
  55                 if (wrap_kbd_p1_f() == 1){
  56                         _kbd_p2_f();
  57                 }
  58         }
  59         _ExitTask();
  60 }
  61 
  62 long __attribute__((naked,noinline)) wrap_kbd_p1_f()
  63 {
  64         asm volatile(
  65                 "STMFD   SP!, {R1-R5,LR}\n"
  66                 "MOV     R4, #0\n"
  67                 "BL      my_kbd_read_keys\n"
  68                 "B       _kbd_p1_f_cont\n"
  69         );
  70         return 0; // shut up the compiler
  71 }
  72 
  73 int jogdial_stopped=0;
  74 
  75 void my_kbd_read_keys()
  76 {
  77     kbd_update_key_state();
  78 
  79     _kbd_read_keys_r2(physw_status);
  80 
  81     kbd_update_physw_bits();
  82 }
  83 
  84 void kbd_fetch_data(long *dst)
  85 {
  86         _platformsub_kbd_fetch_data(dst);
  87 }
  88 
  89 void jogdial_control(int n) {
  90     // this camera did not have jog_position defined
  91     /*
  92     if (jogdial_stopped && !n) {
  93         // If re-enabling jogdial set the task code current & previous positions to the actual
  94         // dial positions so that the change won't get processed by the firmware
  95         jog_position[0] = jog_position[2] = rear_dial_position;   // Rear dial
  96     }
  97     */
  98     jogdial_stopped = n;
  99 }
 100 
 101 
 102 static int new_jogdial=0, old_jogdial=0;
 103 
 104 int Get_JogDial(void){
 105  return (*(int*)0xC0240104)>>16;
 106 }
 107 
 108 long get_jogdial_direction(void) {
 109  old_jogdial=new_jogdial;
 110  new_jogdial=Get_JogDial();
 111  if (old_jogdial>new_jogdial) return JOGDIAL_LEFT;
 112  else if (old_jogdial<new_jogdial) return JOGDIAL_RIGHT;
 113  else return 0;
 114 }

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