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

📄 mfrc500.h

📁 Source Code Source Code Source Code Source Code Source Code Source Code Source Code Source Code Sour
💻 H
字号:
/* +-------------------------------------------------------------------+ */
/* | Project : 1920.010 SCR-ALBM1 (13.56MHz MIFARE Programmer)         | */
/* | Module  : MfRc500.h                                               | */
/* | Author  : Lucio Faustinelli / Paolo Muchetti                      | */
/* | Company : AVE S.p.A. / INFOTECNICA S.r.l.                         | */
/* | Released: September, 27 2008                                      | */
/* | Revision: YZ078.00 (FW - First Official Release)                  | */
/* | Revision: YZ079.00 (EEPROM - First Official Release)              | */
/* | Revised : September 27, 2008                                      | */
/* | Revisor : AVE S.p.A. (Lucio FAUSTINELLI)                          | */
/* | Notes   : --------------                                          | */
/* +------------------------------------------------------------------------------+ */
/* | Purpose : 	Driver Chip Mifare   										      | */
/* +------------------------------------------------------------------------------+ */
/* |           																	  | */
/* |    			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.                               | */
/* +------------------------------------------------------------------------------+ */






/*
*         Copyright (c), Philips Semiconductors Gratkorn / Austria
*
*                     (C)PHILIPS Electronics N.V.2000
*       All rights are reserved. Reproduction in whole or in part is 
*      prohibited without the written consent of the copyright owner.
*  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 merchantability 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.
*/

#ifndef MFRC500_H
#define MFRC500_H


/* +----------------------------------------------------------------------+ */
/* |                                  DEFINE                              | */
/* +----------------------------------------------------------------------+ */
// Flag bcnt, indica quali bit del serialnumber delle card confronto, vale da 0 a 32
#define ALL_SN_CARD		0		// Tutte le card devono comunicare il propio SN
								//
#define SINGLE_SN_CARD	32		// Solo la Card con il SN specificato risponde

// Settori area dati Transponder, ogni settore contiene 4 Blocchi di 16 byte ognuno
//	sono anche indirizzati singolarmente da 0 a 63
#define BLOCK_00_DATA		0		// Protetto in scrittura dal Costruttore
#define BLOCK_01_DATA		1		//
#define BLOCK_02_DATA		2		//
#define BLOCK_03_SEC_TRE00	3		// Sector Trailer per accedere ai blocchi precedenti
#define BLOCK_04_DATA		4
#define BLOCK_05_DATA		5
#define BLOCK_06_DATA		6
#define BLOCK_07_SEC_TRA01	7
#define BLOCK_08_DATA		8
#define BLOCK_09_DATA		9
#define BLOCK_10_DATA		10
#define BLOCK_11_SEC_TRA02	11
#define BLOCK_12_DATA		12
#define BLOCK_13_DATA		13
#define BLOCK_14_DATA		14
#define BLOCK_15_SEC_TRA03	15
#define BLOCK_16_DATA		16
#define BLOCK_17_DATA		17
#define BLOCK_18_DATA		18
#define BLOCK_19_SEC_TRA04	19
#define BLOCK_20_DATA		20
#define BLOCK_21_DATA		21
#define BLOCK_22_DATA		22
#define BLOCK_23_SEC_TRA05	23
#define BLOCK_24_DATA		24
#define BLOCK_25_DATA		25
#define BLOCK_26_DATA		26
#define BLOCK_27_SEC_TRA06	27
#define BLOCK_28_DATA		28
#define BLOCK_29_DATA		29
#define BLOCK_30_DATA		30
#define BLOCK_31_SEC_TRA07	31
#define BLOCK_32_DATA		32
#define BLOCK_33_DATA		33
#define BLOCK_34_DATA		34
#define BLOCK_35_SEC_TRA08	35
#define BLOCK_36_DATA		36
#define BLOCK_37_DATA		37
#define BLOCK_38_DATA		38
#define BLOCK_39_SEC_TRA09	39
#define BLOCK_40_DATA		40
#define BLOCK_41_DATA		41
#define BLOCK_42_DATA		42
#define BLOCK_43_SEC_TRA10	43
#define BLOCK_44_DATA		44
#define BLOCK_45_DATA		45
#define BLOCK_46_DATA		46
#define BLOCK_47_SEC_TRA11	47
#define BLOCK_48_DATA		48
#define BLOCK_49_DATA		49
#define BLOCK_50_DATA		50
#define BLOCK_51_SEC_TRA12	51
#define BLOCK_52_DATA		52
#define BLOCK_53_DATA		53
#define BLOCK_54_DATA		54
#define BLOCK_55_SEC_TRA13	55
#define BLOCK_56_DATA		56
#define BLOCK_57_DATA		57
#define BLOCK_58_DATA		58
#define BLOCK_59_SEC_TRA14	59
#define BLOCK_60_DATA		60
#define BLOCK_61_DATA		61
#define BLOCK_62_DATA		62
#define BLOCK_63_SEC_TRA15	63

