tizen 2.4 release
[profile/mobile/platform/kernel/u-boot-tm1.git] / arch / arm / include / asm / arch-tiger / kpd_reg_v0.h
1 /******************************************************************************
2  ** File Name:    kpd_reg_v0.h                                            *
3  ** Author:       hao.liu                                                 *
4  ** DATE:         06/11/2010                                                  *
5  ** Copyright:    2010 Spreatrum, Incoporated. All Rights Reserved.           *
6  ** Description:                                                              *
7  ******************************************************************************/
8 /******************************************************************************
9  **                   Edit    History                                         *
10  **---------------------------------------------------------------------------*
11  ** DATE          NAME            DESCRIPTION                                 *
12  ** 06/11/2010    hao.liu      Create.                                     *
13  ******************************************************************************/
14 #ifndef _KPD_REG_V0_H_
15 #define _KPD_REG_V0_H_
16 /*----------------------------------------------------------------------------*
17  **                         Dependencies                                      *
18  **------------------------------------------------------------------------- */
19
20 /**---------------------------------------------------------------------------*
21  **                             Compiler Flag                                 *
22  **--------------------------------------------------------------------------*/
23 #ifdef   __cplusplus
24 extern   "C"
25 {
26 #endif
27 #include "sci_types.h"
28 /**---------------------------------------------------------------------------*
29 **                               Micro Define                                **
30 **---------------------------------------------------------------------------*/
31 //The corresponding bit of KPD_STS register.
32 #define KPD_INT_ALL                     (0xfff)
33
34 #define KPD_PRESS_INT0                  BIT_0
35 #define KPD_PRESS_INT1                  BIT_1
36 #define KPD_PRESS_INT2                  BIT_2
37 #define KPD_PRESS_INT3                  BIT_3
38
39 #define KPD_RELEASE_INT0                BIT_4
40 #define KPD_RELEASE_INT1                BIT_5
41 #define KPD_RELEASE_INT2                BIT_6
42 #define KPD_RELEASE_INT3                BIT_7
43
44 #define KPD_LONG_KEY_INT0               BIT_8
45 #define KPD_LONG_KEY_INT1               BIT_9
46 #define KPD_LONG_KEY_INT2               BIT_10
47 #define KPD_LONG_KEY_INT3               BIT_11
48
49 #define KPD_COL_CNT                     0x7
50 #define KPD_ROW_CNT                     0x70
51 #define KPD1_COL_CNT                    0x7
52 #define KPD1_ROW_CNT                    0x70
53 #define KPD2_COL_CNT                    0x700
54 #define KPD2_ROW_CNT                    0x7000
55 #define KPD3_COL_CNT                    0x70000
56 #define KPD3_ROW_CNT                    0x700000
57 #define KPD4_COL_CNT                    0x7000000
58 #define KPD4_ROW_CNT                    0x70000000
59
60 //The corresponding bit of KPD_POLARITY register.
61 #define KPDPOLARITY_ROW                 (0x00FF)    // Internal row output xor with this 
62 // value to generate row output.
63 #define KPDPOLARITY_COL                 (0xFF00)    // Column input xor with this value to
64 //The corresponding bit of KPD_CLK0.
65 #define KPDCLK0_CLK_DIV0                0xFFFF      //Clock dividor [15:0]
66 #define KPDCLK1_TIME_CNT                0xFFB0      //Time out counter value
67
68 // KEYPAD Interface Control.
69 typedef struct kpd_tag
70 {
71     VOLATILE uint32    ctl;
72     VOLATILE uint32    int_en;
73     VOLATILE uint32    int_raw_status;
74     VOLATILE uint32    int_mask_status;
75     VOLATILE uint32    int_clr;
76     VOLATILE uint32    reserved;    ///reserved
77     VOLATILE uint32    polarity;
78     VOLATILE uint32    debounce_cnt;
79     VOLATILE uint32    long_key_cnt;
80     VOLATILE uint32    sleep_cnt;
81     VOLATILE uint32    clk_divide_cnt;
82     VOLATILE uint32    key_status;
83     VOLATILE uint32    sleep_status;
84     VOLATILE uint32    debug_status_1;  //only for debug
85     VOLATILE uint32    debug_status_2;  //only for debug
86 } kpd_s;
87
88 /**----------------------------------------------------------------------------*
89 **                             Data Prototype                                 **
90 **----------------------------------------------------------------------------*/
91
92 /**----------------------------------------------------------------------------*
93 **                         Local Function Prototype                           **
94 **----------------------------------------------------------------------------*/
95
96 /**----------------------------------------------------------------------------*
97 **                           Function Prototype                               **
98 **----------------------------------------------------------------------------*/
99
100
101 /**----------------------------------------------------------------------------*
102 **                         Compiler Flag                                      **
103 **----------------------------------------------------------------------------*/
104 #ifdef   __cplusplus
105 }
106 #endif
107 /**---------------------------------------------------------------------------*/
108 #endif
109 // End