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 unsigned char F54_TxToTxReport(void)
32 unsigned char ImageBuffer
[CFG_F54_TXCOUNT
];
33 unsigned char ImageArray
[CFG_F54_TXCOUNT
];
34 unsigned char Result
= 0;
35 //unsigned char Result[CFG_F54_TXCOUNT];
40 unsigned char command
;
46 ret
= sprintf(buf
, "\nBin #: 5 Name: Transmitter To Transmitter Short Test\n");
48 printk("\nBin #: 5 Name: Transmitter To Transmitter Short Test\n");
50 for (i
= 0; i
< CFG_F54_TXCOUNT
; i
++)
53 // Set report mode to run Tx-to-Tx
55 writeRMI(F54_Data_Base
, &command
, 1);
58 writeRMI(F54_Data_LowIndex
, &command
, 1);
59 writeRMI(F54_Data_HighIndex
, &command
, 1);
61 // Set the GetReport bit to run Tx-to-Tx
63 writeRMI(F54_Command_Base
, &command
, 1);
65 // Wait until the command is completed
67 delayMS(1); //wait 1ms
68 readRMI(F54_Command_Base
, &command
, 1);
69 } while (command
!= 0x00);
71 readRMI(F54_Data_Buffer
, &ImageBuffer
[0], 4);
73 // One bit per transmitter channel
75 for (i
= 0; i
< CFG_F54_TXCOUNT
; i
++)
79 if(!(ImageBuffer
[k
] & (1 << shift
))) ImageArray
[i
] = 0;
83 ret
+= sprintf(buf
+ret
, "Column:\t");
87 for (i
= 0; i
< numberOfTx
; i
++)
90 ret
+= sprintf(buf
+ret
, "Tx%d,\t", TxChannelUsed
[i
]);
92 printk("Tx%d,\t", TxChannelUsed
[i
]);
96 ret
+= sprintf(buf
+ret
, "\n");
97 ret
+= sprintf(buf
+ret
, "0:\t");
103 for (i
= 0; i
< numberOfTx
; i
++)
105 if(!ImageArray
[TxChannelUsed
[i
]])
109 ret
+= sprintf(buf
+ret
, "%d,\t", ImageArray
[TxChannelUsed
[i
]]);
111 printk("%d,\t", ImageArray
[TxChannelUsed
[i
]]);
117 ret
+= sprintf(buf
+ret
, "%d(*),\t", ImageArray
[TxChannelUsed
[i
]]);
119 printk("%d(*),\t", ImageArray
[TxChannelUsed
[i
]]);
124 ret
+= sprintf(buf
+ret
, "\n");
130 // Check against test limits
131 printk("\nTx-Tx short test result:\n");
132 for (i = 0; i < numberOfTx; i++)
134 if (ImageArray[i]== TxTxLimit)
135 Result[i] = 'P'; //Pass
137 Result[i] = 'F'; //Fail
138 printk("Tx[%d] = %c\n", TxChannelUsed[i], Result[i]);
142 //enable all the interrupts
146 writeRMI(F01_Cmd_Base
, &command
, 1);
148 readRMI(F01_Data_Base
+1, &command
, 1); //Read Interrupt status register to Interrupt line goes to high
150 if(Result
== numberOfTx
)
153 ret
+= sprintf(buf
+ret
, "Test Result: Pass\n");
156 printk("Test Result: Pass\n");
163 ret
+= sprintf(buf
+ret
, "Test Result: Fail\n");
166 printk("Test Result: Fail\n");
172 int F54_GetTxToTxReport(char *buf
)
174 unsigned char ImageBuffer
[CFG_F54_TXCOUNT
];
175 unsigned char ImageArray
[CFG_F54_TXCOUNT
];
176 unsigned char Result
= 0;
181 unsigned char command
;
186 for (i
= 0; i
< CFG_F54_TXCOUNT
; i
++)
189 // Set report mode to run Tx-to-Tx
191 writeRMI(F54_Data_Base
, &command
, 1);
194 writeRMI(F54_Data_LowIndex
, &command
, 1);
195 writeRMI(F54_Data_HighIndex
, &command
, 1);
197 // Set the GetReport bit to run Tx-to-Tx
199 writeRMI(F54_Command_Base
, &command
, 1);
201 // Wait until the command is completed
204 if(++waitcount
> 500)
206 pr_info("%s[%d], command = %d\n", __func__
, __LINE__
, command
);
209 delayMS(1); //wait 1ms
210 readRMI(F54_Command_Base
, &command
, 1);
211 } while (command
!= 0x00);
213 readRMI(F54_Data_Buffer
, &ImageBuffer
[0], 4);
215 // One bit per transmitter channel
217 for (i
= 0; i
< CFG_F54_TXCOUNT
; i
++)
221 if(!(ImageBuffer
[k
] & (1 << shift
))) ImageArray
[i
] = 0;
224 ret
+= sprintf(buf
+ret
, "Info: Tx=%d\n", numberOfTx
);
225 ret
+= sprintf(buf
+ret
, "UsedTx: ");
226 for (i
= 0; i
< numberOfTx
; i
++)
228 ret
+= sprintf(buf
+ret
, "%d", TxChannelUsed
[i
]);
230 if(i
< (numberOfTx
-1))
231 ret
+= sprintf(buf
+ret
, " ");
233 ret
+= sprintf(buf
+ret
, "\n");
234 ret
+= sprintf(buf
+ret
, " ");
235 for (i
= 0; i
< numberOfTx
; i
++)
237 if(!ImageArray
[TxChannelUsed
[i
]])
240 ret
+= sprintf(buf
+ret
, "%d", ImageArray
[TxChannelUsed
[i
]]);
244 ret
+= sprintf(buf
+ret
, "%d(*)", ImageArray
[TxChannelUsed
[i
]]);
247 if(i
< (numberOfTx
-1))
248 ret
+= sprintf(buf
+ret
, " ");
250 ret
+= sprintf(buf
+ret
, "\n");
253 // Check against test limits
254 printk("\nTx-Tx short test result:\n");
255 for (i = 0; i < numberOfTx; i++)
257 if (ImageArray[i]== TxTxLimit)
258 Result[i] = 'P'; //Pass
260 Result[i] = 'F'; //Fail
261 printk("Tx[%d] = %c\n", TxChannelUsed[i], Result[i]);
266 if (Result
== numberOfTx
)
268 ret
+= sprintf(buf
+ret
, "RESULT: Pass\n");
272 ret
+= sprintf(buf
+ret
, "RESULT: Fail\n");
275 //enable all the interrupts
279 writeRMI(F01_Cmd_Base
, &command
, 1);
281 readRMI(F01_Data_Base
+1, &command
, 1); //Read Interrupt status register to Interrupt line goes to high