rjw | 6c1fd8f | 2022-11-30 14:33:01 +0800 | [diff] [blame] | 1 | /***************************************************************************** |
| 2 | * Copyright Statement: |
| 3 | * -------------------- |
| 4 | * This software is protected by Copyright and the information contained |
| 5 | * herein is confidential. The software may not be copied and the information |
| 6 | * contained herein may not be used or disclosed except with the written |
| 7 | * permission of MediaTek Inc. (C) 2005 |
| 8 | * |
| 9 | * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES |
| 10 | * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") |
| 11 | * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON |
| 12 | * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, |
| 13 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF |
| 14 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. |
| 15 | * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE |
| 16 | * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR |
| 17 | * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH |
| 18 | * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO |
| 19 | * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S |
| 20 | * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. |
| 21 | * |
| 22 | * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE |
| 23 | * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, |
| 24 | * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, |
| 25 | * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO |
| 26 | * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. |
| 27 | * |
| 28 | * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE |
| 29 | * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF |
| 30 | * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND |
| 31 | * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER |
| 32 | * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC). |
| 33 | * |
| 34 | *****************************************************************************/ |
| 35 | |
| 36 | /***************************************************************************** |
| 37 | * |
| 38 | * Filename: |
| 39 | * --------- |
| 40 | * serial_interface.c |
| 41 | * |
| 42 | * Project: |
| 43 | * -------- |
| 44 | * Maui_Software |
| 45 | * |
| 46 | * Description: |
| 47 | * ------------ |
| 48 | * This Module defines Touch Panel Interface. |
| 49 | * |
| 50 | * Author: |
| 51 | * ------- |
| 52 | * ------- |
| 53 | * |
| 54 | *============================================================================ |
| 55 | * HISTORY |
| 56 | * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 57 | *------------------------------------------------------------------------------ |
| 58 | * removed! |
| 59 | * removed! |
| 60 | * removed! |
| 61 | * removed! |
| 62 | * removed! |
| 63 | * removed! |
| 64 | * removed! |
| 65 | * |
| 66 | * removed! |
| 67 | * removed! |
| 68 | * removed! |
| 69 | * |
| 70 | * removed! |
| 71 | * removed! |
| 72 | * removed! |
| 73 | * |
| 74 | * removed! |
| 75 | * removed! |
| 76 | * removed! |
| 77 | * |
| 78 | * removed! |
| 79 | * removed! |
| 80 | * removed! |
| 81 | * |
| 82 | *------------------------------------------------------------------------------ |
| 83 | * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 84 | *============================================================================ |
| 85 | ****************************************************************************/ |
| 86 | #ifndef TOUCH_PANEL__H |
| 87 | #define TOUCH_PANEL__H |
| 88 | #include "eint.h" |
| 89 | #include "intrCtrl.h" |
| 90 | #include "dcl_hts.h" |
| 91 | #include "kal_public_api.h" |
| 92 | |
| 93 | #if defined(__TOUCH_PANEL_CAPACITY__) |
| 94 | #define TOUCH_PANEL_BUFFER_SIZE 512*16 //size MUST be exponential of 2 |
| 95 | #define CTP_SUPPORT_POINTS 5 |
| 96 | #define CTP_EVENT_HEADER 8 |
| 97 | #define BASIC_EVENT_UNIT CTP_EVENT_HEADER + 40 // size of TouchPanelMultipleEventStruct |
| 98 | |
| 99 | #else |
| 100 | #define TOUCH_PANEL_BUFFER_SIZE 512 |
| 101 | #define BASIC_EVENT_UNIT 13 // 5 -> 7, for 2 more time stamp. |
| 102 | #endif//#if defined(__TOUCH_PANEL_CAPACITY__) |
| 103 | |
| 104 | #define TOUCH_PANEL_BUFFER_HIGH_THRES TOUCH_PANEL_BUFFER_SIZE*90/100 |
| 105 | #define TOUCH_PANEL_BUFFER_LOW_THRES TOUCH_PANEL_BUFFER_SIZE*80/100 |
| 106 | #define HAND_WRITING_AREA_NUM 3 |
| 107 | |
| 108 | #if !defined(DRV_TOUCH_PANEL_CUSTOMER_PARAMETER) |
| 109 | #define MIN_PEN_MOVE_OFFSET 5 |
| 110 | #define HAND_WRITING_MAX_OFFSET 50 |
| 111 | #define NONHAND_WRITING_MAX_OFFSET 100 |
| 112 | #define MAX_STROKE_MOVE_OFFSET 1 |
| 113 | |
| 114 | #if defined(TRULY_HVGA_LCM) |
| 115 | #define TOUCH_PANEL_CALI_CHECK_OFFSET 12 |
| 116 | #else |
| 117 | #define TOUCH_PANEL_CALI_CHECK_OFFSET 6 |
| 118 | #endif //#if defined(TRULY_HVGA_LCM) |
| 119 | #endif //#if !defined(DRV_TOUCH_PANEL_CUSTOMER_PARAMETER) |
| 120 | |
| 121 | #define MAX_ADC_VALUE 4095 |
| 122 | |
| 123 | #define touch_down_level LEVEL_LOW /*touch down level*/ |
| 124 | #define touch_up_level LEVEL_HIGH /*touch up level*/ |
| 125 | |
| 126 | #if !defined(IRQ_TS_CODE) |
| 127 | #if defined(DRV_TP_6516_AP_SETTING) |
| 128 | #define IRQ_TS_CODE IRQ_TOUCHSCREEN_CODE |
| 129 | #elif defined(DRV_TP_IRQ_TPC) |
| 130 | #define IRQ_TS_CODE IRQ_TPC_CODE |
| 131 | #else |
| 132 | #define IRQ_TS_CODE IRQ_AUXADC_CODE |
| 133 | #endif |
| 134 | #endif//#if !defined(IRQ_TS_CODE) |
| 135 | |
| 136 | #define CTP_PATTERN 0xAA |
| 137 | |
| 138 | typedef enum { |
| 139 | CTP_NO_POINT, |
| 140 | CTP_GESTURE, //save the gesture information in one point event |
| 141 | CTP_1POINT=1, |
| 142 | CTP_2POINTS, |
| 143 | CTP_3POINTS, |
| 144 | CTP_4POINTS, |
| 145 | CTP_5POINTS, |
| 146 | CTP_6POINTS, |
| 147 | CTP_7POINTS, |
| 148 | CTP_8POINTS, |
| 149 | CTP_9POINTS, |
| 150 | CTP_10POINTS, |
| 151 | //add new detection type before unknown |
| 152 | CTP_UNKNOWN |
| 153 | } CTP_EVENT_NUMBER_ENUM; |
| 154 | |
| 155 | typedef struct |
| 156 | { |
| 157 | // Touch_Panel_Event_enum |
| 158 | kal_uint16 event; |
| 159 | /*coordinate point, not diff*/ |
| 160 | kal_uint16 x; |
| 161 | kal_uint16 y; |
| 162 | kal_uint16 z; //resistance TP: presure, capacitive TP: area |
| 163 | } TP_SINGLE_EVENT_T; |
| 164 | |
| 165 | typedef enum { |
| 166 | UP, |
| 167 | DOWN |
| 168 | } Touch_Panel_PenState_enum; |
| 169 | |
| 170 | typedef enum { |
| 171 | CTP_LAST_EVENT_GET, |
| 172 | CTP_LAST_EVENT_SET |
| 173 | } Touch_Panel_Handle_LastEvent_enum; |
| 174 | |
| 175 | typedef enum { |
| 176 | HAND_WRITING, |
| 177 | NON_HAND_WRITING |
| 178 | } Touch_Panel_Area_enum; |
| 179 | typedef enum { |
| 180 | PEN_DOWN, /*0*/ |
| 181 | PEN_UP, /*1*/ |
| 182 | PEN_MOVE, /*2*/ |
| 183 | PEN_LONGTAP, /*3*/ |
| 184 | PEN_REPEAT, /*4*/ |
| 185 | PEN_ABORT, /*5*/ |
| 186 | TP_UNKNOWN_EVENT,/*6*/ |
| 187 | STROKE_MOVE, /*7*/ |
| 188 | STROKE_STATICAL, /*8*/ |
| 189 | STROKE_HOLD, /*9*/ |
| 190 | PEN_LONGTAP_HOLD, /*10*/ |
| 191 | PEN_REPEAT_HOLD, /*11*/ |
| 192 | STROKE_DOWN_, /*12*/ |
| 193 | STROKE_LONGTAP_, /*13*/ |
| 194 | STROKE_UP_,/*14*/ |
| 195 | STROKE_DOWN=0xc0, /*0*/ /*1*/ |
| 196 | STROKE_LONGTAP=0x7e, /*8*/ |
| 197 | STROKE_UP=0x7f/*127*/ |
| 198 | } Touch_Panel_Event_enum; |
| 199 | typedef kal_uint16 (*CTP_FUNC)(kal_int16 x_diff, kal_int16 y_diff, kal_uint16 count); |
| 200 | |
| 201 | typedef struct |
| 202 | { |
| 203 | kal_int16 x; /*x coordinate*/ |
| 204 | kal_int16 y; /*y coordinate*/ |
| 205 | }TouchPanelCoordStruct; |
| 206 | typedef struct |
| 207 | { |
| 208 | TouchPanelCoordStruct min; |
| 209 | TouchPanelCoordStruct max; |
| 210 | }TouchPanelHandAreaStruct; |
| 211 | |
| 212 | typedef struct |
| 213 | { |
| 214 | /*x*/ |
| 215 | double x_slope; |
| 216 | double x_offset; |
| 217 | /*y*/ |
| 218 | double y_slope; |
| 219 | double y_offset; |
| 220 | }TouchPanelCaliStruct ; |
| 221 | typedef void (*TP_EVENT_FUNC)(void *parameter, Touch_Panel_Event_enum state) ; |
| 222 | typedef struct |
| 223 | { |
| 224 | kal_eventgrpid event; /*event id*/ |
| 225 | kal_uint8 gpthandle; /*gpt handle*/ |
| 226 | kal_uint8 eint_chan; |
| 227 | kal_uint32 longtap_cnt; /*LongTap cnt*/ |
| 228 | kal_uint32 handwriting_longtap_cnt; /*LongTap cnt*/ |
| 229 | kal_uint32 repeat_cnt; /*Repeat cnt*/ |
| 230 | kal_uint32 low_sample_period; |
| 231 | kal_uint32 high_sample_period; |
| 232 | TouchPanelHandAreaStruct handarea[HAND_WRITING_AREA_NUM]; /*hand area*/ |
| 233 | TouchPanelHandAreaStruct ext_handarea; /*extended area*/ |
| 234 | kal_uint16 hand_num; |
| 235 | kal_bool ext_enable; /*extended stroke or not*/ |
| 236 | TouchPanelCoordStruct cur; /*current point coord.*/ |
| 237 | TouchPanelCoordStruct pre; /*previous point coord.*/ |
| 238 | TouchPanelCoordStruct temp; /*previous point coord.*/ |
| 239 | TouchPanelCoordStruct begin; /*the first down point coord.*/ |
| 240 | TP_EVENT_FUNC touch_panel_event_cb; |
| 241 | void *cb_para; |
| 242 | Touch_Panel_Area_enum area; /*(non)handwriting*/ |
| 243 | Touch_Panel_PenState_enum state; /*Down or UP*/ |
| 244 | kal_bool skip_unrelease_enable; |
| 245 | kal_bool skip_unrelease_state; |
| 246 | kal_bool is_buff_full; |
| 247 | kal_bool wait_next_down; /*inidcate if the down point reasonable*/ |
| 248 | kal_uint16 pen_offset; /*pen move offset*/ |
| 249 | kal_uint16 longtap_pen_offset;/*longtap pen move offset*/ |
| 250 | kal_uint16 longtap_stroke_offset; /*longtap stroke move offset*/ |
| 251 | kal_uint16 storke_offset; /*stroke offset*/ |
| 252 | kal_bool longtap_state; /*wait longtap timeout or not*/ |
| 253 | #if defined(DRV_TOUCH_PANEL_PAIR_GUARANTEE) |
| 254 | Touch_Panel_Event_enum buffer_push_stat; |
| 255 | TouchPanelCoordStruct buffer_push_point; /*previous point coord.*/ |
| 256 | #endif //#if defined(DRV_TOUCH_PANEL_PAIR_GUARANTEE) |
| 257 | |
| 258 | DCL_HANDLE hts_handle; |
| 259 | PFN_DCL_CALLBACK tp_down_cb; |
| 260 | void * tp_down_cb_para; |
| 261 | PFN_DCL_CALLBACK tp_up_cb; |
| 262 | void * tp_up_cb_para; |
| 263 | |
| 264 | }TouchPanelDataStruct; |
| 265 | |
| 266 | typedef struct |
| 267 | { |
| 268 | kal_int16 x_adc; |
| 269 | kal_int16 y_adc; |
| 270 | Touch_Panel_Event_enum event; |
| 271 | kal_uint16 time_stamp; // unit: system tick |
| 272 | }TouchPanelEventStruct; |
| 273 | |
| 274 | typedef struct |
| 275 | { |
| 276 | kal_uint16 model; // Single/Dual/Triple/Four/Five/All gesture |
| 277 | kal_uint16 padding; //currently use for check the structure format correctness, 0xAA |
| 278 | kal_uint32 time_stamp; |
| 279 | TP_SINGLE_EVENT_T points[5]; |
| 280 | } TouchPanelMultipleEventStruct; |
| 281 | |
| 282 | |
| 283 | typedef struct |
| 284 | { |
| 285 | kal_uint8 touch_panel_data[TOUCH_PANEL_BUFFER_SIZE]; |
| 286 | kal_uint16 touch_buffer_rindex; |
| 287 | kal_uint16 touch_buffer_windex; |
| 288 | #if defined(__TOUCH_PANEL_CAPACITY__) |
| 289 | kal_uint16 touch_buffer_last_rindex; |
| 290 | kal_uint16 touch_buffer_last_windex; |
| 291 | #endif |
| 292 | }TouchPanelBufferStruct; |
| 293 | |
| 294 | typedef struct { |
| 295 | #if defined(DRV_TOUCH_PANEL_CUSTOMER_PARAMETER) |
| 296 | kal_uint32 ts_debounce_time; //TS_DEBOUNCE_TIME |
| 297 | kal_uint32 touch_panel_cali_check_offset; |
| 298 | kal_uint32 min_pen_move_offset;// MIN_PEN_MOVE_OFFSET = 10; |
| 299 | kal_uint32 hand_writing_max_offset;// HAND_WRITING_MAX_OFFSET = 50; |
| 300 | kal_uint32 nonhand_writing_max_offset;// NONHAND_WRITING_MAX_OFFSET = 100; |
| 301 | kal_uint32 max_stroke_move_offset;// MAX_STROKE_MOVE_OFFSET = 1; |
| 302 | kal_uint32 touch_pressure_threshold_high;// TOUCH_PRESSURE_THRESHOLD_HIGH=6000; |
| 303 | #if defined(DRV_TOUCH_PANEL_MULTIPLE_PICK) |
| 304 | kal_uint32 multiple_point_selection;// MULTIPLE_POINT_SELECTION= 3; |
| 305 | #endif //#if defined(DRV_TOUCH_PANEL_MULTIPLE_PICK) |
| 306 | #if defined(__DRV_TP_DISCARD_SHIFTING__) |
| 307 | kal_uint32 pressure_check_boundary;// PRESSURE_CHECK_BOUNDARY = 2000; |
| 308 | kal_uint32 pressure_shifting_boundary;// PRESSURE_SHIFTING_BOUNDARY = 800; |
| 309 | #endif //#if defined(__DRV_TP_DISCARD_SHIFTING__) |
| 310 | #endif //#if defined(DRV_TOUCH_PANEL_CUSTOMER_PARAMETER) |
| 311 | kal_int32 touch_panel_filter_thresold; |
| 312 | /*ADC*/ |
| 313 | kal_int32 x_adc_start; |
| 314 | kal_int32 x_adc_end; |
| 315 | kal_int32 y_adc_start; |
| 316 | kal_int32 y_adc_end; |
| 317 | /*Coord.*/ |
| 318 | kal_int32 x_coord_start; |
| 319 | kal_int32 x_coord_end; |
| 320 | kal_int32 y_coord_start; |
| 321 | kal_int32 y_coord_end; |
| 322 | /*Size.*/ |
| 323 | kal_int32 x_millimeter; |
| 324 | kal_int32 y_millimeter; |
| 325 | /*EINT*/ |
| 326 | kal_uint8 eint_down_level; |
| 327 | } TouchPanel_custom_data_struct; |
| 328 | |
| 329 | typedef struct { |
| 330 | TouchPanel_custom_data_struct * (*tp_get_data)(void); |
| 331 | void (*tp_read_adc)(kal_uint16 *x, kal_uint16 *y); |
| 332 | #ifdef TOUCH_PANEL_PRESSURE |
| 333 | kal_bool (*tp_pressure_check)(void); |
| 334 | #endif |
| 335 | void (*tp_irq_enable)(kal_bool on); |
| 336 | }TouchPanel_customize_function_struct; |
| 337 | |
| 338 | typedef enum { |
| 339 | CTP_PARA_START, |
| 340 | CTP_PARA_RESOLUTION=1, |
| 341 | CTP_PARA_THRESHOLD=2, |
| 342 | CTP_PARA_REPORT_INTVAL=4, |
| 343 | CTP_PARA_IDLE_INTVAL=8, |
| 344 | CTP_PARA_SLEEP_INTVAL=0x10, |
| 345 | CTP_PARA_END |
| 346 | } CTP_parameters_enum; |
| 347 | |
| 348 | typedef struct |
| 349 | { |
| 350 | kal_uint16 resolution; // CTP_RESOLTION, |
| 351 | kal_uint16 threshold; // CTP_THRESHOLD, |
| 352 | kal_uint16 Report_interval; |
| 353 | kal_uint16 Idle_time_interval; |
| 354 | kal_uint16 sleep_time_interval; |
| 355 | kal_uint16 gesture_active_distance; |
| 356 | kal_uint16 MS_calibration[128]; |
| 357 | }CTP_parameters_struct;// ctp_get_set_enum |
| 358 | |
| 359 | typedef struct |
| 360 | { |
| 361 | char vendor[8]; |
| 362 | char product[8]; |
| 363 | char FirmwareVersion[8]; |
| 364 | }CTP_custom_information_struct; |
| 365 | |
| 366 | typedef enum { |
| 367 | CTP_ACTIVE_MODE, |
| 368 | CTP_IDLE_MODE, |
| 369 | CTP_SLEEP_MODE, |
| 370 | CTP_GESTURE_DETECTION_MODE, |
| 371 | CTP_MULTIPLE_POINT_MODE, |
| 372 | CTP_FIRMWARE_UPDATE, |
| 373 | CTP_FM_ENABLE, |
| 374 | CTP_FM_DISABLE |
| 375 | }ctp_device_mode_enum; |
| 376 | |
| 377 | typedef struct{ |
| 378 | kal_bool (*ctp_init)(void); |
| 379 | kal_bool (*ctp_set_device_mode)(ctp_device_mode_enum); |
| 380 | Touch_Panel_PenState_enum (*ctp_hisr)(void); |
| 381 | kal_bool (*ctp_get_data)(TouchPanelMultipleEventStruct *); |
| 382 | kal_bool (*ctp_parameters)(CTP_parameters_struct *, kal_uint32, kal_uint32); |
| 383 | void (*ctp_power_on)(kal_bool); |
| 384 | kal_uint32 (*ctp_command)(kal_uint32, void *, void *); |
| 385 | }CTP_customize_function_struct; |
| 386 | |
| 387 | /********************Function Declaration********************/ |
| 388 | /********************For upper layer*************************/ |
| 389 | void Touch_Panel_Ctrl_Param(DCL_CTRL_CUSTOM_PARAM_T param); |
| 390 | void Touch_Panel_Ctrl_Param_Range(DCL_CTRL_CUSTOM_PARAM_RANGE_T param); |
| 391 | void Touch_Panel_MicronMeter_To_Coord(DCL_CTRL_MICRONMETER_COORD_T* pparam); |
| 392 | void Touch_Panel_Coord_To_MicronMeter(DCL_CTRL_MICRONMETER_COORD_T* pparam ); |
| 393 | |
| 394 | |
| 395 | void touch_panel_enable_(kal_bool enable);/*enable/disable touch panel*/ |
| 396 | kal_bool touch_panel_get_event_(TouchPanelMultipleEventStruct *touch_data);/*get touch event*/ |
| 397 | void touch_panle_conf_timeout_period_(kal_uint32 longtap, |
| 398 | kal_uint32 repeat, |
| 399 | kal_uint32 handwriting_longtap); |
| 400 | void touch_panle_conf_sample_period_(kal_uint32 low, kal_uint32 high); |
| 401 | void touch_panel_flush_(void);/*flsuh data in ring buffer*/ |
| 402 | void touch_panel_start_cali_(TouchPanelCoordStruct *point, kal_uint16 num); |
| 403 | void touch_panel_stop_cali_(void); |
| 404 | void touch_panel_read_cali_(TouchPanelCaliStruct *cali); |
| 405 | void touch_panel_set_cali_(TouchPanelCaliStruct cali); |
| 406 | void touch_panel_reset_(kal_bool skip_unrelease_enable); |
| 407 | void touch_panel_reset_handwriting_(void); |
| 408 | void touch_panel_conf_move_offset_(kal_uint16 pen_offset, kal_uint16 stroke_offset, |
| 409 | kal_uint16 longtap_pen_offset, |
| 410 | kal_uint16 longtap_stroke_offset); |
| 411 | void touch_panel_conf_handwriting_(TouchPanelHandAreaStruct *area, kal_uint16 n, |
| 412 | TouchPanelHandAreaStruct *ext_area); |
| 413 | void touch_panel_cb_registration_ (TP_EVENT_FUNC function, void *parameter); |
| 414 | void Touch_Panel_Pixel_To_MicronMeter(DCL_CTRL_MICRONMETER_COORD_T* pparam); |
| 415 | void Touch_Panel_MicronMeter_To_Coord(DCL_CTRL_MICRONMETER_COORD_T* pparam); |
| 416 | #if defined(__TOUCH_PANEL_CAPACITY__) |
| 417 | void touch_panel_capacitive_up_hdr(DCL_EVENT event); |
| 418 | void touch_panel_capacitive_down_hdr(DCL_EVENT event); |
| 419 | void touch_panel_capacitive_power_on(kal_bool on); |
| 420 | kal_bool touch_panel_capacitive_set_device(ctp_device_mode_enum mode); |
| 421 | kal_uint32 touch_panel_capacitive_command(kal_uint32 cmd, void *p1, void*p2); |
| 422 | #endif //#if defined(__TOUCH_PANEL_CAPACITY__) |
| 423 | /********************For touch panel driver only*************/ |
| 424 | // MoDIS parser skip start |
| 425 | // The following are private APIs |
| 426 | #ifdef TOUCH_PANEL_PRESSURE |
| 427 | kal_bool tp_level(void); |
| 428 | kal_bool tp_level_pressure(kal_uint32 *pressure); |
| 429 | kal_uint32 tp_pressure_value(void); |
| 430 | kal_bool tp_pressure_check(void); |
| 431 | kal_bool tp_pressure_check_value(kal_uint32 *pressure); |
| 432 | #endif //#ifdef TOUCH_PANEL_PRESSURE |
| 433 | |
| 434 | void touch_panel_read_adc(kal_uint16 *x, kal_uint16 *y); |
| 435 | kal_bool touch_panel_adc_to_coordinate(kal_uint16 *x, kal_uint16 *y);/*tranlate*/ |
| 436 | void touch_panel_event_cb(void *parameter); |
| 437 | void touch_panel_repeat_cb(void *parameter); |
| 438 | void touch_panel_longtap_cb(void *parameter); |
| 439 | void touch_panel_stroke_cb(void *parameter); |
| 440 | void touch_panel_up_hdr(DCL_EVENT event); |
| 441 | void touch_panel_down_hdr(DCL_EVENT event); |
| 442 | void touch_panel_event_hdr(void); |
| 443 | void touch_start_longtap(void); |
| 444 | void touch_panel_stroke_hdr(void); |
| 445 | void touch_excute_cali(kal_uint16 x_adc, kal_uint16 y_adc); |
| 446 | void touch_panel_sendilm(void *para, Touch_Panel_Event_enum state); |
| 447 | void tp_data_pop(Touch_Panel_Event_enum event, kal_int16 x, kal_int16 y); |
| 448 | void tp_data_push(TP_SINGLE_EVENT_T* push_event); |
| 449 | |
| 450 | void touch_panel_init(void); |
| 451 | void touch_start_handwriting_longtap(void); |
| 452 | // MoDIS parser skip end |
| 453 | /*variable*/ |
| 454 | extern TouchPanelDataStruct TP; |
| 455 | extern Touch_Panel_Event_enum touch_panel_track_stauts; /*pen/stroke status*/ |
| 456 | extern TouchPanelBufferStruct touch_panel_data_buffer; |
| 457 | extern TouchPanelCoordStruct pre_coord; |
| 458 | extern TouchPanelCoordStruct tp_stroke_pre; |
| 459 | |
| 460 | #if defined(__DRV_COMM_REG_DBG__) && defined(__DRV_TP_REG_DBG__) |
| 461 | #define DRV_TP_WriteReg(addr,data) DRV_DBG_WriteReg(addr,data) |
| 462 | #define DRV_TP_Reg(addr) DRV_DBG_Reg(addr) |
| 463 | #define DRV_TP_WriteReg32(addr,data) DRV_DBG_WriteReg32(addr,data) |
| 464 | #define DRV_TP_Reg32(addr) DRV_DBG_Reg32(addr) |
| 465 | #define DRV_TP_WriteReg8(addr,data) DRV_DBG_WriteReg8(addr,data) |
| 466 | #define DRV_TP_Reg8(addr) DRV_DBG_Reg8(addr) |
| 467 | #define DRV_TP_ClearBits(addr,data) DRV_DBG_ClearBits(addr,data) |
| 468 | #define DRV_TP_SetBits(addr,data) DRV_DBG_SetBits(addr,data) |
| 469 | #define DRV_TP_SetData(addr, bitmask, value) DRV_DBG_SetData(addr, bitmask, value) |
| 470 | #define DRV_TP_ClearBits32(addr,data) DRV_DBG_ClearBits32(addr,data) |
| 471 | #define DRV_TP_SetBits32(addr,data) DRV_DBG_SetBits32(addr,data) |
| 472 | #define DRV_TP_SetData32(addr, bitmask, value) DRV_DBG_SetData32(addr, bitmask, value) |
| 473 | #define DRV_TP_ClearBits8(addr,data) DRV_DBG_ClearBits8(addr,data) |
| 474 | #define DRV_TP_SetBits8(addr,data) DRV_DBG_SetBits8(addr,data) |
| 475 | #define DRV_TP_SetData8(addr, bitmask, value) DRV_DBG_SetData8(addr, bitmask, value) |
| 476 | #else |
| 477 | #define DRV_TP_WriteReg(addr,data) DRV_WriteReg(addr,data) |
| 478 | #define DRV_TP_Reg(addr) DRV_Reg(addr) |
| 479 | #define DRV_TP_WriteReg32(addr,data) DRV_WriteReg32(addr,data) |
| 480 | #define DRV_TP_Reg32(addr) DRV_Reg32(addr) |
| 481 | #define DRV_TP_WriteReg8(addr,data) DRV_WriteReg8(addr,data) |
| 482 | #define DRV_TP_Reg8(addr) DRV_Reg8(addr) |
| 483 | #define DRV_TP_ClearBits(addr,data) DRV_ClearBits(addr,data) |
| 484 | #define DRV_TP_SetBits(addr,data) DRV_SetBits(addr,data) |
| 485 | #define DRV_TP_SetData(addr, bitmask, value) DRV_SetData(addr, bitmask, value) |
| 486 | #define DRV_TP_ClearBits32(addr,data) DRV_ClearBits32(addr,data) |
| 487 | #define DRV_TP_SetBits32(addr,data) DRV_SetBits32(addr,data) |
| 488 | #define DRV_TP_SetData32(addr, bitmask, value) DRV_SetData32(addr, bitmask, value) |
| 489 | #define DRV_TP_ClearBits8(addr,data) DRV_ClearBits8(addr,data) |
| 490 | #define DRV_TP_SetBits8(addr,data) DRV_SetBits8(addr,data) |
| 491 | #define DRV_TP_SetData8(addr, bitmask, value) DRV_SetData8(addr, bitmask, value) |
| 492 | #endif //#if defined(__DRV_COMM_REG_DBG__) && defined(__DRV_TP_REG_DBG__) |
| 493 | #if defined(__MTK_INTERNAL__) && !defined(__MAUI_BASIC__) && defined(__DRV_DBG_MEMORY_TRACE_SUPPORT__) && defined(__DRV_TP_MEMORY_TRACE__) |
| 494 | typedef struct{ |
| 495 | kal_uint16 tag; |
| 496 | kal_uint32 time; |
| 497 | kal_uint32 data1; |
| 498 | kal_uint32 data2; |
| 499 | }TP_DRV_DBG_DATA; |
| 500 | #define MAX_TP_DRV_DBG_INFO_SIZE 16 |
| 501 | typedef struct{ |
| 502 | TP_DRV_DBG_DATA dbg_data[MAX_TP_DRV_DBG_INFO_SIZE]; |
| 503 | kal_uint16 dbg_data_idx; |
| 504 | }TP_DRV_DBG_STRUCT; |
| 505 | extern void tp_drv_dbg_trace(kal_uint16 index, kal_uint32 time, kal_uint32 data1, kal_uint32 data2); |
| 506 | #define TP_DBG(a,b,c,d) tp_drv_dbg_trace(a,b,c,d); |
| 507 | #include "us_timer.h" |
| 508 | extern kal_uint32 L1I_GetTimeStamp(void); |
| 509 | #define TP_GetTimeStamp L1I_GetTimeStamp |
| 510 | #else //#if defined(__MTK_INTERNAL__) && !defined(LOW_COST_SUPPORT) |
| 511 | #define TP_DBG(a,b,c,d) ; |
| 512 | #endif //#if defined(__MTK_INTERNAL__) && !defined(LOW_COST_SUPPORT) |
| 513 | #endif |
| 514 | |