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

📄 main.lst

📁 RC500 MF1 非接触读卡器 开发板 资料
💻 LST
📖 第 1 页 / 共 5 页
字号:
C51 COMPILER V7.50   MAIN                                                                  03/21/2008 00:23:10 PAGE 16  

 457      =1  //                                | 011..triple  |
 458      =1  //
 459      =1  //            SAK:
 460      =1  //
 461      =1  //            +----+----+----+----+----+----+----+----+
 462      =1  //            | b8 | b7 | b6 | b5 | b4 | b3 | b2 | b1 |
 463      =1  //            +-|--+-|--+-|--+-|--+-|--+-|--+-|--+-|--+
 464      =1  //              |    |    |    |    |    |    |    |
 465      =1  //                        |              |
 466      =1  //                RFU     |      RFU     |      RFU
 467      =1  //
 468      =1  //                        1              0 .. UID complete, ATS available
 469      =1  //                        0              0 .. UID complete, ATS not available
 470      =1  //                        X              1 .. UID not complete
 471      =1  //
 472      =1  char M500PiccCascSelect(unsigned char select_code, 
 473      =1                              unsigned char *snr, 
 474      =1                              unsigned char *sak); 
 475      =1  
 476      =1  // _____________________________________________________________________________
 477      =1  //
 478      =1  //  FUNCTION: MfPiccAuth
 479      =1  //        IN: auth_mode PICC_AUTHENT1A or PICC_AUTHENT1B 
 480      =1  //                            selects master key A or master key B 
 481      =1  //                      KS0, KS1, KS2 selects one of the three master key sets.
 482      =1  //            *snr       4 byte serial number of the card, which should be 
 483      =1  //                       authenticated
 484      =1  //            key_sector spec. the key RAM address from which the data should be
 485      =1  //                      taken (0..15)
 486      =1  //            block     addresses the block address on the card, which shall be
 487      =1  //                      authenticated. For MIFARE standard cards, addr can take 
 488      =1  //                      a value from 0 to 63, for other card types please refer
 489      =1  //                      to the according product description.
 490      =1  //       OUT: -
 491      =1  //    RETURN: 
 492      =1  //   COMMENT: This function authenticates one card's sector (according to the 
 493      =1  //            block address addr) using the specified mode and master key, 
 494      =1  //            addressed with key_addr. After sending the command to the card the 
 495      =1  //            function waits for the card's answer.
 496      =1  //            This function is calling compatible (exept the serial number) with
 497      =1  //            older authentication functions. The keys are stored by the 
 498      =1  //            microcontroller, which is capable for the key management.
 499      =1  //
 500      =1  char M500PiccAuth(unsigned char auth_mode, 
 501      =1                        unsigned char *snr,
 502      =1                        unsigned char key_sector, 
 503      =1                        unsigned char block);   
 504      =1                 
 505      =1  // _____________________________________________________________________________
 506      =1  //
 507      =1  //  FUNCTION: M500PiccAuthE2
 508      =1  //        IN: auth_mode PICC_AUTHENT1A or PICC_AUTHENT1B 
 509      =1  //                            selects master key A or master key B 
 510      =1  //            *snr       4 byte serial number of the card, which should be 
 511      =1  //                       authenticated
 512      =1  //            key_sector spec. the key E2PROM key number from which the data 
 513      =1  //                       should be taken (0..15)
 514      =1  //            sector    addresses the sector number on the card, which shall be
 515      =1  //                      authenticated. For MIFARE standard cards, addr can take 
 516      =1  //                      a value from 0 to 15, for other card types please refer
 517      =1  //                      to the according product description.
 518      =1  //       OUT: -
C51 COMPILER V7.50   MAIN                                                                  03/21/2008 00:23:10 PAGE 17  

 519      =1  //    RETURN: 
 520      =1  //   COMMENT: This function authenticates one card's sector using the specified 
 521      =1  //            mode. After sending the command to the card the 
 522      =1  //            function waits for the card's answer.
 523      =1  //            The keys for authentication have to be stored in E2PROM in 
 524      =1  //            advance.
 525      =1  char M500PiccAuthE2( unsigned char auth_mode, 
 526      =1                           unsigned char *snr,      
 527      =1                           unsigned char key_sector,
 528      =1                           unsigned char sector); 
 529      =1                       
 530      =1  // _____________________________________________________________________________
 531      =1  //
 532      =1  //  FUNCTION: M500HostCodeKey
 533      =1  //        IN: uncoded   6 bytes master key for card authentication
 534      =1  //       OUT: coded     12 bytes master key for card authentication
 535      =1  //    RETURN: 
 536      =1  //   COMMENT: In order to authenticate a memory sector of a card, a 6 
 537      =1  //            bytes master key is necessary. This master key has to be passed
 538      =1  //            to the reader modul coded. The conversion between uncoded and 
 539      =1  //                coded keys is made by this function.
 540      =1  //                     
 541      =1  char M500HostCodeKey(unsigned char *uncoded, 
 542      =1                           unsigned char *coded); 
 543      =1  
 544      =1  // _____________________________________________________________________________
 545      =1  //
 546      =1  //  FUNCTION: M500PiccAuthKey
 547      =1  //        IN: auth_mode PICC_AUTHENT1A or PICC_AUTHENT1B 
 548      =1  //                            selects master key A or master key B 
 549      =1  //            *snr       4 byte serial number of the card, which should be 
 550      =1  //                       authenticated
 551      =1  //            *keys      12 bytes master key coded
 552      =1  //            sector    addresses the sector number on the card, which shall be
 553      =1  //                      authenticated. For MIFARE standard cards, addr can take 
 554      =1  //                      a value from 0 to 15, for other card types please refer
 555      =1  //                      to the according product description.
 556      =1  //       OUT: -
 557      =1  //    RETURN: 
 558      =1  //   COMMENT: The keys are first loaded to the reader module and used for
 559      =1  //            authentication of the secified sector. In order to get the 
 560      =1  //            required keys coded, the function M500HostCodeKey can be used.
 561      =1  //                     
 562      =1  char M500PiccAuthKey(unsigned char auth_mode,
 563      =1                           unsigned char *snr,   
 564      =1                           unsigned char *keys,  
 565      =1                           unsigned char sector);   
 566      =1                       
 567      =1                          
 568      =1  // _____________________________________________________________________________
 569      =1  //
 570      =1  //  FUNCTION: M500PiccRead
 571      =1  //        IN: addr    addresses -  the block on the card from which data shall 
 572      =1  //                    be read. For MIFARE standard cards, addr can take a value
 573      =1  //                    from 0 to 63 (255 for Mifare Pro), for other card types 
 574      =1  //                    please refer to the according product description.
 575      =1  //       OUT: data    is a pointer to the 16 byte data block read from the card.
 576      =1  //       OUT: 
 577      =1  //    RETURN: 
 578      =1  //   COMMENT: This function reads a 16 byte block from the specified card's block 
 579      =1  //            address addr. After sending the command to the card the function 
 580      =1  //            waits for the card's answer.
