📄 prd_rf_comm.lst
字号:
181 1 }
182
183
184 //-----------------------------------------------------------------------------
185 // Function name : void v_fnSPI_SendByte
186 //-----------------------------------------------------------------------------
187 // Description : Send one byte through SPI.
188 //
189 // IN : p_bData : Byte to send
190 //
191 // OUT : - none -
192 // RETURN : - none -
193 // Notes : - none -
194 //-----------------------------------------------------------------------------
195
196 void v_fnSPI_SendByte(unsigned char p_bData)
197 {
198 1 signed char l_bBitNum;
199 1
200 1 for(l_bBitNum=7;l_bBitNum>=0;l_bBitNum--) //bit cycling
201 1 {
202 2 clearSDO_PIN();
203 2 if((p_bData >> l_bBitNum)&1)
204 2 {
205 3 setSDO_PIN();
206 3 }
207 2 setSCK_PIN();
208 2 //delay_us(1);
209 2 clearSCK_PIN();
210 2 //delay_us(1);
211 2 }
212 1
213 1 }
214
215
216 //-----------------------------------------------------------------------------
217 // Function name : unsigned char b_fnSPI_ReceiveByte()
218 //-----------------------------------------------------------------------------
219 // Description : Receive one byte through SPI.
220 //
221 // IN : - none -
222 // OUT : - none -
223 //
224 // RETURN : Received byte from SPI
225 //
226 // Notes : - none -
227 //-----------------------------------------------------------------------------
228
ARM COMPILER V2.40e, PRD_RF_Comm 12/12/07 14:35:10 PAGE 5
229 unsigned char b_fnSPI_ReceiveByte()
230 {
231 1 unsigned char l_bByte;
232 1 signed char l_bBitNum;
233 1
234 1 l_bByte = 0x00;
235 1 for(l_bBitNum=7;l_bBitNum>=0;l_bBitNum--) //bit cycling
236 1 {
237 2 setSCK_PIN();
238 2 // delay_us(1);
239 2 if(testSDI_PIN())
240 2 {
241 3 bit_setChar(&l_bByte,l_bBitNum);
*** WARNING C140 IN LINE 241 OF ..\..\..\..\LIB\PICOREAD\U03\LEVEL_1\COMMON\SOURCES\PRD_RF_COMM.C: 'bit_setChar' undefin
-ed; assuming 'extern int bit_setChar()'
242 3 }
243 2 clearSCK_PIN();
244 2 // delay_us(1);
245 2 }
246 1
247 1 return l_bByte;
248 1 }
249
250
251
252
253
254 //-----------------------------------------------------------------------------
255 // Function name : unsigned char b_fnSPI_GetBuffer(unsigned char* p_pabBuffer,unsigned char* p_pbPicoRead
-Status,unsigned short* p_pwRFPicoReadByteCounter,unsigned char* p_pbRFPicoReadBitCounter, unsigned char* p_pbRFReceiveEO
-F)
256 //-----------------------------------------------------------------------------
257 // Description : Gets bytes from the SPI interface.
258 //
259 // IN : p_pwRFPicoReadByteCounter = Pointer to number of complete bytes received including CRC16
260 // : p_pbRFPicoReadBitCounter = Pointer to number of valid bits in the last received byte
261 // : p_pbPicoReadStatus = Pointer to PicoRead status after frame received
262 // : p_pabBuffer = Pointer to Buffer in which data will be stored
263 // : p_pbRFReceiveEOF = Pointer to value, that define (for ISO B) that EOF need to be taken into acco
-unt or not.
264 // For ISOB : p_pbRFReceiveEOF=1
265 // Other Protocols : p_pbRFReceiveEOF=0
266 //
267 // OUT : *p_pwRFPicoReadByteCounter = Number of Bytes Received
268 // *p_pbRFPicoReadBitCounter = Number of Bits Received after the array of byte
269 // *p_pbPicoReadStatus = Pointer to the Status byte received by the PicoRead chip after having receive
-d the data bytes from the RF
270 //
271 // RETURN : Error code
272 //
273 // Notes : - none -
274 // : - none -
275 //-----------------------------------------------------------------------------
276 unsigned char b_fnSPI_GetBuffer(unsigned char* p_pabBuffer,unsigned char* p_pbPicoReadStatus,unsigned sho
-rt* p_pwRFPicoReadByteCounter,unsigned char* p_pbRFPicoReadBitCounter, unsigned char* p_pbRFReceiveEOF)
277 {
278 1 unsigned char l_bStatus = 0;
279 1 unsigned char l_bTemp;
280 1 unsigned char l_bExpectedDataLength = 255; // Limit buffer to 256 bytes for a command
281 1 unsigned char l_bError;
282 1 signed char l_bBitNum = 0;
283 1 unsigned short l_bLoopNum = 0; //Debug TA202 was char instead of short
284 1 unsigned long l_btimervalue=0;
285 1 unsigned char Timer0_IR_Debug=0;
286 1
287 1 #if ((defined PAYPASS) || (defined FULL))
ARM COMPILER V2.40e, PRD_RF_Comm 12/12/07 14:35:10 PAGE 6
unsigned short g_iFDT_A_PICC_Shift=0;
unsigned long l_lTimeOut;
if(g_bPayPassTimeoutValue == (_FDT_A_PICC_MIN + _PICOREAD_TIMEOUT_OFFSET_A) )
{
// FP
l_lTimeOut=_FDT_A_PICCMIN_TC + g_iFDT_A_PICC_Shift + _PICOREAD_TIMEOUT_OFFS_A_TC;
//FP ADD A SHIFT TO THE FDTAPICC ACCORDING TO THE LAST TRANSMITTED BIT VALUE
if (g_bLastBitSentValue==1) {g_iFDT_A_PICC_Shift=0x155;} // 84/fc
else {g_iFDT_A_PICC_Shift=0x51;} // 20/fc
T0TC-= (g_iFDT_A_PICC_Shift+(4*ONE_U_SECOND)); // delay Timer of the shift
}
// In fact it adds the shift due to the last bit value emitted
// And it adds 2 祍 more for the right limit window
#endif
305 1 *p_pbPicoReadStatus = 0x00;
306 1
307 1 *p_pbRFPicoReadBitCounter = 0x00;
308 1 *p_pwRFPicoReadByteCounter = 0x0000;
309 1
310 1 //RESET ERROR
311 1 l_bError = ERR_NO_ERROR;
*** ERROR C67 IN LINE 311 OF ..\..\..\..\LIB\PICOREAD\U03\LEVEL_1\COMMON\SOURCES\PRD_RF_COMM.C: 'ERR_NO_ERROR': undefine
-d identifier
312 1
313 1
314 1 WAIT_ANSWER_FROM_PICOREAD:
315 1
316 1 Timer0_IR_Debug=bit_testTimer0MR0IF();
*** WARNING C140 IN LINE 316 OF ..\..\..\..\LIB\PICOREAD\U03\LEVEL_1\COMMON\SOURCES\PRD_RF_COMM.C: 'bit_testTimer0MR0IF'
- undefined; assuming 'extern int bit_testTimer0MR0IF()'
317 1 #if ((defined PAYPASS) || (defined FULL))
l_btimervalue = T0TC;
#endif
322 1
323 1
324 1 if(!(testSDI_PIN()))
325 1 {
326 2 // clearDEBUG_PIN();
327 2 #if ((defined PAYPASS) || (defined FULL))
// TA301.02, 302.04, 304.02, 305.03
// FOR WUPA/REQ,ANTICOLLISION & SELECT COMMANDS
// TIME < MAX VALUE
// THE WINDOWS IS (_FDT_A_PICCMIN_TC + g_iFDT_A_PICC_Shift + _PICOREAD_TIMEOUT_OFFS_A_TC) -8US< < +4
-US
// The windows is either [approx <<86,43祍<< ] or [approx <<91,16祍<< ]
if( ( ( l_btimervalue <= (l_lTimeOut-(6*ONE_U_SECOND)) ) || ( l_btimervalue >= (l_lTimeOut+(4*ONE_
-U_SECOND)) ) ) && (g_bPayPassTimeoutValue == (_FDT_A_PICC_MIN + _PICOREAD_TIMEOUT_OFFSET_A) )) // IF RESPONSE F
-ROM PICC IS TOO FAST OR TOO LATE--> ERROR FOR REQA WAKEUPA
{
bit_clearTimer0MR0IF();
// GET_END_ERROR:
l_bError = ERR_COLL;
goto GET_END;
}
#endif
ARM COMPILER V2.40e, PRD_RF_Comm 12/12/07 14:35:10 PAGE 7
347 2
348 2
349 2 goto RECEPTION;
350 2 }
351 1
352 1
353 1 /******************* DEBUG ***********************/
354 1 // if ((( l_btimervalue <= (l_lTimeOut-(8*ONE_U_SECOND))) || ( l_btimervalue >= (l_lTimeOut+(4*ONE_U_SE
-COND)))))
355 1 // {
356 1 //
357 1 // clearDEBUG_PIN();
358 1 //
359 1 //
360 1 // } else { setDEBUG_PIN();}
361 1
362 1 /******************* DEBUG ***********************/
363 1
364 1
365 1
366 1
367 1
368 1
369 1
370 1 if(!(Timer0_IR_Debug))
371 1 {
372 2 goto WAIT_ANSWER_FROM_PICOREAD;
373 2 }
374 1
375 1 bit_clearTimer0MR0IF();
*** WARNING C140 IN LINE 375 OF ..\..\..\..\LIB\PICOREAD\U03\LEVEL_1\COMMON\SOURCES\PRD_RF_COMM.C: 'bit_clearTimer0MR0IF
-' undefined; assuming 'extern int bit_clearTimer0MR0IF()'
376 1
377 1 l_bError = ERR_NOCARD;
*** ERROR C67 IN LINE 377 OF ..\..\..\..\LIB\PICOREAD\U03\LEVEL_1\COMMON\SOURCES\PRD_RF_COMM.C: 'ERR_NOCARD': undefined
-identifier
378 1
379 1 goto GET_END;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -