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

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

?? mfrc500uc.c

?? 是關于KeilC下串口Baudrat設定的。
?? 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 "PICCCmdConst.h"
#include "MfErrNo.h"

/* 
* Projekt: MF EV X00 Firmware
*
* $Workfile:: MfRc500uC.c                                               $ 
* $Modtime:: 24.06.02 15:41                                             $ 
* $Author:: Hb                                                          $
* $Revision:: 8                                                         $
*
* 
* This library modul is written for a C166 microcontroller derivative.
* The source can be ported to other platforms very easily. 
* 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.
* 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.
*
*  ---- internal functions, which have no prototypes in a header
*       file. This kind of functions are not intended to be used 
*       outside of this file
*  ---- commands, which are intended for the reader module itself
*  ---- 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.
*
* 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 
///////////////////////////////////////////////////////////////////////////////


// interrupt vector number for interrupt of the RIC
// select the appropriate value corresponding to the microcontroller in use
#define READER_INT       // e. g. 0x18 
// disable reader interrupt
// select the appropriate value corresponding to the microcontroller in use
#define READER_INT_DISABLE    // e. g. EXICON &= ~0x0002
// enable reader interrupt
// select the appropriate value corresponding to the microcontroller in use
#define READER_INT_ENABLE     // e. g. EXICON |= 0x0002

// initialize reset pin and change port direction
// select the appropriate value corresponding to the microcontroller in use
#define READER_INIT_RESET    // e. g. P6 |= 0x20; DP6 |= 0x20
// set reset pin
// select the appropriate value corresponding to the microcontroller in use
#define READER_RESET         // e. g. P6 |= 0x20
// clear reset pin
// select the appropriate value corresponding to the microcontroller in use
#define READER_CLEAR_RESET    // e. g. P6 &= ~0x20

// memory base address corresponding to the previous set address select register
// select the appropriate value corresponding to the microcontroller in use
#define MEMORY_BASE_ADDRESS    0x100000

// the RIC has only 3 address lines - page select is necessary
#define GetRegPage(addr) (0x80 | (addr>>3))

/* ISO14443 Support Properties
* 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
//}

/* ISR communication structures
* All parameters are passed to the ISR via this structure.
*/
//{
// struct definition for a communication channel between function and ISR
typedef struct 
         {
            unsigned char  cmd;           //!< command code 
            char           status;        //!< communication status
            unsigned short nBytesSent;    //!< how many bytes already sent
            unsigned short nBytesToSend;  //!< how many bytes to send
            unsigned short nBytesReceived;//!< how many bytes received
            unsigned long  nBitsReceived; //!< how many bits received
            unsigned char  irqSource;     //!< which interrupts have occured
            unsigned char  collPos;       /*!< at which position occured a
                                          collision*/
            unsigned char  errFlags;      //!< error flags
            unsigned char  saveErrorState;//!< accumulated error flags for
                                          //!< multiple responses
            unsigned char  RxAlignWA;     //!< workaround for RxAlign = 7
            unsigned char  DisableDF;     //!< disable disturbance filter
         } MfCmdInfo;

// Convinience function for initialising the communication structure.
#define ResetInfo(info)    \
            info.cmd            = 0; \
            info.status         = MI_OK;\
            info.irqSource      = 0; \
            info.nBytesSent     = 0; \
            info.nBytesToSend   = 0; \
            info.nBytesReceived = 0; \
            info.nBitsReceived  = 0; \
            info.collPos        = 0; \
            info.errFlags       = 0; \
            info.saveErrorState = 0; \
            info.RxAlignWA      = 0; \
            info.DisableDF      = 0;

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

// communication info stucture
static   volatile MfCmdInfo     *MpIsrInfo = 0; 
// ISR send buffer
static   volatile unsigned char *MpIsrOut = 0; 
// ISR receive buffer
static   volatile unsigned char *MpIsrIn = 0;   
//}


// 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];


// storage buffer for receive and transmit routines
//{
#define MEMORY_BUFFER_SIZE    300
volatile unsigned char MemPool[MEMORY_BUFFER_SIZE];

volatile unsigned char *MSndBuffer = MemPool; // pointer to the transmit buffer
volatile unsigned char *MRcvBuffer = MemPool; // pointer to the receive buffer
//}

/* Higher Baudrate Control
* attention: RegDecoderControl is modified in CascAnticoll
* Because of standard baudrate usage during anticollision, the 
* register can be written. For general purpose usage, only some bits 
* should be set.         
*
* Please pay attention, that the location of the configuration array is
* in ROM space, that means that on 16 bit microcontroller the access 
* should be word aligned.
*/
//{
typedef struct 
         {
            unsigned short  SubCarrierPulses; ///< RegRxControl1
            unsigned short  RxCoding;         ///< RegDecoderControl
            unsigned short  RxThreshold;      ///< RegRxThreshold
            unsigned short  BPSKDemControl;   ///< RegBPSKDemControl
         } t_DSCfg;

typedef struct 
         {
            unsigned short  CoderRate;        ///< RegCoderControl
            unsigned short  ModWidth;         ///< RegModWidth
         } t_DRCfg;
     
const t_DSCfg  MDSCfg[4] = {{0x73,0x08,0x88,0x00}     // Manchaster 106 kBaud
                            ,{0x53,0x09,0x50,0x0C}     // BPSK 212 kBaud
                            ,{0x33,0x09,0x50,0x0C}     // BPSK 424 kBaud
                            ,{0x13,0x09,0x50,0x0C}};   // BPSK 848 kBaud
const t_DRCfg  MDRCfg[4] = {{0x19,0x13}          // Miller 106 kBaud
                            ,{0x11,0x07}          // Miller 212 kBaud
                            ,{0x09,0x03}          // Miller 424 kBaud
                            ,{0x01,0x01}};        // Miller 848 kBaud

// data send baudrate divider PICC --> PCD
static unsigned char MDSI = TCLDSDFLT;    

// data send baudrate divider PCD --> PICC
static unsigned char MDRI = TCLDRDFLT;   
//}

// Write one byte to the reader IC address space
/*!
* -o  address  (IN) reader ic register address
* -o  value    (IN) 8 bit value
* return: none
*
* Function for writting one char to the reader module
*
* The reader module is connected to a 16 bit demultiplexed bus,
* therefore the address pin of the reader module is mapped as
* follows: \n
* uC             Reader \n
* A1               A0   \n
* A2               A1   \n
* A3               A2   \n
*
* In order to get the correct address, the original address need to 
* be multiplied by 2.
*/

#define WriteRawRC(addr,value) *(gpcRCBaseAddress + addr) = value;

//! Read one byte from the reader IC address space
/*!
* -o  address  (IN) reader ic register address
* -o  value    (IN) 8 bit value
* return: none
*
* Function for reading one char from the reader module
*
* The reader module is connected to a 16 bit demultiplexed bus,
* therefore the address pin of the reader module is mapped as
* follows: \n
* uC             Reader \n
* A1               A0   \n
* A2               A1   \n
* A3               A2   \n
*
* In order to get the correct address, the original address need to 
* be multiplied by 2.
*/
#define ReadRawRC(addr) (*(gpcRCBaseAddress + addr))


//! Open Reader IC Connection
/*!
* -o  none
* return: MI_OK
*         other    error opening reader ic channel
*
* Open and initialize communication channel to the reader module
*/
char OpenRC(void);

//! Write one byte to the reader IC address space
/*!
* -o  address  (IN) reader ic register address
* -o  value    (IN) 8 bit value
* return: none
*
* This function determines the necessary page address of the 
* reader module and writes the page number to the page 
* register and the value to the specified address.
*/
void WriteRC(unsigned char Address, unsigned char value);

//! Write one byte to the reader IC address space
/*
* -o  address   (IN) reader IC register address
* return: value    8 bit data, read from the reader ic address space
*
* This function determines the necessary page address of the 
* reader module and writes the page number to the page 
* register and reads the value from the specified address.
*/
unsigned char ReadRC(unsigned char Address);

//! Close reader IC communication channel
/*!
* -o  none
* return: none
*
* Closing the communication channel to the reader module
*/
void CloseRC(void);

// In case of a parallel connection, the address space of the reader module
// needs to be mapped to the address space of the microcontroller. Therefore
// a base address is reserved.
unsigned char * const gpcRCBaseAddress = (unsigned char * const)(MEMORY_BASE_ADDRESS);

///////////////////////////////////////////////////////////////////////////////
//                 Open Reader Communication
///////////////////////////////////////////////////////////////////////////////
char OpenRC(void)
{
   signed char status = MI_OK;

   READER_INIT_RESET;

   return status;
}

///////////////////////////////////////////////////////////////////////////////
//                 Close Reader Communication
///////////////////////////////////////////////////////////////////////////////
void CloseRC(void)
{
}

