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

📄 pcdshared.lst

📁 RC500的mifare卡开发备用程序及电路
💻 LST
字号:
C51 COMPILER V6.12  PCDSHARED                                                              08/18/2008 15:29:35 PAGE 1   


C51 COMPILER V6.12, COMPILATION OF MODULE PCDSHARED
OBJECT MODULE PLACED IN .\PcdShared.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE .\PcdShared.c LARGE WARNINGLEVEL(0) BROWSE INCDIR(D:\UsefulDocument\Mifare\
                    -MF RC500\MFRC500 Demo Reader\RC500\For Test) DEBUG OBJECTEXTEND

stmt level    source

   1          ///////////////////////////////////////////////////////////////////////////////
   2          //    Copyright (c), Philips Semiconductors Gratkorn
   3          //
   4          //                  (C)PHILIPS Electronics N.V.2000
   5          //                     All rights are reserved. 
   6          //  Philips reserves the right to make changes without notice at any time.
   7          // Philips makes no warranty, expressed, implied or statutory, including but
   8          // not limited to any implied warranty of merchantibility or fitness for any
   9          //particular purpose, or that the use will not infringe any third party patent,
  10          // copyright or trademark. Philips must not be liable for any loss or damage
  11          //                          arising from its use.
  12          ///////////////////////////////////////////////////////////////////////////////
  13          #define DLL_EXPORT      // library source module definition
  14          
  15          #include <string.h>
  16          #include <stdio.h>
  17          
  18          #include <RICReg.h>
*** ERROR 318 IN LINE 18 OF .\PcdShared.c: can't open file 'RICReg.h'
  19          
  20          #include <PcdShared.h>
*** ERROR 318 IN LINE 24 OF PcdShared.h: can't open file 'OsDefs.h'
*** ERROR C129 IN LINE 32 OF PCDSHARED.H: missing ';' before 'PcdReset'
  21          #include <uCInit.h>
*** ERROR 318 IN LINE 21 OF .\PcdShared.c: can't open file 'uCInit.h'
  22          #include <RcCommunication.h>
  23          #include <PcCommunication.h>
*** ERROR 318 IN LINE 23 OF .\PcdShared.c: can't open file 'PcCommunication.h'
  24          #include <CPURegs.h>
*** ERROR 318 IN LINE 24 OF .\PcdShared.c: can't open file 'CPURegs.h'
  25          #include <PcdUtils.h>
*** ERROR 318 IN LINE 41 OF MfErrno.h: can't open file 'OsDefs.h'
  26          #include <MfErrNo.h>
  27          
  28          ///////////////////////////////////////////////////////////////////////
  29          //      M I F A R E   M O D U L E   R E S E T 
  30          ///////////////////////////////////////////////////////////////////////
  31          char PcdReset(void)
  32          {
  33             char status = MI_OK;
  34          
  35             SleepMs(500);     	// wait     
  36             READER_RESET;   		// reset RC500
  37             SleepMs(100);      	// wait
  38             READER_CLEAR_RESET; // clear reset pin
  39          
  40          
  41             GT_vInitTmr(TIMER_3,0x87); // stop timer, count down with a period of 52 us
  42             T3IC  = 0x00;               // reset interrupt request 
  43             GT_vLoadTmr(TIMER_3,0xAFFF);   // 0x9FFF * 52 us = 2.1 s
  44             GT_vStartTmr(TIMER_3);   // start timer
  45          
  46             // wait until reset command recognized
  47             while (((ReadRawRC(RegCommand) & 0x3F) != 0x3F) && !T3IR);
C51 COMPILER V6.12  PCDSHARED                                                              08/18/2008 15:29:35 PAGE 2   

  48          
  49             // while reset sequence in progress
  50             while ((ReadRawRC(RegCommand) & 0x3F) && !T3IR);
  51          
  52             GT_vStopTmr(TIMER_3);  // stop timeout counter
  53          
  54             if (T3IR)
  55             {
  56                status = MI_RESETERR; // respose of reader IC is not correct
  57                T3IR   = 0;
  58             }
  59          
  60             if (status == MI_OK)
  61             {
  62                WriteRawRC(RegPage,0x80); // Dummy access in order to determine the bus 
  63                                          // configuration
  64                // necessary read access 
  65                // after first write access, the returned value
  66                // should be zero ==> interface recognized
  67                if (ReadRawRC(RegCommand) != 0x00)
  68                {                           
  69                    status = MI_INTERFACEERR;
  70                }
  71          	  else
  72          	  {
  73                    // sequence is ok
  74          	  }
  75             }
  76          
  77             return status;
  78          }
  79          
  80          //////////////////////////////////////////////////////////////////////
  81          //           E X C H A N G E   B Y T E   S T R E A M
  82          ///////////////////////////////////////////////////////////////////////
  83          char ExchangeByteStream(unsigned char Cmd,
  84                                  unsigned char *send_data,
  85                                  unsigned char send_bytelen,
  86                                  unsigned char *rec_data,  
  87                                  unsigned char *rec_bytelen)
  88          {
  89             signed char status = MI_OK;
  90          
  91             FlushFIFO();    // empty FIFO
  92             ResetInfo(MInfo); // initialise ISR Info structure
  93          
  94             if (send_bytelen > 0)
  95             {
  96                memcpy(MSndBuffer,send_data,send_bytelen); // write n bytes 
  97                MInfo.nBytesToSend = send_bytelen;
  98                // write load command
  99                status = PcdSingleResponseCmd(Cmd,
 100                                MSndBuffer,
 101                                MRcvBuffer,
 102                                &MInfo);
 103                if ( status == MI_OK )
 104                {
 105                   *rec_bytelen = MInfo.nBytesReceived;
 106                   if (*rec_bytelen)
 107                   {
 108                      memcpy(rec_data,MRcvBuffer,MInfo.nBytesReceived);
 109                   }
C51 COMPILER V6.12  PCDSHARED                                                              08/18/2008 15:29:35 PAGE 3   

 110                }
 111             }
 112             else
 113             {
 114                status = MI_WRONG_PARAMETER_VALUE;
 115             }
 116             return status;
 117          }                                   
 118          
 119          ///////////////////////////////////////////////////////////////////////
 120          //          R E A D   S N R   O F   R E A D E R   I C
 121          ///////////////////////////////////////////////////////////////////////
 122          char PcdGetSnr(unsigned char* snr)
 123          {
 124             signed char status;
 125             
 126             status = PcdReadE2(0x08,0x04,snr);
 127             return status;
 128          }
 129          
 130          
 131          ///////////////////////////////////////////////////////////////////////
 132          //          E E P R O M   R E A D   
 133          ///////////////////////////////////////////////////////////////////////
 134          char PcdReadE2(unsigned short startaddr,
 135                         unsigned char length,
 136                         unsigned char* data)
 137          {
 138             char status = MI_OK;
 139          
 140               // ************* Cmd Sequence ********************************** 
 141               ResetInfo(MInfo);   
 142               MSndBuffer[0] = startaddr & 0xFF;
 143               MSndBuffer[1] = (startaddr >> 8) & 0xFF;
 144               MSndBuffer[2] = length;
 145               MInfo.nBytesToSend   = 3;
 146               status = PcdSingleResponseCmd(PCD_READE2,
 147                                   MSndBuffer,
 148                                   MRcvBuffer,
 149                                   &MInfo);
 150              if (status == MI_OK)
 151              {
 152                 memcpy(data,MRcvBuffer,length);
 153              }
 154              else   // Response Processing
 155              {
 156                 data[0] = 0;
 157              }
 158              return status ;
 159          }
 160          
 161          
 162          ///////////////////////////////////////////////////////////////////////
 163          //          E E P R O M   W R I T E 
 164          ///////////////////////////////////////////////////////////////////////
 165          char PcdWriteE2(  unsigned short startaddr,
 166                                unsigned char length,
 167                                unsigned char* data)
 168          {
 169             char status = MI_OK;
 170          
 171               // ************* Cmd Sequence ********************************** 
C51 COMPILER V6.12  PCDSHARED                                                              08/18/2008 15:29:35 PAGE 4   

 172             ResetInfo(MInfo);   
 173             MSndBuffer[0] = startaddr & 0xFF;
 174             MSndBuffer[1] = (startaddr >> 8) & 0xFF;
 175             memcpy(MSndBuffer + 2,data,length);
 176          
 177             MInfo.nBytesToSend   = length + 2;
 178                   
 179             status = PcdSingleResponseCmd(PCD_WRITEE2,
 180                             MSndBuffer,
 181                             MRcvBuffer,
 182                             &MInfo); // write e2
 183             return status;
 184          }   
 185          
 186          //////////////////////////////////////////////////////////////////////
 187          //                 R E S E T 
 188          ///////////////////////////////////////////////////////////////////////
 189          char PcdRfReset(unsigned short ms)
 190          {
 191             char   status = MI_OK;
 192          
 193             ClearBitMask(RegTxControl,0x03);  // Tx2RF-En, Tx1RF-En disablen
 194             if (ms > 0)
 195             {
 196                SleepUs(((ms * 1000) - 40) / 2);                      // Delay for 1 ms 
 197                SetBitMask(RegTxControl,0x03);    // Tx2RF-En, Tx1RF-En enable
 198             }
 199          
 200             return status;
 201          }
 202          

C51 COMPILATION COMPLETE.  0 WARNING(S),  7 ERROR(S)

⌨️ 快捷键说明

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