#define MAX_NUM_BLOCK		64
#define NUM_BYTE_BLOCK		16
#define NUM_BYTE_KEY		6
#define NUM_BYTE_AC			4

#define NOT_SECTOR_AUTEN		0xFF

// Offset Dati infotecnica
#define BLOCK_MANUFACT_AREA		BLOCK_01_DATA
#define BLOCK_ISSUER_AREA_01	BLOCK_04_DATA				
#define BLOCK_ISSUER_AREA_02	BLOCK_05_DATA				
#define BLOCK_ISSUER_AREA_03	BLOCK_06_DATA				

#define NUM_BLOCK_ISSUER_AREA	3

/* +----------------------------------------------------------------------+ */
/* |                               TYPEDEF                                | */
/* +----------------------------------------------------------------------+ */



/* +----------------------------------------------------------------------+ */
/* |                               PROTOTIPI                              | */
/* +----------------------------------------------------------------------+ */
//void  SleepMs (uint );

// PCD Configuration
int8_t Mf500PcdConfig(void);

// Active Antenna Slave Configuration of the MF RC500.
int8_t Mf500ActiveAntennaSlaveConfig(void);

// Active Antenna Master Configuration of the MF RC 500
int8_t Mf500ActiveAntennaMasterConfig(void);

// Set default attributes for the baudrate divider
int8_t Mf500PcdSetDefaultAttrib(void);

// Set attributes for the baudrate divider 
int8_t Mf500PcdSetAttrib(unsigned char DSI,
                           unsigned char DRI);

// Get transmission properties of the PCD
int8_t Mf500PcdGetAttrib(unsigned char *FSCImax,
                          unsigned char *FSDImax,
                          unsigned char *DSsupp,
                          unsigned char *DRsupp,
                          unsigned char *DREQDS);

// PICC Request command
int8_t Mf500PiccRequest(unsigned char req_code, 
                       unsigned char *atq);
                       
// PICC Request command for ISO 14443 A-4 Command set
int8_t Mf500PiccCommonRequest(unsigned char req_code, 
                             unsigned char *atq);  

// PICC Anticollision Command
int8_t Mf500PiccAnticoll (unsigned char bcnt,
                         unsigned char *snr);

// PICC Cascaded Anticollision Command
int8_t Mf500PiccCascAnticoll (unsigned char select_code,
                             unsigned char bcnt,
                             unsigned char *snr);                     

// PICC Select Command
int8_t Mf500PiccSelect(unsigned char *snr, 
                      unsigned char *sak);

// PICC Select Command
int8_t Mf500PiccCascSelect(unsigned char select_code, 
                             unsigned char *snr, 
                             unsigned char *sak); 

// Activation of a PICC in IDLE mode
int8_t Mf500PiccActivateIdle(unsigned char br,
                           unsigned char *atq, 
                           unsigned char *sak, 
                           unsigned char *uid, 
                           unsigned char *uid_len);

// Activation of all PICC's in the RF field
int8_t Mf500PiccActivateWakeup(unsigned char br,
                             unsigned char *atq, 
                             unsigned char *sak,
                             unsigned char *uid, 
                             unsigned char uid_len);

// MIFARE

⌨️ 快捷键说明

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