1 /******************************************************************************
2 ** File Name: kpd_reg_v0.h *
5 ** Copyright: 2010 Spreatrum, Incoporated. All Rights Reserved. *
7 ******************************************************************************/
8 /******************************************************************************
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 /*----------------------------------------------------------------------------*
18 **------------------------------------------------------------------------- */
20 /**---------------------------------------------------------------------------*
22 **--------------------------------------------------------------------------*/
27 #include "sci_types.h"
28 /**---------------------------------------------------------------------------*
30 **---------------------------------------------------------------------------*/
31 //The corresponding bit of KPD_STS register.
32 #define KPD_INT_ALL (0xfff)
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
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
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
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 #define KPD1_KEY_STS 0x80
61 //The corresponding bit of KPD_POLARITY register.
62 #define KPDPOLARITY_ROW (0x00FF) // Internal row output xor with this
63 // value to generate row output.
64 #define KPDPOLARITY_COL (0xFF00) // Column input xor with this value to
65 //The corresponding bit of KPD_CLK0.
66 #define KPDCLK0_CLK_DIV0 0xFFFF //Clock dividor [15:0]
67 #define KPDCLK1_TIME_CNT 0xFFB0 //Time out counter value
69 // KEYPAD Interface Control.
70 typedef struct kpd_tag
73 VOLATILE uint32 int_en;
74 VOLATILE uint32 int_raw_status;
75 VOLATILE uint32 int_mask_status;
76 VOLATILE uint32 int_clr;
77 VOLATILE uint32 reserved; ///reserved
78 VOLATILE uint32 polarity;
79 VOLATILE uint32 debounce_cnt;
80 VOLATILE uint32 long_key_cnt;
81 VOLATILE uint32 sleep_cnt;
82 VOLATILE uint32 clk_divide_cnt;
83 VOLATILE uint32 key_status;
84 VOLATILE uint32 sleep_status;
85 VOLATILE uint32 debug_status_1; //only for debug
86 VOLATILE uint32 debug_status_2; //only for debug
89 /**----------------------------------------------------------------------------*
91 **----------------------------------------------------------------------------*/
93 /**----------------------------------------------------------------------------*
94 ** Local Function Prototype **
95 **----------------------------------------------------------------------------*/
97 /**----------------------------------------------------------------------------*
98 ** Function Prototype **
99 **----------------------------------------------------------------------------*/
102 /**----------------------------------------------------------------------------*
104 **----------------------------------------------------------------------------*/
108 /**---------------------------------------------------------------------------*/