亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? mfrc500uc.c

?? MRF500源碼,讀寫射頻卡!快點下!!絕對精彩
?? C
?? 第 1 頁 / 共 3 頁
字號:
///////////////////////////////////////////////////////////////////////////////
//    Copyright (c), Philips Semiconductors Gratkorn
//
//                  (C)PHILIPS Electronics N.V.2000
//                     All rights are reserved. 
//  Philips reserves the right to make changes without notice at any time.
// Philips makes no warranty, expressed, implied or statutory, including but
// not limited to any implied warranty of merchantibility or fitness for any
//particular purpose, or that the use will not infringe any third party patent,
// copyright or trademark. Philips must not be liable for any loss or damage
//                          arising from its use.
///////////////////////////////////////////////////////////////////////////////
#include <string.h>
#include <stdio.h>

#include <RICReg.h>

#include <MfRc500.h>
#include <PcdShared.h>
#include <uCInit.h>
#include <RcCommunication.h>
#include <PcdUtils.h>
#include <MfErrNo.h>

/*! \file MfRc500uC.c
*
* Projekt: MF EV X00 Firmware
*
* $Workfile:: MfRc500uC.c                                               $ 
* $Modtime:: 30.03.01 9:46                                              $ 
* $Author:: Hb                                                          $
* $Revision:: 31                                                        $
*
* 
* This library modul is written for a C166 microcontroller derivative.
* The source can be ported to other platforms very easily. 
* The communication channel to the RC500 reader IC is assumed to be 
* unknown. All data is written with the generic IO functions 
* of the module RcComunication.h (Reader core communication). 
* In our case the reader module is 
* connected via memory mapped io at base address 0x100000.
* The interrupt pin of the reader IC is assumed to be connected to 
* the fast external interrupt pin INT0# (active low) and the reset
* pin of the reader IC should be connected to a dedicated port pin
* (Port: P1 Pin: 9).
* In this configuration, a reset of the reader module is independend
* from the reset of the microcontroller.
* In order to generate communication timeouts, 
* general purpose timer 3 of the microcontroller is used. This 
* timer need not to be initialised in advance. Before every usage 
* the timer is completely initialised in each function. 
* Non of the timers is essential for the functionality of the reader
* module, but are helpful furing software development. All protocoll 
* relevant timing constraints are generated
* by the internal timer of the reader module.
* 
* Some explanations to the programming method of this library.
* There are three kind of functions coded in this module.
* <ol>
*  <li> internal functions, which have no prototypes in a header
*       file. This kind of functions are not intended to be used 
*       outside of this file
*  <li> commands, which are intended for the reader module itself
*  <li> commands, which are intended for any tag in the rf field.
*       These commands are send to the reader and the reader module
*       transmitts the data to the rf interface.
* </ol>
* Commands for the reader and for the tag have the appropriate 
* prefix (PCD for Proximity Coupled Device or reader module
* PICC for Proximity Integrated Circuit Card or tag)
* and their protypes are defined in the header file.
* Certainly, each command for a PICC consists of an instruction to the PCD. 
* Therefore
* the function PcdSingleResponseCmd is very important for the understanding
* of the communication.
* 
* The basic functionality is provided by the interrupt service
* routine (SingleResponseCmd), which closely works together with the function
* PcdSingleResponseCmd. All kinds of interrupts are serviced by the 
* same ISR. 
*/

///////////////////////////////////////////////////////////////////////////////
//             M O D U L   V A R I A B L E S 
///////////////////////////////////////////////////////////////////////////////

/*!
* \ingroup mfcompatible
* storage of the last selected serial number including check byte.
*
* For multi level serial numbers, only the first 4 bytes are stored.
*/
unsigned char MLastSelectedSnr[5];

volatile unsigned char *MSndBuffer = 0; ///< pointer to the transmit buffer
volatile unsigned char *MRcvBuffer = 0; ///< pointer to the receive buffer

/*!
* In order to exchange some values between the ISR and the calling function,
* a struct is provided. 
*/
volatile MfCmdInfo     MInfo;                  

/*! \name ISO14443 Support Properties
* \ingroup ISO14443
* Some of the protokoll functions of ISO14443 needs information about
* the capability of the reader device, which are provided by this
* constants.
*/
//@{
#define TCLFSDSNDMAX   8   ///< max. frame size send
#define TCLFSDRECMAX   8   ///< max. frame size rcv
#define TCLDSMAX       3   ///< max. baudrate divider PICC --> PCD
#define TCLDRMAX       3   ///< max. baudrate divider PCD --> PICC

#define TCLDSDFLT      0   ///< default baudrate divider PICC --> PCD
#define TCLDRDFLT      0   ///< default baudrate divider PCD --> PICC
//@}