C51 COMPILER V7.50   MAIN                                                                  03/21/2008 00:23:10 PAGE 18  

 581      =1  //                        
 582      =1  char M500PiccRead(unsigned char addr,  
 583      =1                    unsigned char *_data);
 584      =1                   
 585      =1  // _____________________________________________________________________________
 586      =1  //
 587      =1  //  FUNCTION: M500PiccWrite
 588      =1  //        IN: addr     address -  the block on the card from which data shall 
 589      =1  //                     be read. For MIFARE standard cards, addr can take a 
 590      =1  //                     value from 0 to 63 (255 for Mifare Pro), for other card 
 591      =1  //                     types please refer to the according product description.
 592      =1  //            data     is a pointer to the 16 byte data block that shall be 
 593      =1  //                     written to the card.
 594      =1  //       OUT: -
 595      =1  //    RETURN: 
 596      =1  //   COMMENT: This function writes a 16 byte block to the specified card's block 
 597      =1  //            address addr. After sending the command to the card the function
 598      =1  //            waits for the card's answer.
 599      =1  //                  
 600      =1  char M500PiccWrite(unsigned char addr,
 601      =1                         unsigned char *_data);
 602      =1                    
 603      =1  
 604      =1  // _____________________________________________________________________________
 605      =1  //
 606      =1  // FUNCTION: M500PiccValue
 607      =1  //       IN: dd_mode    INCREMENT, DECREMENT or RESTORE
 608      =1  //           addr       Block address for the command to be perform 0-63
 609      =1  //           *value     4 bytes value, LSB first
 610      =1  //           trans_addr Destination block address to be tranfer 
 611      =1  //      OUT: -
 612      =1  //  COMMENT:
 613      =1  // This function performs the INCREMENT, DECREMENT and RESTORE command. Precondition 
 614      =1  // for success is, that the data block is formatted as value block. 
 615      =1  //
 616      =1  // For INCREMENT and DECREMENT, the command doesn't write back the value to the memory 
 617      =1  // location directly, but loads the transfer buffer with the increased value,
 618      =1  // which could be transferred to any authenticated block by the TRANFER command.
 619      =1  //
 620      =1  // The RESTORE command loads the transfer buffer with the value stored at datablock 
 621      =1  // address, while the 
 622      =1  // given value is only a dummy value, which only have to be in valid range. 
 623      =1  // With a subsquent TRANSFER command a backup management for Value Blocks is 
 624      =1  // established.
 625      =1  //
 626      =1  // After sending the command to the card the function waits for the 
 627      =1  // card's answer. In case of an error <em>Mf500PiccValue()</em>
 628      =1  // generates a return code according to the MF RC's error flags, otherwise 
 629      =1  // the value is sent to the card and then it waits for a NACK. As an exception 
 630      =1  // in this protocol step 
 631      =1  // only a NACK is sent by the card in case of an error. Thus, the function 
 632      =1  // is successful, if a time out occurs. 
 633      =1  //
 634      =1  // After the calculation is done,  a TRANSFER is automatically
 635      =1  // performed to the block address trans_addr. After sending the command to
 636      =1  // the card the function waits for the card's answer 
 637      =1  // and generates a return code according to the MF RC's error flags. 
 638      =1  // A TRAN command is only possible directly after a RESTORE, INCREMENT or 
 639      =1  // DECREMENT command.
 640      =1  //
 641      =1  // The value inside a Value Block is four bytes wide and stored two times
 642      =1  // in normal and one time in bit-inverted manner for data security issues. 
C51 COMPILER V7.50   MAIN                                                                  03/21/2008 00:23:10 PAGE 19  

 643      =1  // Additionally the initial address of the Value Block is stored two times 
 644      =1  // normal and two times bit-inverted. In case of a backup of a Value Block, 
 645      =1  // this addres contains the original address of the Value Block.
 646      =1  // Note: Only positive numbers are alowed for the parameter <em>value</em>.
 647      =1  //
 648      =1  char M500PiccValue(unsigned char dd_mode, 
 649      =1                     unsigned char addr, 
 650      =1                     unsigned char *value,
 651      =1                     unsigned char trans_addr);
 652      =1  
 653      =1  // _____________________________________________________________________________
 654      =1  //
 655      =1  // FUNCTION: M500PiccValueDebit
 656      =1  //       IN: dd_mode    INCREMENT, DECREMENT or RESTORE
 657      =1  //           addr       Block address for the command to be perform 0-63
 658      =1  //           *value     4 bytes value, LSB first
 659      =1  //      OUT: -
 660      =1  //  COMMENT:
 661      =1  // This function executes calculations on value debit blocks with cards, that 
 662      =1  // support automatic transfer (MIFARE light, MIFARE PLUS, MIFARE PRO,
 663      =1  // MIFARE PROX, ...). 
 664      =1  //
 665      =1  // After sending the command 
 666      =1  // to the card the function waits for the card's answer. In case of an error 
 667      =1  // it generates a return code according 
 668      =1  // to the MF RC's error flags. 
 669      =1  //
 670      =1  char M500PiccValueDebit(unsigned char dd_mode, 
 671      =1                          unsigned char addr, 
 672      =1                          unsigned char *value);
 673      =1  
 674      =1  // _____________________________________________________________________________
 675      =1  //
 676      =1  // FUNCTION: M500PiccExchangeBlock
 677      =1  //       IN: *send_data 
 678      =1  //           send_bytelen       Lenght include 2bytes CRC
 679      =1  //           append_crc         1->append, 0->not append
 680      =1  //           timeout            Set duration of timeout timer
 681      =1  //                              1-> 1s
 682      =1  //                              2-> 1.5s
 683      =1  //                              3-> 6s
 684      =1  //                              4-> 9.6s
 685      =1  //      OUT: *rec_data
 686      =1  //       

⌨️ 快捷键说明

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