tizen 2.4 release
[profile/mobile/platform/kernel/u-boot-tm1.git] / arch / arm / include / asm / arch-tiger / kpd_drvapi.h
1 /******************************************************************************
2  ** File Name:      kpd_drvapi.h                                                 *
3  ** Author:         Xueliang.Wang                                             *
4  ** DATE:           09/10/2002                                                *
5  ** Copyright:      2002 Spreatrum, Incoporated. All Rights Reserved.         *
6  ** Description:                                                              *
7  ******************************************************************************
8
9  ******************************************************************************
10  **                        Edit History                                       *
11  ** ------------------------------------------------------------------------- *
12  ** DATE           NAME             DESCRIPTION                               *
13  ** 09/10/2002     Xueliang.Wang    Create.                                   *
14  ** 19/11/2004     Benjamin.Wang    Modify because of the keymap's new define.      *
15  ******************************************************************************/
16
17 #ifndef _KPD_DRVAPI_H_
18 #define _KPD_DRVAPI_H_
19
20
21 // Keypad constant.
22 #define TB_KPD_CONST_BASE       0x80
23 #define TB_KPD_RELEASED         TB_KPD_CONST_BASE
24 #define TB_KPD_PRESSED          (TB_KPD_CONST_BASE + 1)
25 #define TB_KPD_INVALID_KEY      0x0FFFF
26
27
28 /**---------------------------------------------------------------------------*
29  **                         Compiler Flag                                     *
30  **---------------------------------------------------------------------------*/
31 #ifdef __cplusplus
32 extern   "C"
33 {
34 #endif
35
36 #include "sci_types.h"
37
38 /**---------------------------------------------------------------------------*
39  **                         Constant Variables                                *
40  **---------------------------------------------------------------------------*/
41
42 /**---------------------------------------------------------------------------*
43  **                         Data Structures                                   *
44  **---------------------------------------------------------------------------*/
45 extern const uint16    keymap[];
46
47 //For keypad sync read mode using
48 typedef struct
49 {
50      int key;
51      int status;
52 }KPD_SYNC_T;
53
54 typedef enum
55 {
56     KPD_NORMAL_INTERRUPT,
57     KPD_SYNC_READ,
58 }KpdReadMode;
59
60 /*****************************************************************************/
61 //  Description:    This function loopthrough, if these is interruption, put it in the buffer, and then
62 //                       determine whether the key is ture, if it is true, sent to the callback function for
63 //                       further processing.
64 //  Author:          steve.zhan
65 //  Note:           Get some keystatus using polling method 
66 /*****************************************************************************/
67 PUBLIC uint32 KPD_SyncGetKey(void);
68 /*****************************************************************************/
69 //  Description:    This function set the current read mode:Sync mode, Or async mode.
70 //  Author:           steve.zhan
71 //  Note:              Default value is normal mode(using interrupt is async mode)
72 /*****************************************************************************/
73 PUBLIC uint32 KPD_SetKpdReadMode(KpdReadMode mode);
74
75 /*****************************************************************************/
76 //  Description:    This function return  the current read mode:Sync mode, Or async mode.
77 //  Author:           steve.zhan
78 //  Note:
79 /*****************************************************************************/
80 PUBLIC KpdReadMode KPD_GetKpdReadMode(void);
81
82 //end sync read mode .
83
84 /**---------------------------------------------------------------------------*
85  **                         Function Prototypes                               *
86  **---------------------------------------------------------------------------*/
87 /*****************************************************************************/
88 //  Description:    This function initialize keypad.
89 //                  1. Enable keypad device.
90 //                  2. Enable keypad interrupt.
91 //  Author:         Xueliang.Wang
92 //  Note:
93 /*****************************************************************************/
94 PUBLIC uint32 KPD_Init (void);
95
96 /*****************************************************************************/
97 //  Description:    This function close keypad.
98 //                  1. Disable keypad device.
99 //                  2. Disable keypad interrupt.
100 //  Author:         Xueliang.Wang
101 //  Note:
102 /*****************************************************************************/
103 PUBLIC void KPD_Close (void);
104
105 /*below are removed from driver_export.c, wait clean up*/
106 /*****************************************************************************/
107 //  Description:    check pbutton's state
108 //  Global resource dependence:
109 //  Author:         Jimmy.Jia
110 //  Note:           return SCI_TRUE if pressed, else return SCI_FALSE
111 /*****************************************************************************/
112 uint32 CheckPowerButtonState (void);
113
114 /*****************************************************************************/
115 //  Description:    check if pbutton is released
116 //  Global resource dependence:
117 //  Author:         Jimmy.Jia
118 //  Note:           return SCI_TRUE if released, else return SCI_FALSE
119 /*****************************************************************************/
120 uint32  IsPowerButtonReleased (void);
121
122
123 /*****************************************************************************/
124 //  Description:    Disable interrupt for system, and read keypad status using sync. mode
125 //  Global resource dependence:
126 //  Author:         steve.zhan
127 //  Note:           return the count result key, 
128 /*****************************************************************************/
129 PUBLIC uint32 KPD_Sync_ReadKey(int  count, KPD_SYNC_T buf[], int delayCnt);
130
131 /**---------------------------------------------------------------------------*
132  **                         Compiler Flag                                     *
133  **---------------------------------------------------------------------------*/
134 #ifdef __cplusplus
135 }
136 #endif
137
138 #endif // _KPD_DRVAPI_H_
139