⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 prd_rf_comm.lst

📁 读RF卡的源代码
💻 LST
📖 第 1 页 / 共 4 页
字号:
                               (*p_pwRFPicoReadByteCounter)++ ;
                           }
                           else
                           {
                               // Only send EOF
                               l_bP5_R0 |= P5_EOF_ONLY;
                           }
                       }
ARM COMPILER V2.40e,  PRD_RF_Comm                                                          12/12/07  14:35:10  PAGE 11  

               
                       // Send the buffer
                       v_fnCS_reset();
               
                       v_fnSPI_SendByte(l_bP5_R0);
                       if (l_bP5_R0 & 0x01) 
                       {
                           v_fnSPI_SendByte(l_bP5_EXT_REG);
                       }
                       v_fnSPI_SendBuffer(*p_pwRFPicoReadByteCounter,*p_pbRFPicoReadBitCounter,p_pabBuffer);
                       v_fnSPI_WaitForEOT();
               
               
               
                   }
               }
               
               
               //-----------------------------------------------------------------------------
               // Function : unsigned char b_fnReceiveRFResponse(unsigned char p_bReceiveOption,unsigned char* p_pabBuff
             -er,unsigned short* p_pwRFPicoReadByteCounter,unsigned char* p_pbRFPicoReadBitCounter,unsigned char* p_pbPicoReadStatus,u
             -nsigned char* p_pbRFReceiveEOF)
               //-----------------------------------------------------------------------------
               // Description : Received data are stored at g_abBuffer[0]
               //
               // IN       :   p_bReceiveOption : Receiving options
               //                                      b3..b0  : RFU
               //                                      b5..b4  : PicoRead Protocol page
               //                                      b6      : RFU
               //                                      b7      : Receive SOF only
               //          :   p_pwRFPicoReadByteCounter = Pointer to number of complete bytes received including CRC16
               //          :   p_pbRFPicoReadBitCounter = Pointer to number of valid bits in the last received byte
               //          :   p_pbPicoReadStatus = Pointer to PicoRead status after frame received
               //          :   p_pabBuffer = Pointer to Buffer in which received datas will be stored
               //          :   p_pbRFReceiveEOF = Pointer to value, that define (for ISO B) that EOF need to be taken into acco
             -unt or not. 
               //                  For ISOB        : p_pbRFReceiveEOF=1 
               //                  Other Protocols : p_pbRFReceiveEOF=0
               //
               //
               // OUT      :   *p_pwRFPicoReadByteCounter = Number of Bytes Received
               //              *p_pbRFPicoReadBitCounter  = Number of Bits Received after the array of byte
               //              *p_pbPicoReadStatus = Pointer to the Status byte received by the PicoRead chip after having receive
             -d the data bytes from the RF
               //
               // RETURN   :    Error code
               // Notes    :   - none -
               //-----------------------------------------------------------------------------
                
               unsigned char b_fnReceiveRFResponse(unsigned char p_bReceiveOption,unsigned char* p_pabBuffer,unsigned sh
             -ort* p_pwRFPicoReadByteCounter,unsigned char* p_pbRFPicoReadBitCounter,unsigned char* p_pbPicoReadStatus,unsigned char* 
             -p_pbRFReceiveEOF,unsigned char p_bBitsToReceive)
               {
                   unsigned char l_bReturnByte;
                   v_fnCS_reset();
                   
                   if(!bit_testChar(&p_bReceiveOption,7))
                   {
                       if(p_bBitsToReceive & 0x07)
                       {
                           v_fnSPI_SendByte(P5_ACCESS_P5 | P5_EMI_REC_RECEPTION | (p_bReceiveOption & 0x30) | P5_CRC_EN | P5_EXT_
             -REG);
                           v_fnSPI_SendByte(p_bBitsToReceive << 0x04);
                       }
                       else 
                       {
ARM COMPILER V2.40e,  PRD_RF_Comm                                                          12/12/07  14:35:10  PAGE 12  

                           v_fnSPI_SendByte(P5_ACCESS_P5 | P5_EMI_REC_RECEPTION | (p_bReceiveOption & 0x30) | P5_CRC_EN);
                       }
                   }
                   else 
                   {
                       v_fnSPI_SendByte(P5_ACCESS_P5 | P5_EMI_REC_RECEPTION | P5_SOF_ONLY | (p_bReceiveOption & 0x30));
                   }
                   l_bReturnByte = b_fnSPI_GetBuffer(p_pabBuffer,p_pbPicoReadStatus,p_pwRFPicoReadByteCounter,p_pbRFPicoRea
             -dBitCounter,p_pbRFReceiveEOF);
                   return l_bReturnByte;
               }   
               #endif  // LIB_RASR
  659          
  660          #ifdef LIB_RASC
               //-----------------------------------------------------------------------------
               // Function : void v_fnReceiveRFCommand(unsigned char p_bReceiveOption,unsigned char* p_pabBuffer,unsigne
             -d short* p_pwRFPicoReadByteCounter,unsigned char* p_pbRFPicoReadBitCounter,unsigned char* p_pbPicoReadStatus,unsigned ch
             -ar* p_pbRFReceiveEOF)
               //-----------------------------------------------------------------------------
               // Description : Received data are stored at g_abBuffer[0]
               //
               // IN       :   p_bReceiveOption : Receiving options
               //                                      b3..b0  : RFU
               //                                      b5..b4  : PicoRead Protocol page
               //                                      b6      : RFU
               //                                      b7      : Receive EOF only
               //          :   p_pwRFPicoReadByteCounter = Pointer to number of complete bytes received including CRC16
               //          :   p_pbRFPicoReadBitCounter = Pointer to number of valid bits in the last received byte
               //          :   p_pbPicoReadStatus = Pointer to PicoRead status after frame received
               //          :   p_pabBuffer = Pointer to Buffer in which received datas will be stored
               //          :   p_pbRFReceiveEOF = Pointer to value, that define (for ISO B) that EOF need to be taken into acco
             -unt or not. 
               //                  For ISOB        : p_pbRFReceiveEOF=1 
               //                  Other Protocols : p_pbRFReceiveEOF=0
               //
               //
               // OUT      :   *p_pwRFPicoReadByteCounter = Number of Bytes Received
               //              *p_pbRFPicoReadBitCounter  = Number of Bits Received after the array of byte
               //              *p_pbPicoReadStatus = PicoRead Status
               //
               // RETURN   :   - none -
               //-----------------------------------------------------------------------------
               void v_fnReceiveRFCommand(unsigned char p_bReceiveOption,unsigned char* p_pabBuffer,unsigned short* p_pwR
             -FPicoReadByteCounter,unsigned char* p_pbRFPicoReadBitCounter,unsigned char* p_pbPicoReadStatus,unsigned char* p_pbRFRece
             -iveEOF)
               {
                   v_fnCS_reset();
                   
                   if(!bit_testChar(&p_bReceiveOption,7))
                   {
                       v_fnSPI_SendByte(P5_ACCESS_P5 | P5_RECEIVE_MODE | (p_bReceiveOption & 0x30) | P5_CRC_EN);
                   }
                   else 
                   {
                       v_fnSPI_SendByte(P5_ACCESS_P5 | P5_RECEIVE_MODE | P5_EOF_ONLY | (p_bReceiveOption & 0x30));
                   }
                   // receive bytes until not errors
                   b_fnSPI_GetBuffer(p_pabBuffer,p_pbPicoReadStatus,p_pwRFPicoReadByteCounter,p_pbRFPicoReadBitCounter,p_pb
             -RFReceiveEOF);
               }
               
               
               //-----------------------------------------------------------------------------
               // Function : v_fnSendRFResponse(unsigned char p_bSendOption,unsigned char* p_pabBuffer, unsigned short* 
             -p_pwRFPicoReadByteCounter, unsigned char* p_pbRFPicoReadBitCounter)
               //-----------------------------------------------------------------------------
