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
23 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
27 #include "RefCode_PDTScan.h"
30 // The following #defines are just needed to define an Image Report BUffer in memory
31 unsigned char F54_TxToGndReport(void)
33 unsigned char ImageBuffer
[CFG_F54_TXCOUNT
];
34 unsigned char ImageArray
[CFG_F54_TXCOUNT
];
35 //unsigned char Result[CFG_F54_TXCOUNT];
36 unsigned char Result
=0;
41 unsigned char command
;
47 ret
= sprintf(buf
, "\nBin #: 10 Name: Transmitter To Ground Short Test\n");
49 printk("\nBin #: 10 Name: Transmitter To Ground Short Test\n");
51 for (i
= 0; i
< CFG_F54_TXCOUNT
; i
++)
54 // Set report mode to run Tx-to-GND
56 writeRMI(F54_Data_Base
, &command
, 1);
59 writeRMI(F54_Data_LowIndex
, &command
, 1);
60 writeRMI(F54_Data_HighIndex
, &command
, 1);
62 // Set the GetReport bit to run Tx-to-Tx
64 writeRMI(F54_Command_Base
, &command
, 1);
66 // Wait until the command is completed
68 delayMS(1); //wait 1ms
69 readRMI(F54_Command_Base
, &command
, 1);
70 } while (command
!= 0x00);
72 readRMI(F54_Data_Buffer
, &ImageBuffer
[0], 4);
74 // One bit per transmitter channel
76 for (i
= 0; i
< CFG_F54_TXCOUNT
; i
++)
80 if(ImageBuffer
[k
] & (1 << shift
)) ImageArray
[i
] = 1;
84 ret
+= sprintf(buf
+ret
, "Column:\t");
88 for (i
= 0; i
< numberOfTx
; i
++)
91 ret
+= sprintf(buf
+ret
, "Tx%d,\t", TxChannelUsed
[i
]);
93 printk("Tx%d,\t", TxChannelUsed
[i
]);
97 ret
+= sprintf(buf
+ret
, "\n");
98 ret
+= sprintf(buf
+ret
, "0:\t");
104 for (i
= 0; i
< numberOfTx
; i
++)
106 if(ImageArray
[TxChannelUsed
[i
]])
110 ret
+= sprintf(buf
+ret
, "%d,\t", ImageArray
[TxChannelUsed
[i
]]);
112 printk("%d,\t", ImageArray
[TxChannelUsed
[i
]]);
118 ret
+= sprintf(buf
+ret
, "%d(*),\t", ImageArray
[TxChannelUsed
[i
]]);
120 printk("%d(*),\t", ImageArray
[TxChannelUsed
[i
]]);
125 ret
+= sprintf(buf
+ret
, "\n");
131 // Check against test limits
132 printk("TxToGND Result\n");
133 for (i = 0; i < numberOfTx; i++)
135 if(ImageArray[TxChannelUsed[i]] == TxGNDLimit)
136 Result[i] = 'P'; //Pass
138 Result[i] = 'F'; //Fail
139 printk("Tx%d = %c\n", TxChannelUsed[i], Result[i]);
143 //enable all the interrupts
147 writeRMI(F01_Cmd_Base
, &command
, 1);
149 readRMI(F01_Data_Base
+1, &command
, 1); //Read Interrupt status register to Interrupt line goes to high
151 if(Result
== numberOfTx
)
154 ret
+= sprintf(buf
+ret
, "Test Result: Pass\n");
157 printk("Test Result: Pass\n");
164 ret
+= sprintf(buf
+ret
, "Test Result: Fail\n");
167 printk("Test Result: Fail\n");
173 int F54_GetTxToGndReport(char *buf
)
175 unsigned char ImageBuffer
[CFG_F54_TXCOUNT
];
176 unsigned char ImageArray
[CFG_F54_TXCOUNT
];
177 unsigned char Result
=0;
182 unsigned char command
;
187 for (i
= 0; i
< CFG_F54_TXCOUNT
; i
++)
190 // Set report mode to run Tx-to-GND
192 writeRMI(F54_Data_Base
, &command
, 1);
195 writeRMI(F54_Data_LowIndex
, &command
, 1);
196 writeRMI(F54_Data_HighIndex
, &command
, 1);
198 // Set the GetReport bit to run Tx-to-Tx
200 writeRMI(F54_Command_Base
, &command
, 1);
202 // Wait until the command is completed
205 if(++waitcount
> 100)
207 pr_info("%s[%d], command = %d\n", __func__
, __LINE__
, command
);
210 delayMS(1); //wait 1ms
211 readRMI(F54_Command_Base
, &command
, 1);
212 } while (command
!= 0x00);
214 readRMI(F54_Data_Buffer
, &ImageBuffer
[0], 4);
216 // One bit per transmitter channel
218 for (i
= 0; i
< CFG_F54_TXCOUNT
; i
++)
222 if(ImageBuffer
[k
] & (1 << shift
)) ImageArray
[i
] = 1;
225 ret
+= sprintf(buf
+ret
, "Info: Tx=%d\n", numberOfTx
);
226 ret
+= sprintf(buf
+ret
, "UsedTx: ");
227 for (i
= 0; i
< numberOfTx
; i
++)
229 ret
+= sprintf(buf
+ret
, "%d", TxChannelUsed
[i
]);
231 if(i
< (numberOfTx
-1))
232 ret
+= sprintf(buf
+ret
, " ");
234 ret
+= sprintf(buf
+ret
, "\n");
235 ret
+= sprintf(buf
+ret
, " ");
236 for (i
= 0; i
< numberOfTx
; i
++)
238 if(!ImageArray
[TxChannelUsed
[i
]])
241 ret
+= sprintf(buf
+ret
, "%d", ImageArray
[TxChannelUsed
[i
]]);
245 ret
+= sprintf(buf
+ret
, "%d(*)", ImageArray
[TxChannelUsed
[i
]]);
248 if(i
< (numberOfTx
-1))
249 ret
+= sprintf(buf
+ret
, " ");
252 ret
+= sprintf(buf
+ret
, "\n");
255 // Check against test limits
256 printk("TxToGND Result\n");
257 for (i = 0; i < numberOfTx; i++)
259 if(ImageArray[TxChannelUsed[i]] == TxGNDLimit)
260 Result[i] = 'P'; //Pass
262 Result[i] = 'F'; //Fail
263 printk("Tx%d = %c\n", TxChannelUsed[i], Result[i]);
267 if (Result
== numberOfTx
)
269 ret
+= sprintf(buf
+ret
, "RESULT: Pass\n");
273 ret
+= sprintf(buf
+ret
, "RESULT: Fail\n");
276 //enable all the interrupts
280 writeRMI(F01_Cmd_Base
, &command
, 1);
282 readRMI(F01_Data_Base
+1, &command
, 1); //Read Interrupt status register to Interrupt line goes to high