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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? mfrc500uc.c

?? 包括讀卡器源代碼
?? C
?? 第 1 頁(yè) / 共 3 頁(yè)
字號(hào):
///////////////////////////////////////////////////////////////////////////////
//    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)

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
6080yy午夜一二三区久久| 免费人成在线不卡| 99麻豆久久久国产精品免费优播| 欧美成人午夜电影| 日韩中文字幕av电影| 欧美日韩国产精品成人| 一区二区三区日韩精品视频| 91成人免费在线| 亚洲午夜久久久| 7799精品视频| 日本va欧美va精品| 精品国产露脸精彩对白| 韩国v欧美v亚洲v日本v| 久久综合九色综合欧美亚洲| 国产一区在线不卡| 中文字幕一区二区三区不卡| 91欧美激情一区二区三区成人| 国产精品初高中害羞小美女文| 91女厕偷拍女厕偷拍高清| 亚洲444eee在线观看| 精品国产一区二区三区忘忧草| 黄色精品一二区| 国产精品视频免费| 一本大道久久a久久精品综合| 亚洲第一搞黄网站| 久久久午夜精品| 99精品视频一区二区| 亚洲福利一二三区| 精品少妇一区二区三区免费观看 | 欧美色区777第一页| 裸体健美xxxx欧美裸体表演| 久久久久88色偷偷免费| 色欧美乱欧美15图片| 麻豆国产欧美日韩综合精品二区| 欧美激情在线一区二区| 欧美视频一二三区| 国产成人aaaa| 日本欧美在线看| 一二三四社区欧美黄| 国产精品全国免费观看高清 | 成人免费毛片高清视频| 日本特黄久久久高潮| 中文字幕在线观看不卡| 日韩免费电影一区| 欧美在线免费观看视频| 成人一区在线看| 久久99精品久久久久久国产越南| 亚洲精品美国一| 日本一区二区在线不卡| 日韩美女天天操| 欧美日韩成人一区| 色就色 综合激情| 成人精品一区二区三区四区| 色系网站成人免费| 成人精品小蝌蚪| 国产成人午夜视频| 国产精品资源站在线| 韩国av一区二区三区在线观看| 亚洲成人精品在线观看| 最新高清无码专区| 综合激情成人伊人| 亚洲视频资源在线| 亚洲免费av网站| 伊人性伊人情综合网| 伊人一区二区三区| 亚洲高清中文字幕| 日韩成人伦理电影在线观看| 亚洲超碰97人人做人人爱| 亚洲妇熟xx妇色黄| 日韩不卡一区二区| 裸体在线国模精品偷拍| 国产美女视频91| 国产成人aaa| 一本到不卡免费一区二区| 欧美性大战久久| 67194成人在线观看| 久久影视一区二区| 日韩毛片一二三区| 亚洲一区二区三区国产| 蜜臀精品久久久久久蜜臀| 国产精品1024| 欧美三级在线播放| 日韩一区二区精品在线观看| 日韩写真欧美这视频| 韩国欧美国产1区| 国产成人av一区| 欧美写真视频网站| 久久久久亚洲蜜桃| 一区二区三区在线免费视频| 美国欧美日韩国产在线播放| 不卡一区二区中文字幕| 欧美日韩午夜在线视频| 国产欧美久久久精品影院| 一区二区三区国产豹纹内裤在线 | 中文天堂在线一区| 免费精品视频在线| 91丨九色丨蝌蚪富婆spa| 日韩欧美一级在线播放| 亚洲日本中文字幕区| 久久9热精品视频| 欧洲精品在线观看| 国产欧美一区二区精品婷婷| 日韩中文字幕一区二区三区| 91色在线porny| 国产精品每日更新在线播放网址| 麻豆成人91精品二区三区| 91福利国产精品| 中文字幕中文字幕中文字幕亚洲无线| 欧美a一区二区| 欧美精品v国产精品v日韩精品| 国产精品卡一卡二| 国产成人在线免费观看| 精品国产伦一区二区三区观看体验 | 天天射综合影视| 欧美综合一区二区| 亚洲欧美综合另类在线卡通| 国产一区二区三区免费在线观看| 91麻豆精品国产91久久久久 | 成人午夜在线播放| 国产精品短视频| 99精品欧美一区| 亚洲日本免费电影| 色综合天天综合给合国产| 国产一二精品视频| 久久综合久色欧美综合狠狠| 国产在线不卡一区| 国产农村妇女精品| 成人av在线资源网站| 国产精品―色哟哟| 色综合天天综合网天天狠天天 | 大陆成人av片| 国产精品久久久久aaaa樱花| 99久久精品免费| 亚洲第四色夜色| 欧美一区午夜视频在线观看| 精品一区二区免费视频| 欧美高清在线一区| 欧美三区在线观看| 久久av资源站| 综合激情成人伊人| 在线不卡中文字幕| 国产99精品在线观看| 一区二区三区四区不卡在线| 欧洲精品中文字幕| 国产一区二区三区香蕉| 亚洲激情中文1区| 欧美大片拔萝卜| 97精品国产97久久久久久久久久久久| 一区二区三区日韩| 26uuu亚洲综合色| 欧美性一级生活| 国产福利电影一区二区三区| 亚洲欧美偷拍卡通变态| 日韩免费看网站| 一本到一区二区三区| 国产一区二区三区| 亚洲va中文字幕| 日韩码欧中文字| 久久久午夜电影| 日韩免费电影网站| 欧美日韩一区三区四区| 成人三级在线视频| 国产一区激情在线| 日韩1区2区3区| 一区二区三区中文在线| 亚洲国产精品v| 久久综合九色综合97_久久久| 国产精品少妇自拍| 亚洲精品在线免费播放| 91精品国产综合久久福利软件| 972aa.com艺术欧美| 国产经典欧美精品| 国产精品亚洲午夜一区二区三区 | 91美女片黄在线观看91美女| 精品在线播放午夜| 蜜臀av性久久久久蜜臀av麻豆 | 一区二区三区毛片| 一区二区三区欧美在线观看| 亚洲欧洲色图综合| 国产精品久久久久aaaa樱花| 国产午夜亚洲精品理论片色戒| 欧美成人r级一区二区三区| 91精品午夜视频| 欧美一区二区三区不卡| 欧美一区二区精美| 欧美大肚乱孕交hd孕妇| 日韩欧美国产综合一区| 欧美精品一区二区三区高清aⅴ| 欧美大片日本大片免费观看| 日韩一区二区麻豆国产| 日韩三级视频中文字幕| 精品国产乱码久久久久久浪潮| 精品日韩欧美在线| 国产欧美日韩中文久久| 国产精品免费看片| 婷婷综合久久一区二区三区| 蜜臀精品久久久久久蜜臀| 国产美女精品一区二区三区| 国产不卡高清在线观看视频| 99久久国产免费看|