ARM COMPILER V2.40e,  PRD_RF_Comm                                                          12/12/07  14:35:10  PAGE 13  

               // Description : Data to send are stored at g_abBuffer[0]
               //
               // IN       :   p_bSendOption : Sending options
               //                                   b2..b0  : RFU
               //                                   b3      : Send CRC
               //                                   b5..b4  : PicoRead Protocol page
               //                                   b7..b6  : RFU
               //              p_pabBuffer = Pointer to Buffer in which command to send is stored
               //              p_pwRFPicoReadByteCounter = Pointer to number of complete bytes to send
               //              p_pbRFPicoReadBitCounter = Pointer to number of bits to send
               //
               // OUT      :   if bit(s) to send, adjust *p_pwRFPicoReadByteCounter
               // RETURN   :   - none -
               // Notes    :   - none -
               //-----------------------------------------------------------------------------
               void v_fnSendRFResponse(unsigned char p_bSendOption,unsigned char* p_pabBuffer, unsigned short* p_pwRFPic
             -oReadByteCounter, unsigned char* p_pbRFPicoReadBitCounter)
               {
                   unsigned char l_bP5_R0;
                   unsigned char l_bP5_EXT_REG;
               
                   if (*p_pwRFPicoReadByteCounter != 255) // If 0 bytes, then it mean the Chip doesn't want to send data ba
             -ck
                   {
                       // Prepare the sending configuration
                       l_bP5_R0 = P5_ACCESS_P5 | P5_SEND_MODE | (p_bSendOption & 0x38);
                       
                       l_bP5_EXT_REG = 0x00;
                       
                       if (*p_pbRFPicoReadBitCounter)
                       {
                           l_bP5_R0 |= P5_EXT_REG;
                           l_bP5_EXT_REG = *p_pbRFPicoReadBitCounter << 4;
                       }
                   
                       if ((*p_pwRFPicoReadByteCounter == 1) && (*p_pbRFPicoReadBitCounter == 0))
                       {
                           // Send only one byte
                           l_bP5_R0 |= P5_EXT_REG;
                       l_bP5_EXT_REG = P5_OOB | P5_8_BITS;
                           }
                   
                       if (*p_pwRFPicoReadByteCounter == 0)
                       {
                           if (*p_pbRFPicoReadBitCounter !=0)
                           {
                               l_bP5_EXT_REG |= P5_OOB;
                           }
                           else
                           {
                               // Only send SOF
                               l_bP5_R0 |= P5_SOF_ONLY;
                           }
                       }
               
                     // Adjust the data length : if bits to send then send a full byte
                     if (*p_pbRFPicoReadBitCounter) 
                     {
                         (*p_pwRFPicoReadByteCounter)++ ;
                     }
                     // Send the buffer
                     v_fnCS_reset();
                     v_fnSPI_SendByte(l_bP5_R0);
                     if (l_bP5_R0 & 0x01) 
                     {
                           v_fnSPI_SendByte(l_bP5_EXT_REG);
ARM COMPILER V2.40e,  PRD_RF_Comm                                                          12/12/07  14:35:10  PAGE 14  

                     }
                     v_fnSPI_SendBuffer(*p_pwRFPicoReadByteCounter,0,p_pabBuffer);
                     v_fnSPI_WaitForEOT();
                  }
               }
               #endif  // LIB_RASC

ARM COMPILATION COMPLETE.  12 WARNING(S),  11 ERROR(S)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -