2 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 Copyright (c) 2011 Synaptics, Inc.
5 Permission is hereby granted, free of charge, to any person obtaining a copy of
6 this software and associated documentation files (the "Software"), to deal in
7 the Software without restriction, including without limitation the rights to use,
8 copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
9 Software, and to permit persons to whom the Software is furnished to do so,
10 subject to the following conditions:
12 The above copyright notice and this permission notice shall be included in all
13 copies or substantial portions of the Software.
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 #include "RefCode_PDTScan.h"
28 unsigned char F54_HighResistance(void)
30 unsigned char imageBuffer
[6];
33 unsigned char command
;
36 int resistanceLimit
[3][2] = { {-1000, 450}, {-1000, 450}, {-400, 20} }; //base value * 1000
40 float resistanceLimit
[3][2] = {-1, 0.45, -1, 0.45, -0.4, 0.02};
44 ret
= sprintf(buf
, "\nBin #: 12 Name: High Resistance Test\n");
46 printk("\nBin #: 12 Name: High Resistance Test\n");
51 writeRMI(F54_Data_Base
, &command
, 1);
55 writeRMI(F54_Command_Base
, &command
, 1);
58 delayMS(1); //wait 1ms
59 readRMI(F54_Command_Base
, &command
, 1);
60 } while (command
!= 0x00);
63 writeRMI(F54_Command_Base
, &command
, 1);
66 delayMS(1); //wait 1ms
67 readRMI(F54_Command_Base
, &command
, 1);
68 } while (command
!= 0x00);
71 writeRMI(F54_Data_LowIndex
, &command
, 1);
72 writeRMI(F54_Data_HighIndex
, &command
, 1);
74 // Set the GetReport bit
76 writeRMI(F54_Command_Base
, &command
, 1);
78 // Wait until the command is completed
80 delayMS(1); //wait 1ms
81 readRMI(F54_Command_Base
, &command
, 1);
82 } while (command
!= 0x00);
84 readRMI(F54_Data_Buffer
, imageBuffer
, 6);
87 ret
+= sprintf(buf
+ret
, "Parameters:\t");
89 printk("Parameters:\t");
93 resistance
[i
] = (short)((imageBuffer
[i
*2+1] << 8) | imageBuffer
[i
*2]);
95 ret
+= sprintf(buf
+ret
, "%d,\t\t", (resistance
[i
]));
97 printk("%1.3f,\t\t", (float)(resistance
[i
])/1000);
101 if((resistance
[i
] >= resistanceLimit
[i
][0]) && (resistance
[i
] <= resistanceLimit
[i
][1])) Result
++;
103 if((resistance
[i
]/1000 >= resistanceLimit
[i
][0]) && (resistance
[i
]/1000 <= resistanceLimit
[i
][1])) Result
++;
107 ret
+= sprintf(buf
+ret
, "\n");
108 ret
+= sprintf(buf
+ret
, "Limits:\t\t");
112 printk("Limits:\t\t");
117 ret
+= sprintf(buf
+ret
, "%d,%d\t", resistanceLimit
[i
][0], resistanceLimit
[i
][1]);
119 printk("%1.3f,%1.3f\t", resistanceLimit
[i
][0], resistanceLimit
[i
][1]);
123 ret
+= sprintf(buf
+ret
, "\n");
130 writeRMI(F54_Command_Base
, &command
, 1);
133 delayMS(1); //wait 1ms
134 readRMI(F54_Command_Base
, &command
, 1);
135 } while (command
!= 0x00);
137 //enable all the interrupts
140 writeRMI(F01_Cmd_Base
, &command
, 1);
142 readRMI(F01_Data_Base
+1, &command
, 1); //Read Interrupt status register to Interrupt line goes to high
147 ret
+= sprintf(buf
+ret
, "Test Result: Pass\n");
150 printk("Test Result: Pass\n");
157 ret
+= sprintf(buf
+ret
, "Test Result: Fail, Result = %d\n", Result
);
160 printk("Test Result: Fail, Result = %d\n", Result
);
166 int F54_GetHighResistance(char *buf
)
168 unsigned char imageBuffer
[6];
171 unsigned char command
;
173 int resistanceLimit
[3][2] = { {-1000, 450}, {-1000, 450}, {-400, 20} }; //base value * 1000
179 writeRMI(F54_Data_Base
, &command
, 1);
183 writeRMI(F54_Command_Base
, &command
, 1);
187 if(++waitcount
> 500)
189 pr_info("%s[%d], command = %d\n", __func__
, __LINE__
, command
);
192 delayMS(1); //wait 1ms
193 readRMI(F54_Command_Base
, &command
, 1);
194 } while (command
!= 0x00);
197 writeRMI(F54_Command_Base
, &command
, 1);
201 if(++waitcount
> 500)
203 pr_info("%s[%d], command = %d\n", __func__
, __LINE__
, command
);
206 delayMS(1); //wait 1ms
207 readRMI(F54_Command_Base
, &command
, 1);
208 } while (command
!= 0x00);
211 writeRMI(F54_Data_LowIndex
, &command
, 1);
212 writeRMI(F54_Data_HighIndex
, &command
, 1);
214 // Set the GetReport bit
216 writeRMI(F54_Command_Base
, &command
, 1);
218 // Wait until the command is completed
221 if(++waitcount
> 500)
223 pr_info("%s[%d], command = %d\n", __func__
, __LINE__
, command
);
226 delayMS(1); //wait 1ms
227 readRMI(F54_Command_Base
, &command
, 1);
228 } while (command
!= 0x00);
230 readRMI(F54_Data_Buffer
, imageBuffer
, 6);
232 ret
+= sprintf(buf
+ret
, "Params: ");
235 resistance
[i
] = (short)((imageBuffer
[i
*2+1] << 8) | imageBuffer
[i
*2]);
236 ret
+= sprintf(buf
+ret
, "%d", (resistance
[i
]));
237 if((resistance
[i
] >= resistanceLimit
[i
][0]) && (resistance
[i
] <= resistanceLimit
[i
][1]))
241 ret
+= sprintf(buf
+ret
, " ");
243 ret
+= sprintf(buf
+ret
, "\n");
244 ret
+= sprintf(buf
+ret
, "Limits: ");
248 ret
+= sprintf(buf
+ret
, "%d,%d", resistanceLimit
[i
][0], resistanceLimit
[i
][1]);
251 ret
+= sprintf(buf
+ret
, " ");
253 ret
+= sprintf(buf
+ret
, "\n");
257 writeRMI(F54_Command_Base
, &command
, 1);
261 if(++waitcount
> 100)
263 pr_info("%s[%d], command = %d\n", __func__
, __LINE__
, command
);
266 delayMS(1); //wait 1ms
267 readRMI(F54_Command_Base
, &command
, 1);
268 } while (command
!= 0x00);
272 ret
+= sprintf(buf
+ret
, "RESULT: Pass\n");
276 ret
+= sprintf(buf
+ret
, "RESULT: Fail\n");
279 //enable all the interrupts
283 writeRMI(F01_Cmd_Base
, &command
, 1);
285 readRMI(F01_Data_Base
+1, &command
, 1); //Read Interrupt status register to Interrupt line goes to high