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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? mfrc500uc.c

?? RC500的mifare卡開發備用程序及電路
?? 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. 
*/

///////////////////////////////////////////////////////////////////////////////
//             MODUL   VARIABLES 
///////////////////////////////////////////////////////////////////////////////

/*!
* \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

///////////////////////////////////////////////////////////////////////
//      MIFARE   MODULE   CONFIGURATION
///////////////////////////////////////////////////////////////////////
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;
}

///////////////////////////////////////////////////////////////////////
//          MIFARE   REMOTE   ANTENNA
//  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;
}

///////////////////////////////////////////////////////////////////////
//          MIFARE   REMOTE   ANTENNA
//  Configuration of master module
///////////////////////////////////////////////////////////////////////
char Mf500ActiveAntennaMasterConfig(void)
{
   char status = MI_OK;

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

   return status;
}     
                  
///////////////////////////////////////////////////////////////////////
//          MIFARE    REQUEST 
///////////////////////////////////////////////////////////////////////
char Mf500PiccRequest(unsigned char req_code, // request code ALL = 0x52 
                                           // or IDLE = 0x26 
                   unsigned char *atq)     // answer to request
{
  return Mf500PiccCommonRequest(req_code,atq);
}

///////////////////////////////////////////////////////////////////////
//          MIFARE   COMMON   REQUEST 
///////////////////////////////////////////////////////////////////////
char Mf500PiccCommonRequest(unsigned char req_code, 
                         unsigned char *atq)
{
   char status = MI_OK;

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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
2020国产精品| 欧日韩精品视频| 国产乱码字幕精品高清av| 亚洲成a人片在线观看中文| 国产精品久久久久久一区二区三区| 久久久久久久久久久久久夜| 国产精品二区一区二区aⅴ污介绍| 久久亚区不卡日本| 欧美精品一卡二卡| 99精品一区二区三区| 韩国女主播成人在线| 免费观看在线色综合| 午夜精品福利在线| 亚洲成在人线在线播放| 综合欧美一区二区三区| 国产精品无码永久免费888| 欧美一区二区三区在线观看 | 欧美国产综合一区二区| 精品国产精品网麻豆系列 | 欧美一二三四在线| 欧美电影影音先锋| 欧美一级夜夜爽| 91精品国产色综合久久不卡电影| 精品少妇一区二区三区视频免付费| 欧美又粗又大又爽| 欧美三级欧美一级| 欧美一区二区三区四区高清| 91精品婷婷国产综合久久| 日韩视频一区二区三区在线播放| 欧美一卡二卡三卡四卡| 欧美精品一区二区久久婷婷 | 日韩精彩视频在线观看| 日韩专区欧美专区| 国产毛片精品视频| 99在线热播精品免费| 欧美日韩国产成人在线91| 欧美一二三在线| 中文字幕在线一区免费| 亚洲国产精品自拍| 久久99精品久久久| 99久久久久久99| 日韩美女视频一区二区在线观看| 亚洲福利视频导航| 久久国产精品露脸对白| 成人免费观看视频| 日韩精品自拍偷拍| 亚洲精品国产视频| 国产99久久久精品| 69堂精品视频| 亚洲国产精品久久一线不卡| 国产伦精品一区二区三区在线观看| 99久久精品国产麻豆演员表| 91精品国产日韩91久久久久久| 亚洲国产成人一区二区三区| 三级久久三级久久| 色一情一乱一乱一91av| 欧美激情综合网| 精品一区二区免费视频| 69av一区二区三区| 亚洲一二三区不卡| 91浏览器在线视频| 国产精品盗摄一区二区三区| 精品一区二区三区蜜桃| 日韩一区二区三区精品视频| 五月天亚洲婷婷| 欧美老女人在线| 亚洲国产美女搞黄色| 色婷婷综合久久久久中文 | 五月综合激情婷婷六月色窝| 91香蕉国产在线观看软件| 国产精品麻豆网站| 91在线丨porny丨国产| 亚洲国产精品99久久久久久久久| 国产一区二区影院| 久久久久久久综合色一本| 国产一区二区在线观看视频| 久久精品视频一区二区| 国产成人精品在线看| 国产欧美精品在线观看| 成人黄色片在线观看| 亚洲图片欧美激情| 色婷婷一区二区三区四区| 亚洲高清久久久| 精品伦理精品一区| 99re成人在线| 天天av天天翘天天综合网| 日韩一区二区三区观看| 国产精品自拍av| 亚洲亚洲人成综合网络| 日韩精品一区二区三区在线观看| 国产激情一区二区三区四区| 亚洲人成网站色在线观看| 91精品国产91久久久久久一区二区| 精品一区二区影视| 亚洲激情自拍偷拍| 欧美mv和日韩mv的网站| www.亚洲精品| 久久99精品国产麻豆婷婷洗澡| 国产精品国产三级国产普通话三级| 91在线精品秘密一区二区| 图片区日韩欧美亚洲| 中文字幕二三区不卡| 欧美一区二区三区婷婷月色| 成人深夜视频在线观看| 免费欧美高清视频| 亚洲欧美另类在线| 中文字幕第一区| 亚洲精品在线观| 欧美成人精品1314www| 欧美视频一区二| 成人激情动漫在线观看| 国产美女在线观看一区| 日韩主播视频在线| 亚洲午夜久久久| 中文字幕一区二区三区在线不卡| 日韩欧美在线影院| 综合在线观看色| 97久久精品人人做人人爽50路| 欧美一区二区三区四区五区| 韩国精品免费视频| 日本伊人色综合网| 一区二区视频在线看| 一区免费观看视频| 亚洲精品日韩专区silk| 亚洲日本电影在线| 中文字幕视频一区二区三区久| 国产亚洲欧洲997久久综合| 久久久国产精品麻豆 | 久久久三级国产网站| 欧美精品一区二区久久婷婷| 久久噜噜亚洲综合| 欧美激情在线看| 亚洲精品第一国产综合野| 亚洲精品乱码久久久久| 亚洲图片欧美综合| 极品少妇一区二区三区精品视频| 国产一区二区91| 91麻豆免费看片| 欧美美女一区二区| 国产亚洲成aⅴ人片在线观看| 一区在线观看视频| 奇米888四色在线精品| 国产成人精品综合在线观看 | 亚洲一区二区三区中文字幕在线| 亚洲图片激情小说| 日本欧美肥老太交大片| 国产成人免费在线视频| 欧美在线免费播放| 久久久久久久电影| 五月婷婷综合网| 国产成人精品午夜视频免费| 欧美午夜精品久久久久久超碰 | 亚洲一区二区三区自拍| 国产一区二区剧情av在线| 日韩av电影免费观看高清完整版| 精品午夜久久福利影院| 色一区在线观看| 国产欧美一区在线| 久久精品999| 日本久久电影网| 日本亚洲视频在线| 色香色香欲天天天影视综合网| 国产欧美日韩在线观看| 青青草国产精品97视觉盛宴| 91欧美激情一区二区三区成人| 久久精品视频免费| 精品在线观看免费| 欧美大片免费久久精品三p| 亚洲自拍偷拍图区| 色一情一乱一乱一91av| 国产精品女同互慰在线看| 国产麻豆9l精品三级站| 久久先锋资源网| 国产成人午夜片在线观看高清观看| 日韩一二三区视频| 久久机这里只有精品| 欧美成人乱码一区二区三区| 男人的j进女人的j一区| 日韩欧美第一区| 国产成人av在线影院| 国产精品入口麻豆九色| 99re6这里只有精品视频在线观看| 日韩伦理电影网| 777a∨成人精品桃花网| 麻豆精品蜜桃视频网站| 精品国产91亚洲一区二区三区婷婷 | 亚洲一区二区三区视频在线 | 7777精品伊人久久久大香线蕉最新版| 国产成人欧美日韩在线电影 | 最近中文字幕一区二区三区| 99久久国产综合精品女不卡| 一区二区三区日韩| 欧美一区二区视频在线观看2022| 精品一区二区三区在线播放| 久久精品夜色噜噜亚洲aⅴ| 色诱视频网站一区| 美女在线一区二区| 亚洲视频一区在线| 久久色中文字幕| 色偷偷88欧美精品久久久|