📄 m500a.h
字号:
// COMMENT: This functions reads out data stored in the MF RC500's EERPOM
// beginning ataddress startaddr. The number of bytes to be read are
// given by the variablelength and the read out data are stored in
// the provided data buffer.
//
char PcdReadE2(unsigned short startaddr,
unsigned char length,
unsigned char* _data);
// _____________________________________________________________________________
//
// FUNCTION: PcdWriteE2
// IN: startaddr 2 bytes of starting address of the E2PROM
// length number of byte of data to be write
// OUT: *_data buffer for the write bytes
// RETURN:
// COMMENT: This function writes a given length of data bytes stored in the data
// buffer to the reader IC's EEPROM beginning at address <em>startaddr</em>.
//
char PcdWriteE2(unsigned short startaddr,
unsigned char length,
unsigned char* _data);
// _____________________________________________________________________________
//
// FUNCTION: M500PcdMfOutSelect
// IN: type The signal to be appear at MfOut pin
//
// 000: Constant Low
// 001: Constant High
// 010: Modulation signal from the internal coder, Miller coded
// 011: Serial data stream, not Miller coded
// 100: Output signal of the energy carrier demodulator
// 101: Output signal of the subcarrier demodulator
// 110: RFU
// 111: RFU
// OUT: -
// RETURN:
// COMMENT: This function config the output of the MfOut pin
//
char M500PcdMfOutSelect(unsigned char type);
// _____________________________________________________________________________
//
// FUNCTION: M500PcdWriteRegister
// IN: Reg Register address
// value value to be written
// OUT: -
// RETURN:
// COMMENT: This function write the value to the RC500 register
//
char M500PcdWriteRegister(unsigned char Reg, unsigned char value);
// _____________________________________________________________________________
//
// FUNCTION: M500PcdReadRegister
// IN: Reg Register address
// OUT: -
// RETURN: value value of register
// COMMENT: This function read the value of the RC500 register
//
char M500PcdReadRegister(unsigned char Reg);
// _____________________________________________________________________________
//
// FUNCTION: M500PiccRequest
// IN: rq_code can take the following values
// ALL Request Code 52hex is sent out to get also a
// response from cards in halt state.
// IDLE Request Code 26hex is sent out to get a response
// only from cards that are not in halt state.
// Note: Future cards will work also with other request
// codes.
// OUT: atq 16 bit ATQ (answer to request).
// atq[0] .. LSByte
// atq[1] .. MSByte
// RETURN:
// COMMENT: This function accesses the reader module and activates sending the
// REQ code to the MIFARE card. After sending the command to the card
// the function waits for the card's answer.
//
// Please note, that the actual work is done by the function
// M500PiccCommonRequest, because of the interface behaviour between
// Mifare and ISO 14443
//
// The Card replies the ATQ.
//
// ATQ:
//
// +----+----+----+----+----+----+----+----+
// LSByte | b8 | b7 | b6 | b5 | b4 | b3 | b2 | b1 |
// +----+----+----+----+----+----+----+----+
// | | | |
// | UID size| RFU| bit-frame anticoll |
// | | | |
// | 00..std | | (if any bit set .. Y, |
// | 01..dbl | | else .. N) |
// | 10..tpl | | |
//
//
//
// +----+----+----+----+----+----+----+----+
// MSByte | b8 | b7 | b6 | b5 | b4 | b3 | b2 | b1 |
// +----+----+----+----+----+----+----+----+
// | |
// | RFU |
// | |
//
char M500PiccRequest(unsigned char req_code,
unsigned char *atq);
// _____________________________________________________________________________
//
// FUNCTION: M500PiccCommonRequest
// IN: rq_code can take the following values
// ALL Request Code 52hex is sent out to get also a
// response from cards in halt state.
// IDLE Request Code 26hex is sent out to get a response
// only from cards that are not in halt state.
// Note: Future cards will work also with other request
// codes.
// OUT: atq 16 bit ATQ (answer to request).
// atq[0] .. LSByte
// atq[1] .. MSByte
// RETURN:
// COMMENT: Please note, that this function does the actual work which is
// described in function M500PiccRequest.
//
char M500PiccCommonRequest(unsigned char req_code,
unsigned char *atq);
// _____________________________________________________________________________
//
// FUNCTION: M500PiccAnticoll
// IN: bcnt Number of snr-bits that are known (default value is 0)
// *snr 4 bytes serial number (number of bits, which
// are known and indicated by "bcnt"
// OUT: *snr 4 bytes serial number, determined by the anticollision
// sequence
// RETURN:
// COMMENT: The actual anticollision loop is done by the function
// "M500PiccCascAnticoll". Which is called with select_code 0x93.
//
char M500PiccAnticoll (unsigned char bcnt,
unsigned char *snr);
// _____________________________________________________________________________
//
// FUNCTION: M500PiccCascAnticoll
// IN: select_code 0x93 standard select code
// 0x95 cascaded level 1
// 0x97 cascaded level 2
// bcnt Number of snr-bits that are known (default value is 0)
// *snr 4 bytes serial number (number of bits, which
// are known and indicated by "bcnt"
// OUT: *snr 4 bytes serial number, determined by the anticollision
// sequence
// RETURN:
// COMMENT: Corresponding to the specification in ISO 14443, this function
// is able to handle extended serial numbers. Therefore more than
// one select_code is possible. The function transmitts a
// select code and all ready tags are responding. The highest
// serial number within all responding tags will be returned by
// this function.
//
char M500PiccCascAnticoll (unsigned char select_code,
unsigned char bcnt,
unsigned char *snr);
// _____________________________________________________________________________
//
// FUNCTION: M500PiccSelect
// IN: *snr 4 bytes serial number
// OUT: *sak 1 byte select acknowledge
// xxxxx1xx: Cascade bit set: UID not complete
// xx1xx0xx: UID complete,
// PICC compliant with ISO/IEC 14443-4
// xx0xx0xx: UID complete,
// PICC not compliant with ISO/IEC 14443-4
// RETURN:
// COMMENT: The actual select procedure is done by the function
// "M500PiccCascSelect". Which is called with select_code 0x93.
//
char M500PiccSelect(unsigned char *snr,
unsigned char *sak);
// _____________________________________________________________________________
//
// FUNCTION: M500PiccCascSelect
// IN: select_code
// *snr 4 bytes serial number
// OUT: *sak 1 byte select acknowledge
// RETURN:
// COMMENT: Selects a UID level, depending on select code.
// Returns Select Acknowledge byte.
//
// Corresponding to the specification in ISO 14443, this function
// is able to handle extended serial numbers. Therefore more than
// one select_code is possible.
//
// Select codes:
//
// +----+----+----+----+----+----+----+----+
// | b8 | b7 | b6 | b5 | b4 | b3 | b2 | b1 |
// +-|--+-|--+-|--+-|--+----+----+----+-|--+
// | | | | | | |
// | |
// 1 0 0 1 | 001..std | 1..bit frame anticoll
// | 010..double |
// | 011..triple |
//
// SAK:
//
// +----+----+----+----+----+----+----+----+
// | b8 | b7 | b6 | b5 | b4 | b3 | b2 | b1 |
// +-|--+-|--+-|--+-|--+-|--+-|--+-|--+-|--+
// | | | | | | | |
// | |
// RFU | RFU | RFU
//
// 1 0 .. UID complete, ATS available
// 0 0 .. UID complete, ATS not available
// X 1 .. UID not complete
//
char M500PiccCascSelect(unsigned char select_code,
unsigned char *snr,
unsigned char *sak);
// _____________________________________________________________________________
//
// FUNCTION: MfPiccAuth
// IN: auth_mode PICC_AUTHENT1A or PICC_AUTHENT1B
// selects master key A or master key B
// KS0, KS1, KS2 selects one of the three master key sets.
// *snr 4 byte serial number of the card, which should be
// authenticated
// key_sector spec. the key RAM address from which the data should be
// taken (0..15)
// block addresses the block address on the card, which shall be
// authenticated. For MIFARE standard cards, addr can take
// a value from 0 to 63, for other card types please refer
// to the according product description.
// OUT: -
// RETURN:
// COMMENT: This function authenticates one card's sector (according to the
// block address addr) using the specified mode and master key,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -