1 /******************************************************************************
2 ** File Name: kpd_drvapi.h *
3 ** Author: Xueliang.Wang *
5 ** Copyright: 2002 Spreatrum, Incoporated. All Rights Reserved. *
7 ******************************************************************************
9 ******************************************************************************
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 ******************************************************************************/
17 #ifndef _KPD_DRVAPI_H_
18 #define _KPD_DRVAPI_H_
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
28 /**---------------------------------------------------------------------------*
30 **---------------------------------------------------------------------------*/
36 #include "sci_types.h"
38 /**---------------------------------------------------------------------------*
39 ** Constant Variables *
40 **---------------------------------------------------------------------------*/
42 /**---------------------------------------------------------------------------*
44 **---------------------------------------------------------------------------*/
45 extern const uint16 keymap[];
47 //For keypad sync read mode using
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.
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.
71 // Note: Default value is normal mode(using interrupt is async mode)
72 /*****************************************************************************/
73 PUBLIC uint32 KPD_SetKpdReadMode(KpdReadMode mode);
75 /*****************************************************************************/
76 // Description: This function return the current read mode:Sync mode, Or async mode.
79 /*****************************************************************************/
80 PUBLIC KpdReadMode KPD_GetKpdReadMode(void);
82 //end sync read mode .
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
93 /*****************************************************************************/
94 PUBLIC uint32 KPD_Init (void);
96 /*****************************************************************************/
97 // Description: This function close keypad.
98 // 1. Disable keypad device.
99 // 2. Disable keypad interrupt.
100 // Author: Xueliang.Wang
102 /*****************************************************************************/
103 PUBLIC void KPD_Close (void);
105 /*below are removed from driver_export.c, wait clean up*/
106 /*****************************************************************************/
107 // Description: check pbutton's state
108 // Global resource dependence:
110 // Note: return SCI_TRUE if pressed, else return SCI_FALSE
111 /*****************************************************************************/
112 uint32 CheckPowerButtonState (void);
114 /*****************************************************************************/
115 // Description: check if pbutton is released
116 // Global resource dependence:
118 // Note: return SCI_TRUE if released, else return SCI_FALSE
119 /*****************************************************************************/
120 uint32 IsPowerButtonReleased (void);
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);
131 /**---------------------------------------------------------------------------*
133 **---------------------------------------------------------------------------*/
138 #endif // _KPD_DRVAPI_H_