root/platform/s90/kbd.c

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

DEFINITIONS

This source file includes following definitions.
  1. get_usb_bit
  2. wrap_kbd_p1_f
  3. mykbd_task
  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 _GetKbdState(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     { 1, KEY_UP         , 0x00004000 },
  22     { 1, KEY_DOWN       , 0x00000400 },
  23     { 1, KEY_LEFT       , 0x00000100 },
  24     { 1, KEY_RIGHT      , 0x00000200 },
  25     { 1, KEY_SET        , 0x00008000 },
  26     { 0, KEY_SHOOT_FULL , 0x00000300 },
  27     { 0, KEY_SHOOT_FULL_ONLY, 0x00000200 },
  28     { 0, KEY_SHOOT_HALF , 0x00000100 },
  29     { 1, KEY_ZOOM_IN    , 0x00000010 },
  30     { 1, KEY_ZOOM_OUT   , 0x00000020 },
  31     { 1, KEY_MENU       , 0x00002000 },
  32     { 1, KEY_DISPLAY    , 0x00001000 },
  33     { 1, KEY_PRINT      , 0x00000800 }, // S Key
  34 //  { 0, KEY_PLAY       , 0x00000800 }, 
  35 //  { 1, KEY_RING_FUNC  , 0x00000040 }, 
  36     { 0, 0, 0 }
  37 };
  38 
  39 long __attribute__((naked,noinline)) wrap_kbd_p1_f()
  40 {
  41     asm volatile(
  42                 "STMFD   SP!, {R1-R5,LR}\n"
  43                 "MOV     R4, #0\n"
  44                 "BL      my_kbd_read_keys\n"
  45                 "B   _kbd_p1_f_cont\n"  
  46 
  47     );
  48     return 0;
  49 }
  50 
  51 void __attribute__((noinline)) mykbd_task()
  52 {
  53     while (physw_run){ 
  54         _SleepTask(10);
  55         if (wrap_kbd_p1_f() == 1){ // autorepeat ?
  56             _kbd_p2_f();
  57         }
  58     }
  59     _ExitTask();    
  60 }
  61 
  62 void my_kbd_read_keys() {
  63     kbd_update_key_state();
  64     kbd_update_physw_bits();
  65 }
  66 
  67 void kbd_fetch_data(long *dst)
  68 {
  69     _GetKbdState(dst);
  70     _kbd_read_keys_r2(dst);
  71 }
  72 
  73 
  74 // ========= Jog Dial ==============
  75 
  76 int jogdial_stopped=0;
  77 static int new_jogdial=0, old_jogdial=0;
  78 
  79 void jogdial_control(int n)
  80 {
  81     jogdial_stopped = n;
  82 }
  83 
  84 int Get_JogDial(void)
  85 {
  86  return (*(int*)0xC0240104)>>16;
  87 }
  88 
  89 long get_jogdial_direction(void) 
  90 { 
  91  old_jogdial=new_jogdial;
  92  new_jogdial=Get_JogDial();
  93  if (old_jogdial<new_jogdial) return JOGDIAL_LEFT; 
  94  else if (old_jogdial>new_jogdial) return JOGDIAL_RIGHT;
  95  else return 0;
  96 }
  97 

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