///////////////////////////////////////////////////////////////////////////////
//          G E N E R I C    W R I T E
///////////////////////////////////////////////////////////////////////////////
void WriteRC(unsigned char Address, unsigned char value)
{
   WriteRawRC(0x00,GetRegPage(Address));   // select appropriate page
   WriteRawRC(Address,value);              // write value at the specified 
                                           // address
}

///////////////////////////////////////////////////////////////////////////////
//          G E N E R I C    R E A D
///////////////////////////////////////////////////////////////////////////////
unsigned char ReadRC(unsigned char Address)
{
   WriteRawRC(0x00,GetRegPage(Address));   // select appropriate page
   return ReadRawRC(Address);              // read value at the specified 
}  

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

///  Internal Authentication State Switch
/*!
* -o  auth_mode (IN) 
*                  enum: selects master key A or master key B 
*                   - PICC_AUTHENT1A
*                   - PICC_AUTHENT1B 
*                  
* -o  *snr      (IN) 
*                  4 byte serial number of the card, which should be 
*                  authenticated
* -o  sector (IN) Range [0..15] 
*               specifies the key RAM address 
*               from which the keys should be taken
* return: enum:
*          - MI_OK
*          - CCE
*          - MI_BITCOUNTERR  wrong number of bits received
*          - MI_AUTHERR      wrong keys for selected card
*          - MI_KEYERR       error while loading keys
*         
* 
* 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

/// Write Baudrate Divider
/*!
* -o     none
* return:   MI_OK
*
* Write function for baudrate divider and PCD properties
*/
char  Mf500PcdWriteAttrib(void);

/* ISR Communication Structure
* Data, which have to be passed between ISR and other functions are
* colleted within one structure. 
*/ 
//{
// ISR for Single Response Commands 
/*
* -o  none
* return: none
*
* This function is a central routine in the communication chain between
* PCD and PICC. 
*/ 
//interrupt (READER_INT) 
void SingleResponseIsr(void);