///////////////////////////////////////////////////////////////////////////////
//             Prototypes for local functions 
///////////////////////////////////////////////////////////////////////////////

///  Internal Authentication State Switch
/*!
* \ingroup internal
* \param auth_mode (<em>IN</em>) 
*                  <ul> selects master key A or master key B 
*                   <li> PICC_AUTHENT1A
*                   <li> PICC_AUTHENT1B 
*                  </ul>
* \param *snr      (<em>IN</em>) 
*                  4 byte serial number of the card, which should be 
*                  authenticated
* \param sector (<em>IN</em>) Range [0..15] 
*               specifies the key RAM address 
*               from which the keys should be taken
* \return <ul>
*          <li> MI_OK
*          <li> CCE
*          <li> MI_BITCOUNTERR  wrong number of bits received
*          <li> MI_AUTHERR      wrong keys for selected card
*          <li> MI_KEYERR       error while loading keys
*         </ul>
* 
* Internal authentication state function.
*/
char Mf500PiccAuthState(unsigned char auth_mode,// PICC_AUTHENT1A, PICC_AUTHENT1B
                       unsigned char *snr,    // 4 byte serial number
                       unsigned char sector); // 0 <= sector <= 15  
                                            // sector address for authentication

///////////////////////////////////////////////////////////////////////
//      M I F A R E   M O D U L E   C O N F I G U R A T I O N
///////////////////////////////////////////////////////////////////////
char Mf500PcdConfig(void)
{
   char status = MI_RESETERR;
   unsigned short RstLoopCnt = 0;
   unsigned short CmdWaitCnt = 0;
      
   // global initialisation
   MSndBuffer  = RicRxTxBuffer;  // initialise send buffer 
   MRcvBuffer  = RicRxTxBuffer;  // initialise receive buffer

   status = PcdReset();

   if (status == MI_OK)
   {

     // test clock Q calibration - value in the range of 0x46 expected
     WriteRC(RegClockQControl,0x0);
     WriteRC(RegClockQControl,0x40);
     SleepUs(24);  // wait approximately 100 us - calibration in progress
     ClearBitMask(RegClockQControl,0x40); // clear bit ClkQCalib for 
                                          // further calibration

     // The following values for RegBitPhase and
     // RegRxThreshold represents an optimal
     // value for our demo package. For user
     // implementation some changes could be
     // necessary
     // initialize bit phase
     WriteRC(RegBitPhase,0xAD);      

     // initialize minlevel
     WriteRC(RegRxThreshold,0xFF);   
  
     // disable auto power down
     WriteRC(RegRxControl2,01);

     // Depending on the processing speed of the
     // operation environment, the waterlevel 
     // can be adapted. (not very critical for
     // mifare applications)
     // initialize waterlevel to value 4
     WriteRC(RegFIFOLevel,0x1A); // initialize to 26d 
     
     //Timer Konfiguration
     WriteRC(RegTimerControl,0x02);  // TStopRxEnd=0,TStopRxBeg=0,
                                   // TStartTxEnd=1,TStartTxBeg=0  
                                   // timer must be stopped manually

     WriteRC(RegIRqPinConfig,0x3); // interrupt active low enable

     PcdRfReset(1);            // Rf - reset and enable output driver   

   }
   return status;
}

///////////////////////////////////////////////////////////////////////
//          M I F A R E   R E M O T E   A N T E N N A
//  Configuration of slave module
///////////////////////////////////////////////////////////////////////
char Mf500ActiveAntennaSlaveConfig(void)
{
   char status = MI_OK;

   FlushFIFO();    // empty FIFO
   ResetInfo(MInfo);   
   MSndBuffer[0] = 0x10; // addr low byte
   MSndBuffer[1] = 0x00; // addr high byte

   MSndBuffer[2] = 0x00; // Page
   MSndBuffer[3] = 0x7B; // RegTxControl modsource 11,InvTx2,Tx2RFEn,TX1RFEn
   MSndBuffer[4] = 0x3F; // RegCwConductance
   MSndBuffer[5] = 0x3F; // RFU13
   MSndBuffer[6] = 0x19; // RFU14
   MSndBuffer[7] = 0x13; // RegModWidth     
   MSndBuffer[8] = 0x00; // RFU16
   MSndBuffer[9] = 0x00; // RFU17
 
   MSndBuffer[10] = 0x00; // Page
   MSndBuffer[11] = 0x73; // RegRxControl1 
   MSndBuffer[12] = 0x08; // RegDecoderControl
   MSndBuffer[13] = 0x6c; // RegBitPhase     
   MSndBuffer[14] = 0xFF; // RegRxThreshold  
   MSndBuffer[15] = 0x00; // RFU1D
   MSndBuffer[16] = 0x00; // RegRxControl2   
   MSndBuffer[17] = 0x00; // RegClockQControl

   MSndBuffer[18] = 0x00; // Page
   MSndBuffer[19] = 0x06; // RegRxWait
   MSndBuffer[20] = 0x03; // RegChannelRedundancy
   MSndBuffer[21] = 0x63; // RegCRCPresetLSB    
   MSndBuffer[22] = 0x63; // RegCRCPresetMSB    
   MSndBuffer[23] = 0x0;  // RFU25
   MSndBuffer[24] = 0x04; // RegMfOutSelect enable mfout = manchester HT
   MSndBuffer[25] = 0x00; // RFU27
     
   // PAGE 5      FIFO, Timer and IRQ-Pin Configuration
   MSndBuffer[26] = 0x00; // Page
   MSndBuffer[27] = 0x08; // RegFIFOLevel       
   MSndBuffer[28] = 0x07; // RegTimerClock      
   MSndBuffer[29] = 0x06; // RegTimerControl    
   MSndBuffer[30] = 0x0A; // RegTimerReload     
   MSndBuffer[31] = 0x02; // RegIRqPinConfig    
   MSndBuffer[32] = 0x00; // RFU    
   MSndBuffer[33] = 0x00; // RFU
   MInfo.nBytesToSend   = 34;
         
   status = PcdSingleResponseCmd(PCD_WRITEE2,
                   MSndBuffer,
                   MRcvBuffer,
                   &MInfo); // write e2
   return status;
}

///////////////////////////////////////////////////////////////////////
//          M I F A R E   R E M O T E   A N T E N N A
//  Configuration of master module
///////////////////////////////////////////////////////////////////////
char Mf500ActiveAntennaMasterConfig(void)
{
   char status = MI_OK;

   WriteRC(RegRxControl2,0x42);
   WriteRC(RegTxControl,0x10);
   WriteRC(RegBitPhase,0x11);

   return status;
}     
                  
///////////////////////////////////////////////////////////////////////
//          M I F A R E    R E Q U E S T 
///////////////////////////////////////////////////////////////////////
char Mf500PiccRequest(unsigned char req_code, // request code ALL = 0x52 
                                           // or IDLE = 0x26 
                   unsigned char *atq)     // answer to request
{
  return Mf500PiccCommonRequest(req_code,atq);
}

