DclS_kbd.h
10.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
/*****************************************************************************
* Copyright Statement:
* --------------------
* This software is protected by Copyright and the information contained
* herein is confidential. The software may not be copied and the information
* contained herein may not be used or disclosed except with the written
* permission of MediaTek Inc. (C) 2001
*
*****************************************************************************/
/*****************************************************************************
*
* Filename:
* ---------
* dcl_kbd.h
*
* Project:
* --------
* Maui
*
* Description:
* ------------
* Header file of DCL (Driver Common Layer) for KBD.
*
* Author:
* -------
* -------
*
*============================================================================
* HISTORY
* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*------------------------------------------------------------------------------
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*------------------------------------------------------------------------------
* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*============================================================================
****************************************************************************/
#ifdef DCL_DEFINITION_STRUCT
#ifndef __DCLS_KBD_H_STRUCT__
#define __DCLS_KBD_H_STRUCT__
#ifdef __BUILD_DOM__
/*keypad driver control commands which is related with software layer*/
typedef enum
{
KBD_CMD_SET_LONG_PRESS_TIME, /*Set the long press key time*/
KBD_CMD_SET_REPEAT_PRESS_TIME, /*Set the repeat press key time*/
KBD_CMD_SET_DETECTION_MODE, /*Set the key detection mode*/
KBD_CMD_GET_KEY_DATA, /*get the press key data*/
KBD_CMD_PEEK_KEY_DATA,/*peek the press key data*/
KBD_CMD_GET_DETECTION_MODE,/*get the current key detection mode*/
KBD_CMD_CTRL_KEY_SUPPORT,/*query the key is support or not */
KBD_CMD_CTRL_KEY_MULTIPLE,/*query the key is multiple key or not*/
KBD_CMD_GET_KEY_EVENT_CNT,/*get the key event in the buffer*/
KBD_CMD_PUT_KEY_DATA,/*put the key press data to the upper layer*/
}KBD_CMDS;
#else
#define KBD_CMDS \
KBD_CMD_SET_LONG_PRESS_TIME, \
KBD_CMD_SET_REPEAT_PRESS_TIME, \
KBD_CMD_SET_DETECTION_MODE, \
KBD_CMD_GET_KEY_DATA, \
KBD_CMD_PEEK_KEY_DATA,\
KBD_CMD_GET_DETECTION_MODE,\
KBD_CMD_CTRL_KEY_SUPPORT,\
KBD_CMD_CTRL_KEY_MULTIPLE,\
KBD_CMD_GET_KEY_EVENT_CNT,\
KBD_CMD_PUT_KEY_DATA,\
KBD_CMD_FIND_TWO_STEP,
#endif
/*keypad events to the upper layer*/
typedef enum {
DCL_kbd_onekey_press=0,/*one key press event*/
DCL_kbd_onekey_release,/*one key release event*/
#ifdef TWO_KEY_ENABLE
DCL_kbd_twokey_press, /*two key press event, which has been phase out now */
DCL_kbd_twokey_release,/*two key release event, which has been phase out now*/
#endif /*TWO_KEY_ENABLE*/
DCL_kbd_onekey_longpress,/*one long press key event*/
DCL_kbd_onekey_repeated,/*one repeated press key event*/
DCL_kbd_onekey_fullpress,/*two step key function: one key full press event*/
DCL_kbd_twokey_detection_enable,/*enable two key detection mode*/
DCL_kbd_threekey_detection_enable,/*enable three key detection mode*/
DCL_kbd_multikey_detection_disable/*multiple key detection mode is disable, default is one key detection mode*/
} DCL_KBD_EVENT;
/*key detection mode*/
typedef enum {
DCL_kbd_1_key_det_mode = 0, /*one key detection mode*/
DCL_kbd_2_keys_det_mode,/*two key detection mode */
DCL_kbd_3_keys_det_mode /*three key detection mode*/
}DCL_kbd_key_det_mode;
/*the control command data for command:KBD_CMD_SET_DETECTION_MODE and KBD_CMD_GET_DETECTION_MODE */
typedef struct
{
DCL_BOOL bFlag;/*the return flag to indicate whether switch mode successfully*/
DCL_UINT8 Det_Mode;/*the detection mode value*/
} SKBD_CTRL_MODE_T;
/*the control command data for command:KBD_CMD_GET_KEY_EVENT_CNT*/
typedef struct
{
DCL_UINT8 keycnt;/*the key event count in the buffer*/
}SKBD_CTRL_KEY_CNT_T;
/*the control command data for command:KBD_CMD_GET_KEY_DATA*/
typedef struct
{
DCL_KBD_EVENT Keyevent;/*the key event*/
#ifdef TWO_KEY_ENABLE
DCL_UINT8 Keydata[2];/*the key data*/
#else /*!TWO_KEY_ENABLE*/
DCL_UINT8 Keydata[1];/*the key data*/
#endif /*TWO_KEY_ENABLE*/
#if defined(__TC01__)
/* under construction !*/
#endif
} SKBD_CTRL_KEYDATA_T;
/*the control command data for command:KBD_CMD_PEEK_KEY_DATA*/
typedef struct
{
SKBD_CTRL_KEYDATA_T* keydata;/*the key data */
DCL_BOOL specify_read; /*specify whether to read the data in the position of read_pointerl; KAL_TURE:specify to peek the data
in the position:read_pointer;KAL_FALSE: return the current read pointer data to the upper layer*/
DCL_UINT32 read_pointer;/*the read position in the buffer, the max value is buff_size;*/
DCL_UINT32* current_read_pointer;/*return the data in the structure position*/
}SKBD_CTRL_PEEKDATA_T;
/*the control command data for command:KBD_CMD_CTRL_KEY_MULTIPLE*/
typedef struct
{
DCL_BOOL fgIMK;/*the return value to indicate whether the ukey is a multiple key*/
DCL_UINT8 uKey; /*the input parameter to indicate the key index*/
} SKBD_CTRL_MULTIKEY_T;
/*the control command data for command:KBD_CMD_CTRL_KEY_SUPPORT*/
typedef struct
{
DCL_UINT8 uKey;/*the input parameter to indicate the key index*/
DCL_BOOL fgIKBS;/*the return flag to indicate whether the ukey *is supported*/
} SKBD_CTRL_KEYSUPPORT_T;
/*the control command data for command:KBD_CMD_SET_LONG_PRESS_TIME and KBD_CMD_SET_REPEAT_PRESS_TIME*/
typedef struct
{
DCL_UINT32 u4Tick;/*the time unit is ms.*/
} SKBD_CTRL_TIME_T;
/*the control command data for command:KBD_CMD_PUT_KEY_DATA */
typedef struct
{
DCL_UINT8 keydata;/*the key index number*/
}SKBD_CTRL_PUTKEY_T;
typedef struct
{
DCL_UINT32 *number;
DCL_UINT8 *two_step;
}SKBD_CTRL_FIND_TWO_STEP_T;
#ifdef __BUILD_DOM__
/*define the data structure type for every command*/*/
typedef union
{
SKBD_CTRL_TIME_T rKBDCtrTime; /*the long press and repeat press time */
SKBD_CTRL_KEYSUPPORT_T rKBDCtrlKeySupport; /*the key support structure*/
SKBD_CTRL_MULTIKEY_T rKBDCtrlMultiple; /*the multiply key structure*/
SKBD_CTRL_PEEKDATA_T rKBDCtrPeekData; /*peek key data command control data structure*/
SKBD_CTRL_KEYDATA_T rKBDCtrGetData; /*get key data command control data structure*/
SKBD_CTRL_MODE_T rKBDCtrMode; /*detection command control data structure*/
SKBD_CTRL_KEY_CNT_T rKBDCtrkeyCnt;/*get key event count command control data structure*/
SKBD_CTRL_PUTKEY_T rKBDCtrPutKey;/*put key data command control data structure*/
SKBD_CTRL_FIND_TWO_STEP_T rKBDCtrlFindTwoStepKey;
}KBDS_CTRLS;
#else
#define KBDS_CTRLS \
SKBD_CTRL_TIME_T rKBDCtrTime; \
SKBD_CTRL_KEYSUPPORT_T rKBDCtrlKeySupport; \
SKBD_CTRL_MULTIKEY_T rKBDCtrlMultiple; \
SKBD_CTRL_PEEKDATA_T rKBDCtrPeekData; \
SKBD_CTRL_KEYDATA_T rKBDCtrGetData; \
SKBD_CTRL_MODE_T rKBDCtrMode;\
SKBD_CTRL_KEY_CNT_T rKBDCtrkeyCnt;\
SKBD_CTRL_PUTKEY_T rKBDCtrPutKey;\
SKBD_CTRL_FIND_TWO_STEP_T rKBDCtrlFindTwoStepKey;
#endif
#endif
#endif
#ifdef DCL_DEFINITION_PROTOTYPE
#ifndef __DCL_SKBD_H_PROTOTYPE__
#define __DCL_SKBD_H_PROTOTYPE__
/*************************************************************************
* FUNCTION
* DclSKBD_Initialize
*
* DESCRIPTION
* This function is to initialize keypad hardware module, It is called during the driver initialization.
*
* PARAMETERS
* None
*
* RETURNS
* STATUS_OK
*
*************************************************************************/
extern DCL_STATUS DclSKBD_Initialize(void);
/*************************************************************************
* FUNCTION
* DclSKBD_Open
*
* DESCRIPTION
* This function is to open the keypad hw module and return a handle.
*
* PARAMETERS
* dev: keypad device ID. it should be DCL_KBD.
* flags: User of keypad driver. It should be the user module id, if the user does not module id, it can be set 0.
*
* RETURNS
* DCL_HANDLE_INVALID: Incorrect device ID.
* Other value: A valid handle
*
* EXAMPLE
* <code>
* DCL_HANDLE kbd_handle;
* kbd_handle = DclSKBD_Open(DCL_KBD, MOD_DRVKBD);
* </code>
*
*************************************************************************/
extern DCL_HANDLE DclSKBD_Open(DCL_DEV dev, DCL_FLAGS flags);
/*************************************************************************
* FUNCTION
* DclSKBD_Close
*
* DESCRIPTION
* This function is to close the keypad driver.
*
* PARAMETERS
* handle: the user handler of the keypad, which is returned by the DclSKBD_Close function.
*
* RETURNS
* STATUS_OK: return successfully.
*
*************************************************************************/
extern DCL_STATUS DclSKBD_Close(DCL_HANDLE handle);
/*************************************************************************
* FUNCTION
* DclSKBD_Control
*
* DESCRIPTION
* This function is to control the keypad driver, the user can call the interface to get the keypad driver services through the different commands.
* the control services is responsible for the software related services, the keypad hardware related services can be accessed through the DCLH** interface.
* PARAMETERS
* handle: the user handler of the keypad, which is returned by the DclSKBD_Open function.
* cmd: the keypad driver control commands, the values can be get from the enum KBD_CMDS.
* data: the data which is corresponed to the commands, the data type can beone of the enum KBDS_CTRLS.
*
* RETURNS
* DCL_HANDLE_INVALID: Incorrect device ID.
*STATUS_BUFFER_EMPTY:indicate the buffer is empty, when the command KBD_CMD_GET_KEY_DATA or KBD_CMD_PEEK_KEY_DATA is used.
* STATUS_OK: return successfully.
*
* EXAMPLE
* <code>
* DCL_CTRL_DATA_T sta;
* DCL_HANDLE handle1;
* handle1 = DclSKBD_Open(DCL_KBD, MOD_MMI);
* DclSKBD_Control(handle1,KBD_CMD_GET_KEY_EVENT_CNT , (DCL_CTRL_DATA_T*)&sta);
*return sta.rKBDCtrkeyCnt.keycnt;
* </code>
*
*************************************************************************/
extern DCL_STATUS DclSKBD_Control(DCL_HANDLE handle, DCL_CTRL_CMD cmd, DCL_CTRL_DATA_T *data);
/*************************************************************************
* FUNCTION
* DclSKBD_RegisterCallback
*
* DESCRIPTION
* This function is to register the hardware event callback function.
*
* PARAMETERS
* handle: the user handler of the keypad, which is returned by the DclHKBD_Open function.
* event: Reserved.
* callback: the callback function pointer.
*
* RETURNS
* DCL_HANDLE_INVALID: Incorrect device ID.
* STATUS_INVALID_EVENT: the event parameter is not valid for the keypad.
* STATUS_OK: return successfully.
*
*************************************************************************/
extern DCL_STATUS DclSKBD_RegisterCallback(DCL_HANDLE handle, DCL_EVENT event,PFN_DCL_CALLBACK callback);
#endif
#endif