// Command issuer for Single Response Commands 
/*
* -o  cmd  (IN)
*             Command type
*             enum:
*              - PCD_IDLE
*              - PCD_WRITEE2
*              - PCD_READE2
*              - PCD_LOADCONFIG
*              - PCD_LOADKEYE2
*              - PCD_AUTHENT1
*              - PCD_CALCCRC

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国产一区二区精华| 美女网站在线免费欧美精品| 亚洲精品视频一区二区| 日本欧美韩国一区三区| 一本色道综合亚洲| 久久这里只有精品视频网| 亚洲一区二区偷拍精品| 国产成人精品www牛牛影视| 日韩三级高清在线| 亚洲影视在线观看| 99久久婷婷国产综合精品电影| 91精品国产欧美一区二区18 | 国产大片一区二区| 日韩小视频在线观看专区| 亚洲一级片在线观看| av激情亚洲男人天堂| 国产嫩草影院久久久久| 久久9热精品视频| 欧美人妇做爰xxxⅹ性高电影| 日韩一区在线免费观看| 不卡免费追剧大全电视剧网站| 久久综合久久综合亚洲| 国内外成人在线| 欧美一区日韩一区| 日本成人在线不卡视频| 777亚洲妇女| 图片区小说区区亚洲影院| 欧美体内she精视频| 亚洲大尺度视频在线观看| 日本高清视频一区二区| 亚洲综合激情网| 欧美日韩一卡二卡三卡| 亚洲超丰满肉感bbw| 亚洲国产高清在线观看视频| 久久精品久久综合| 2023国产精华国产精品| 国产精品自拍一区| 欧美国产综合色视频| 99久久综合国产精品| 最新欧美精品一区二区三区| 91麻豆产精品久久久久久 | 久久久噜噜噜久久中文字幕色伊伊| 免费观看在线色综合| 精品成人免费观看| 国产精品中文欧美| 国产精品国产三级国产a | 91精品国产一区二区三区香蕉 | 精品视频色一区| 首页亚洲欧美制服丝腿| 精品久久免费看| 成人黄页毛片网站| 亚洲已满18点击进入久久| 91精品国产综合久久久久久漫画| 久久精品噜噜噜成人av农村| 国产亚洲精久久久久久| 91香蕉国产在线观看软件| 午夜视频久久久久久| 久久先锋影音av鲁色资源网| 成人亚洲精品久久久久软件| 亚洲精品乱码久久久久久黑人| 欧美高清性hdvideosex| 久久 天天综合| 亚洲人精品午夜| 制服丝袜在线91| 国产sm精品调教视频网站| 夜夜操天天操亚洲| 欧美电视剧在线看免费| 色婷婷综合久久久久中文| 成人免费视频视频| 亚洲一区在线播放| 久久久99精品免费观看| 欧美天堂一区二区三区| 国产电影精品久久禁18| 亚洲国产一区在线观看| 国产欧美一区二区精品婷婷| 欧美在线短视频| 国产精一区二区三区| 亚洲综合无码一区二区| 久久久久久97三级| 欧美日韩国产小视频| 北条麻妃国产九九精品视频| 日韩av网站在线观看| 亚洲视频 欧洲视频| 日韩西西人体444www| 欧美在线一区二区| caoporn国产一区二区| 国产麻豆精品久久一二三| 午夜欧美大尺度福利影院在线看| 中文字幕乱码日本亚洲一区二区| 日韩一级高清毛片| 欧美视频在线一区二区三区 | 国产精品女同一区二区三区| 欧美精品丝袜久久久中文字幕| 99精品在线免费| 国产高清成人在线| 国内精品不卡在线| 日韩国产欧美视频| 午夜精品一区二区三区三上悠亚| 1区2区3区国产精品| 中文字幕成人av| 久久一区二区视频| 久久亚洲综合色| 欧美v日韩v国产v| 日韩网站在线看片你懂的| 91黄色在线观看| 日本伦理一区二区| 欧美最猛性xxxxx直播| 成人的网站免费观看| 国产成人精品亚洲777人妖 | 性欧美大战久久久久久久久| 亚洲国产精品激情在线观看| 精品电影一区二区三区| 91精品国产综合久久久久久久久久 | 久久久噜噜噜久久中文字幕色伊伊 | 欧美日韩国产一级片| 欧美日韩不卡一区二区| 在线成人免费视频| 欧美一级高清片| 欧美成人一区二区三区片免费| 欧美日韩国产一区| 日韩一区二区三区免费观看| 日韩免费高清视频| 久久美女高清视频| 中文字幕一区在线| 一区二区三区在线播| 亚洲大型综合色站| 久久激情五月激情| 国产精品中文字幕日韩精品 | 欧美高清视频不卡网| 91精品中文字幕一区二区三区| 日韩午夜激情电影| 国产欧美精品一区二区色综合朱莉| 久久精品一区二区三区不卡牛牛| 三级影片在线观看欧美日韩一区二区| 亚洲成a人v欧美综合天堂下载| 日本不卡中文字幕| 狠狠色丁香久久婷婷综| 成人激情开心网| 欧美人牲a欧美精品| 精品三级av在线| 18成人在线视频| 日韩影院精彩在线| 福利91精品一区二区三区| 在线亚洲高清视频| 亚洲精品一线二线三线无人区| 中文av字幕一区| 亚洲不卡av一区二区三区| 捆绑调教一区二区三区| av不卡在线观看| 91精品福利在线一区二区三区 | 国产欧美一区二区精品忘忧草| 亚洲精品综合在线| 日本午夜一区二区| 91在线精品一区二区三区| 日韩欧美黄色影院| 亚洲精选免费视频| 国产一区二区中文字幕| 日本精品一区二区三区四区的功能| 日韩精品一区二区三区swag| 最新国产成人在线观看| 蜜臀av一区二区在线观看| 91免费版pro下载短视频| 精品国产污网站| 一区二区三区四区在线| 久久不见久久见免费视频7| 欧洲av在线精品| 国产精品毛片大码女人| 久久精品国产99国产精品| 欧美视频一区二区| 国产精品久久久久影院老司| 青青青伊人色综合久久| 色狠狠桃花综合| 国产精品久久久久久久久免费丝袜 | 久久综合色8888| 三级久久三级久久久| 一本久久综合亚洲鲁鲁五月天| 久久先锋影音av鲁色资源| 日韩成人精品在线| 精品视频123区在线观看| 国产精品入口麻豆原神| 国产精品一区二区三区乱码 | 国产精品视频线看| 国内久久婷婷综合| 日韩欧美亚洲国产另类| 午夜天堂影视香蕉久久| 在线观看精品一区| 亚洲精品免费视频| 91农村精品一区二区在线| 国产精品视频你懂的| 高清在线成人网| 国产亚洲成aⅴ人片在线观看 | 色乱码一区二区三区88| 亚洲欧洲日韩综合一区二区| 国产成人av一区二区| 国产亚洲欧美日韩日本| 国产一区二区中文字幕| 久久久久国产精品人| 国产一区高清在线| 欧美精品一区二| 国产乱码精品一区二区三区忘忧草|