///////////////////////////////////////////////////////////////////////
//          M I F A R E   C O M M O N   R E Q U E S T 
///////////////////////////////////////////////////////////////////////
char Mf500PiccCommonRequest(unsigned char req_code, 
                         unsigned char *atq)
{
   char status = MI_OK;

    //************* initialize ******************************
   if ((status = Mf500PcdSetDefaultAttrib()) == MI_OK)

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产日韩av一区| 日本一区二区视频在线| 成人性生交大片免费看视频在线 | 亚洲综合无码一区二区| 欧美日韩在线一区二区| 精品一二三四区| 亚州成人在线电影| 国产精品毛片久久久久久| 在线成人午夜影院| 日本久久一区二区| 粉嫩在线一区二区三区视频| 亚洲精品自拍动漫在线| 国产三级精品视频| 精品欧美黑人一区二区三区| 欧美美女视频在线观看| caoporn国产精品| 国产suv一区二区三区88区| 极品销魂美女一区二区三区| 亚洲va国产天堂va久久en| 亚洲伦在线观看| 亚洲欧美在线aaa| 国产精品无人区| 中文字幕欧美激情一区| 欧美国产综合色视频| 欧美激情一区二区在线| 中文字幕一区视频| 亚洲欧美国产高清| 亚洲成人动漫在线免费观看| 国产一区久久久| 日韩免费一区二区| 91精品国产高清一区二区三区 | 国产日韩欧美高清在线| 精品国内片67194| 日本一区二区三区在线不卡| 国产精品素人一区二区| 亚洲欧美国产77777| 午夜视频在线观看一区二区| 美女www一区二区| 丁香啪啪综合成人亚洲小说| 91久久精品国产91性色tv| 7777精品伊人久久久大香线蕉的| 日韩av一区二区在线影视| 91麻豆精品国产自产在线观看一区| 国产欧美一区二区三区网站 | 亚洲精品高清在线| 亚洲高清免费一级二级三级| 精品在线你懂的| 一本大道综合伊人精品热热| 欧美日韩成人激情| 国产亚洲精品资源在线26u| 樱花草国产18久久久久| 国产自产视频一区二区三区| 99精品视频一区| 国产三级欧美三级日产三级99| 欧美性做爰猛烈叫床潮| 国产午夜亚洲精品午夜鲁丝片 | 欧美午夜精品久久久| 日本一区二区免费在线| 天天色天天爱天天射综合| 97se亚洲国产综合自在线观| 精品毛片乱码1区2区3区| 亚洲6080在线| 在线免费视频一区二区| 国产精品不卡在线观看| 国产91在线看| 日韩精品中文字幕一区 | 色美美综合视频| 欧美国产日韩一二三区| 久久黄色级2电影| 欧美一区二区在线看| 亚洲综合网站在线观看| 色综合天天综合在线视频| 国产精品二三区| 9i在线看片成人免费| 国产精品天美传媒| av中文字幕不卡| 亚洲国产成人一区二区三区| 国产精品18久久久久久久久| 激情欧美一区二区| 国产一区在线不卡| 不卡的电影网站| 中文字幕精品综合| 99精品视频在线观看免费| 亚洲色图另类专区| 欧美最猛性xxxxx直播| 亚洲久草在线视频| 欧美三级资源在线| 免费成人在线播放| 久久美女高清视频| 91麻豆免费看| 久久不见久久见免费视频7| 亚洲精品一区二区三区蜜桃下载 | 国产日韩亚洲欧美综合| 国产精品中文有码| 亚洲一区在线免费观看| 91精品国产欧美一区二区| 久久99国产精品尤物| 亚洲免费观看高清| 精品国产亚洲在线| 欧美综合在线视频| 国产精品正在播放| 丝袜美腿成人在线| 国产精品毛片大码女人| 日韩一区二区三区在线| 99re这里只有精品6| 久久精品国产精品亚洲精品| 国产精品欧美精品| 精品少妇一区二区三区日产乱码| 国产欧美日韩在线看| 欧美精品色综合| 97国产一区二区| 久久国产尿小便嘘嘘| 亚洲国产裸拍裸体视频在线观看乱了| 国产乱子伦一区二区三区国色天香 | 色综合久久精品| 成人av在线看| 成人性生交大片免费看视频在线| 欧美久久一二三四区| 色综合天天综合网国产成人综合天| 日韩欧美在线影院| 777亚洲妇女| 欧美视频在线播放| 欧美亚洲精品一区| 欧美日韩成人综合| 欧美巨大另类极品videosbest| 一区二区三区在线观看国产| 久久精品欧美日韩精品 | 麻豆精品一区二区| 日本欧美一区二区三区| 日韩国产欧美在线视频| 日韩精彩视频在线观看| 日韩**一区毛片| 麻豆国产欧美日韩综合精品二区| 欧美日韩综合一区| 欧美一级高清片| 久久久久久夜精品精品免费| 欧美精品一区二区不卡| 欧美国产一区视频在线观看| 中文字幕免费观看一区| 亚洲美女免费在线| 午夜欧美一区二区三区在线播放| 欧美亚洲动漫精品| 日韩一区二区电影网| 欧美激情艳妇裸体舞| 中文字幕在线观看一区| 亚洲成人激情av| 成人在线视频首页| 欧美在线不卡视频| 久久久亚洲综合| 亚洲高清在线精品| 国产成人精品三级| 欧美日韩国产精选| 精品1区2区在线观看| 亚洲色图都市小说| 国产精品香蕉一区二区三区| 91福利资源站| 国产欧美一区二区三区网站| 婷婷成人综合网| 成人精品国产免费网站| 精品久久五月天| 日韩精品一二区| 91色综合久久久久婷婷| 国产婷婷色一区二区三区在线| 欧美在线影院一区二区| wwwwxxxxx欧美| 免费精品99久久国产综合精品| 亚洲影视在线播放| 91免费在线看| 亚洲国产精品黑人久久久| 日本不卡一区二区三区| 日本道色综合久久| 自拍偷拍国产精品| av在线综合网| 中文字幕佐山爱一区二区免费| 中文字幕一区二区三区色视频| 精品sm捆绑视频| 久久99日本精品| 精品999久久久| 国产麻豆精品视频| 国产精品色在线观看| av在线免费不卡| 亚洲综合自拍偷拍| 在线精品视频一区二区三四| 亚洲国产精品一区二区www | 精品在线观看视频| 国产亚洲一区二区三区四区 | 成人免费看视频| 亚洲婷婷在线视频| 91啪九色porn原创视频在线观看| 精品污污网站免费看| 日本欧美一区二区三区| 久久亚洲精华国产精华液 | 中文字幕一区二区三区在线观看| 亚洲欧美日韩系列| 色婷婷久久一区二区三区麻豆| 欧美日韩国产另类一区| 免费成人结看片| 国产欧美日韩视频在线观看| 91福利资源站| 国产酒店精品激情|