Commit | Line | Data |
---|---|---|
6fa3eb70 S |
1 | #ifndef TPD_DEBUG_H |
2 | #define TPD_DEBUG_H | |
3 | #ifdef TPD_DEBUG_CODE | |
4 | #include<linux/i2c.h> | |
5 | ||
6 | void tpd_debug_no_response(struct i2c_client *); | |
7 | extern int tpd_debug_nr; | |
8 | ||
9 | #define TPD_DEBUG_CHECK_NO_RESPONSE \ | |
10 | if(tpd_debug_nr) { \ | |
11 | wait_event_interruptible_timeout(waiter,tpd_flag!=0,HZ/10); \ | |
12 | if(tpd_flag==0) { \ | |
13 | tpd_debug_no_response(i2c_client); \ | |
14 | continue; \ | |
15 | } \ | |
16 | } else | |
17 | ||
18 | ||
19 | void tpd_debug_set_time(void); | |
20 | extern int tpd_debug_time; | |
21 | extern long tpd_last_2_int_time[2]; | |
22 | extern long tpd_last_down_time; | |
23 | extern int tpd_start_profiling; | |
24 | extern int tpd_down_status; | |
25 | ||
26 | #define TPD_DEBUG_PRINT_INT \ | |
27 | do { \ | |
28 | if(tpd_debug_time) { \ | |
29 | printk("tp_int\n"); \ | |
30 | } \ | |
31 | } while(0) | |
32 | ||
33 | #define TPD_DEBUG_PRINT_UP \ | |
34 | do { \ | |
35 | if(pending==0 && tpd_debug_time) { \ | |
36 | tpd_down_status=0; \ | |
37 | printk("up on %ld ms (+%ld ms)\n", \ | |
38 | (tpd_last_2_int_time[1] - tpd_last_down_time) / 1000, \ | |
39 | (tpd_last_2_int_time[1] - tpd_last_2_int_time[0]) / 1000); \ | |
40 | } \ | |
41 | } while(0) | |
42 | ||
43 | #define TPD_DEBUG_PRINT_DOWN \ | |
44 | do { \ | |
45 | if(tpd_debug_time) { \ | |
46 | if(tpd_down_status==0) printk("down on 0 ms\n"); \ | |
47 | else printk("move on %ld ms (+%ld ms)\n", \ | |
48 | (tpd_last_2_int_time[1] - tpd_last_down_time) / 1000, \ | |
49 | (tpd_last_2_int_time[1] - tpd_last_2_int_time[0]) / 1000); \ | |
50 | tpd_down_status=1; \ | |
51 | } \ | |
52 | } while(0) | |
53 | ||
54 | #define TPD_DEBUG_SET_TIME do { tpd_debug_set_time(); } while(0); | |
55 | ||
56 | extern int tpd_em_log; | |
57 | extern int tpd_em_log_to_fs; | |
58 | extern int tpd_type_cap; | |
59 | ||
60 | void tpd_em_log_output(int raw_x, int raw_y, int cal_x, int cal_y, int p, int down); | |
61 | void tpd_em_log_store(int raw_x, int raw_y, int cal_x, int cal_y, int p, int down); | |
62 | void tpd_em_log_release(void); | |
63 | ||
64 | #define TPD_TYPE_RAW_DATA 2 | |
65 | #define TPD_TYPE_INT_DOWN 3 | |
66 | #define TPD_TYPE_INT_UP 4 | |
67 | #define TPD_TYPE_TIMER 5 | |
68 | #define TPD_TYPE_REJECT1 6 | |
69 | #define TPD_TYPE_REJECT2 7 | |
70 | #define TPD_TYPE_FIST_LATENCY 8 | |
71 | ||
72 | #define TPD_EM_PRINT(raw_x, raw_y, cal_x, cal_y, p, down) \ | |
73 | do { \ | |
74 | if (tpd_em_log) { \ | |
75 | if (!tpd_em_log_to_fs) { \ | |
76 | tpd_em_log_output(raw_x, raw_y, cal_x, cal_y, p, down); \ | |
77 | } else { \ | |
78 | tpd_em_log_store(raw_x, raw_y, cal_x, cal_y, p, down); \ | |
79 | tpd_em_log_output(raw_x, raw_y, cal_x, cal_y, p, down); \ | |
80 | } \ | |
81 | if (down == 1) \ | |
82 | tpd_down_status = 1; \ | |
83 | else if (down == 0) \ | |
84 | tpd_down_status = 0; \ | |
85 | } \ | |
86 | else { \ | |
87 | if (tpd_em_log_to_fs) { \ | |
88 | tpd_em_log_release(); \ | |
89 | } \ | |
90 | } \ | |
91 | } while(0) | |
92 | ||
93 | #ifdef TPD_DEBUG_TRACK | |
94 | extern void *dal_fb_addr; | |
95 | extern int tpd_debug_track; | |
96 | void tpd_up_debug_track(int x, int y); | |
97 | void tpd_down_debug_track(int x, int y); | |
98 | #define TPD_UP_DEBUG_TRACK(x,y) do { if(tpd_debug_track) tpd_up_debug_track(x,y); }while(0) | |
99 | #define TPD_DOWN_DEBUG_TRACK(x,y) do { if(tpd_debug_track) tpd_down_debug_track(x,y); }while(0) | |
100 | ||
101 | #endif // TPD_DEBUG_TRACK | |
102 | #endif // TPD_DEBUG_CODE | |
103 | ||
104 | // Macros that will be embedded in code | |
105 | ||
106 | #ifndef TPD_DEBUG_CHECK_NO_RESPONSE | |
107 | #define TPD_DEBUG_CHECK_NO_RESPONSE | |
108 | #endif | |
109 | ||
110 | #ifndef TPD_DEBUG_SET_TIME | |
111 | #define TPD_DEBUG_SET_TIME | |
112 | #endif | |
113 | ||
114 | #ifndef TPD_DEBUG_PRINT_UP | |
115 | #define TPD_DEBUG_PRINT_UP | |
116 | #endif | |
117 | ||
118 | #ifndef TPD_DEBUG_PRINT_DOWN | |
119 | #define TPD_DEBUG_PRINT_DOWN | |
120 | #endif | |
121 | ||
122 | #ifndef TPD_UP_DEBUG_TRACK | |
123 | #define TPD_UP_DEBUG_TRACK(x,y) | |
124 | #endif | |
125 | ||
126 | #ifndef TPD_DOWN_DEBUG_TRACK | |
127 | #define TPD_DOWN_DEBUG_TRACK(x,y) | |
128 | #endif | |
129 | ||
130 | ||
131 | #endif // TPD_DEBUG_H |