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"
32 static unsigned char ImageBuffer
[CFG_F54_TXCOUNT
*CFG_F54_RXCOUNT
*2];
33 static short ImageArray
[CFG_F54_RXCOUNT
][CFG_F54_RXCOUNT
];
34 static char buf
[3000] = {0};
38 unsigned char F54_RxOpenReport(void)
42 unsigned char ImageBuffer
[CFG_F54_TXCOUNT
*CFG_F54_RXCOUNT
*2];
43 short ImageArray
[CFG_F54_RXCOUNT
][CFG_F54_RXCOUNT
];
45 //char Result[CFG_F54_RXCOUNT][CFG_F54_RXCOUNT];
48 short OthersLowerLimit
= -100;
49 short OthersUpperLimit
= 100;
54 unsigned char command
;
57 memset(buf
, 0, sizeof(buf
));
58 ret
= sprintf(buf
, "\nBin #: 8 Name: Receiver Open Test\n");
59 ret
+= sprintf(buf
+ret
, "\n\t");
61 printk("\nBin #: 8 Name: Receiver Open Test\n");
64 for (j
= 0; j
< numberOfRx
; j
++)
66 ret
+= sprintf(buf
+ret
, "R%d\t", j
);
72 ret
+= sprintf(buf
+ret
, "\n");
77 length
= numberOfRx
* numberOfTx
*2;
81 writeRMI(F54_Data_Base
, &command
, 1);
85 writeRMI(F54_CBCSettings
, &command
, 1);
89 writeRMI(NoiseMitigation
, &command
, 1);
93 writeRMI(F54_Command_Base
, &command
, 1);
96 delayMS(1); //wait 1ms
97 readRMI(F54_Command_Base
, &command
, 1);
98 } while (command
!= 0x00);
101 writeRMI(F54_Command_Base
, &command
, 1);
104 delayMS(1); //wait 1ms
105 readRMI(F54_Command_Base
, &command
, 1);
106 } while (command
!= 0x00);
109 // writeRMI(0x0113, &command, 1);
112 writeRMI(F54_Data_LowIndex
, &command
, 1);
113 writeRMI(F54_Data_HighIndex
, &command
, 1);
115 // Set the GetReport bit
117 writeRMI(F54_Command_Base
, &command
, 1);
119 // Wait until the command is completed
121 delayMS(1); //wait 1ms
122 readRMI(F54_Command_Base
, &command
, 1);
123 } while (command
!= 0x00);
125 //readRMI(F54_Data_Buffer, &ImageBuffer[0], length);
126 longReadRMI(F54_Data_Buffer
, &ImageBuffer
[0], length
);
129 for (i
= 0; i
< numberOfTx
; i
++)
131 for (j
= 0; j
< numberOfRx
; j
++)
133 ImageArray
[i
][j
] = (ImageBuffer
[k
] | (ImageBuffer
[k
+1] << 8));
139 length
= numberOfRx
* (numberOfRx
-numberOfTx
) * 2;
141 writeRMI(F54_Data_Base
, &command
, 1);
144 writeRMI(F54_Data_LowIndex
, &command
, 1);
145 writeRMI(F54_Data_HighIndex
, &command
, 1);
147 // Set the GetReport bit to run Tx-to-Tx
149 writeRMI(F54_Command_Base
, &command
, 1);
151 // Wait until the command is completed
153 delayMS(1); //wait 1ms
154 readRMI(F54_Command_Base
, &command
, 1);
155 } while (command
!= 0x00);
157 //readRMI(F54_Data_Buffer, &ImageBuffer[0], length);
158 longReadRMI(F54_Data_Buffer
, &ImageBuffer
[0], length
);
161 for (i
= 0; i
< (numberOfRx
-numberOfTx
); i
++)
163 for (j
= 0; j
< numberOfRx
; j
++)
165 ImageArray
[numberOfTx
+i
][j
] = ImageBuffer
[k
] | (ImageBuffer
[k
+1] << 8);
171 // Check against test limits
172 printk("\nRxToRx Short Test Result :\n");
173 for (i = 0; i < numberOfRx; i++)
175 for (j = 0; j < numberOfRx; j++)
179 if((ImageArray[i][j] <= DiagonalUpperLimit) && (ImageArray[i][j] >= DiagonalUpperLimit))
180 Result[i][j] = 'P'; //Pass
182 Result[i][j] = 'F'; //Fail
183 //printk("%3d", ImageArray[i][j]);
187 if(ImageArray[i][j] <= OthersUpperLimit)
188 Result[i][j] = 'P'; //Fail
190 Result[i][j] = 'F'; //Fail
192 printk("%4d", ImageArray[i][j]);
199 for (i
= 0; i
< numberOfRx
; i
++)
202 ret
+= sprintf(buf
+ret
, "R%d\t", i
);
206 for (j
= 0; j
< numberOfRx
; j
++)
208 if((ImageArray
[i
][j
] <= OthersUpperLimit
) && (ImageArray
[i
][j
] >= OthersLowerLimit
))
212 ret
+= sprintf(buf
+ret
, "%d\t", ImageArray
[i
][j
]);
214 printk("%d\t", ImageArray
[i
][j
]);
220 ret
+= sprintf(buf
+ret
, "%d(*)\t", ImageArray
[i
][j
]);
222 printk("%d(*)\t", ImageArray
[i
][j
]);
227 ret
+= sprintf(buf
+ret
, "\n");
235 writeRMI(F54_Command_Base
, &command
, 1);
238 delayMS(1); //wait 1ms
239 readRMI(F54_Command_Base
, &command
, 1);
240 } while (command
!= 0x00);
242 //enable all the interrupts
246 writeRMI(F01_Cmd_Base
, &command
, 1);
248 readRMI(F01_Data_Base
+1, &command
, 1); //Read Interrupt status register to Interrupt line goes to high
250 //printk("Result = %d, Rx*Rx= %d\n", Result, numberOfRx * numberOfRx);
251 if(Result
== numberOfRx
* numberOfRx
)
254 ret
+= sprintf(buf
+ret
, "Test Result: Pass\n");
257 printk("Test Result: Pass\n");
264 ret
+= sprintf(buf
+ret
, "Test Result: Fail\n");
267 printk("Test Result: Fail\n");