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
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
68 // KEYPAD Interface Control.
69 typedef struct kpd_tag
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
88 /**----------------------------------------------------------------------------*
90 **----------------------------------------------------------------------------*/
92 /**----------------------------------------------------------------------------*
93 ** Local Function Prototype **
94 **----------------------------------------------------------------------------*/
96 /**----------------------------------------------------------------------------*
97 ** Function Prototype **
98 **----------------------------------------------------------------------------*/
101 /**----------------------------------------------------------------------------*
103 **----------------------------------------------------------------------------*/
107 /**---------------------------------------------------------------------------*/