📄 m500a.h
字号:
// authentication of the secified sector. In order to get the
// required keys coded, the function M500HostCodeKey can be used.
//
char M500PiccAuthKey(unsigned char auth_mode,
unsigned char *snr,
unsigned char *keys,
unsigned char sector);
// _____________________________________________________________________________
//
// FUNCTION: M500PiccRead
// IN: addr addresses - the block on the card from which data shall
// be read. For MIFARE standard cards, addr can take a value
// from 0 to 63 (255 for Mifare Pro), for other card types
// please refer to the according product description.
// OUT: data is a pointer to the 16 byte data block read from the card.
// OUT:
// RETURN:
// COMMENT: This function reads a 16 byte block from the specified card's block
// address addr. After sending the command to the card the function
// waits for the card's answer.
//
char M500PiccRead(unsigned char addr,
unsigned char *_data);
// _____________________________________________________________________________
//
// FUNCTION: M500PiccWrite
// IN: addr address - the block on the card from which data shall
// be read. For MIFARE standard cards, addr can take a
// value from 0 to 63 (255 for Mifare Pro), for other card
// types please refer to the according product description.
// data is a pointer to the 16 byte data block that shall be
// written to the card.
// OUT: -
// RETURN:
// COMMENT: This function writes a 16 byte block to the specified card's block
// address addr. After sending the command to the card the function
// waits for the card's answer.
//
char M500PiccWrite(unsigned char addr,
unsigned char *_data);
// _____________________________________________________________________________
//
// FUNCTION: M500PiccValue
// IN: dd_mode INCREMENT, DECREMENT or RESTORE
// addr Block address for the command to be perform 0-63
// *value 4 bytes value, LSB first
// trans_addr Destination block address to be tranfer
// OUT: -
// COMMENT:
// This function performs the INCREMENT, DECREMENT and RESTORE command. Precondition
// for success is, that the data block is formatted as value block.
//
// For INCREMENT and DECREMENT, the command doesn't write back the value to the memory
// location directly, but loads the transfer buffer with the increased value,
// which could be transferred to any authenticated block by the TRANFER command.
//
// The RESTORE command loads the transfer buffer with the value stored at datablock
// address, while the
// given value is only a dummy value, which only have to be in valid range.
// With a subsquent TRANSFER command a backup management for Value Blocks is
// established.
//
// After sending the command to the card the function waits for the
// card's answer. In case of an error <em>Mf500PiccValue()</em>
// generates a return code according to the MF RC's error flags, otherwise
// the value is sent to the card and then it waits for a NACK. As an exception
// in this protocol step
// only a NACK is sent by the card in case of an error. Thus, the function
// is successful, if a time out occurs.
//
// After the calculation is done, a TRANSFER is automatically
// performed to the block address trans_addr. After sending the command to
// the card the function waits for the card's answer
// and generates a return code according to the MF RC's error flags.
// A TRAN command is only possible directly after a RESTORE, INCREMENT or
// DECREMENT command.
//
// The value inside a Value Block is four bytes wide and stored tow times
// in normal and one time in bit-inverted manner for data security issues.
// Additionally the initial address of the Value Block is stored two times
// normal and two times bit-inverted. In case of a backup of a Value Block,
// this addres contains the original address of the Value Block.
// Note: Only positive numbers are alowed for the parameter <em>value</em>.
//
char M500PiccValue(unsigned char dd_mode,
unsigned char addr,
unsigned char *value,
unsigned char trans_addr);
// _____________________________________________________________________________
//
// FUNCTION: M500PiccValueDebit
// IN: dd_mode INCREMENT, DECREMENT or RESTORE
// addr Block address for the command to be perform 0-63
// *value 4 bytes value, LSB first
// OUT: -
// COMMENT:
// This function executes calculations on value debit blocks with cards, that
// support automatic transfer (MIFARE light, MIFARE PLUS, MIFARE PRO,
// MIFARE PROX, ...).
//
// After sending the command
// to the card the function waits for the card's answer. In case of an error
// it generates a return code according
// to the MF RC's error flags.
//
char M500PiccValueDebit(unsigned char dd_mode,
unsigned char addr,
unsigned char *value);
// _____________________________________________________________________________
//
// FUNCTION: M500PiccExchangeBlock
// IN: *send_data
// send_bytelen Lenght include 2bytes CRC
// append_crc 1->append, 0->not append
// timeout Set duration of timeout timer
// 1-> 1s
// 2-> 1.5s
// 3-> 6s
// 4-> 9.6s
// OUT: *rec_data
// *rec_bytelen
// COMMENT:
// This function exchanges data blocks between the <b>PCD</b> and <b>PICC</b>.
//
// ATTENTION: if <em>append_crc</em> is enabled, two CRC bytes are included in
// <em>send_bytelen</em> and <em>rec_bytelen</em>. The received CRC bytes in the
// receive buffer are always set to zero.
//
char M500PiccExchangeBlock(unsigned char *send_data,
unsigned char send_bytelen,
unsigned char *rec_data,
unsigned char *rec_bytelen,
unsigned char append_crc,
unsigned char timeout);
// _____________________________________________________________________________
//
// FUNCTION: M500PiccHalt
// IN: -
// OUT: -
// RETURN: -
// COMMENT: This function sets the MIFARE card into the halt state. After
// sending the command to the card the function waits for a cards
// response. As an exception, in this protocol step no ACK is sent by
// the card, but only a NACK in case of an error. Thus, the function
// is successful, if a time out occurs.
//
char M500PiccHalt(void);
// _____________________________________________________________________________
//
// FUNCTION: M531PiccRequestB
// IN: rq_code can take the following values
// ALL Request Code with b4=1 is sent out to get also a
// response from cards in halt state.
// STD Request Code with b4=0 is sent out to get a response
// only from cards that are not in halt state.
// AFI Application Family Code. (refer to ISO14443 doc.)
// N number of slot
// N=0 .. 1 slot
// N=1 .. 2 slots
// N=2 .. 4 slots
// N=3 .. 8 slots
// N=4 .. 16 slots
// OUT: *ATQB 14 bytes ATQB (answer to request) (incl. command byte & CRC16)
// ATQB[1]--ATQB[4] .. 4bytes of PUPI
// ATQB[5]--ATQB[8] .. 4bytes of Application Data
// ATQB[9] .. Bit_Rate_capability
// ATQB[10](upper 4 bits) .. Max_Frame_Size
// ATQB[10](lower 4 bits) .. Protocol_Type
// ATQB[11](upper 4 bits) .. FWI
// ATQB[11](lower 4 bits) .. ADC(2 bitS) & FO(2 bits)
// RETURN:
// COMMENT: This function accesses the reader module and activates sending the
// REQB code to the ISO14443B card. After sending the command to the card
// the function waits for the card's answer.
//
// Note: Only card response in time_slot1 will reply with a REQB in this
// command. Response of card in other time_slot have to be request
// by the Slot-Marker command.
//
// ATQB:
//
// +----+----+----+----+----+----+----+----+----+----+----+----+----+----+
// | B1 | B2 | B3 | B4 | B5 | B6 | B7 | B8 | B9 |B10 |B11 |B12 |B13 |B14 |
// +----+----+----+----+----+----+----+----+----+----+----+----+----+----+
// | | | | | |
// |0x50| PUPI | Application DATA |Protocol Info | CRC16 |
// | | | | | |
//
//
char M531PiccRequestB(unsigned char req_code,
unsigned char AFI,
unsigned char N,
unsigned char *ATQB);
// _____________________________________________________________________________
//
// FUNCTION: M531PiccSlotMarker
// IN: N timeslot number (1..15)
// OUT: *ATQB 14 bytes ATQB (answer to request) (incl. command byte & CRC16)
// ATQB[1]--ATQB[4] .. 4bytes of PUPI
// ATQB[5]--ATQB[8] .. 4bytes of Application Data
// ATQB[9] .. Bit_Rate_capability
// ATQB[10](upper 4 bits) .. Max_Frame_Size
// ATQB[10](lower 4 bits) .. Protocol_Type
// ATQB[11](upper 4 bits) .. FWI
// ATQB[11](lower 4 bits) .. RFU(2 bitS) & FO(2 bits)
// RETURN:
// COMMENT: This function send out a Slot-marker to define the start of each time
// slot. After sending the command to the card the function waits for the
// card's answer.
//
// ATQB:
//
// +----+----+----+----+----+----+----+----+----+----+----+----+----+----+
// | B1 | B2 | B3 | B4 | B5 | B6 | B7 | B8 | B9 |B10 |B11 |B12 |B13 |B14 |
// +----+----+----+----+----+----+----+----+----+----+----+----+----+----+
// | | | | | |
// |0x50| PUPI | Application DATA |Protocol Info | CRC16 |
// | | | | | |
//
//
char M531PiccSlotMarker(unsigned char N,
unsigned char *ATQB);
// _____________________________________________________________________________
//
// FUNCTION: M531PiccAttrib
// IN: *PUPI 4 bytes od identifier
// CID dedicated channel, (1..14) (15 is Reserve)
// brTx baud rate from PCD to PICC
// brRx baud rate from PICC to PCD
// definition:- 00 = 106 kbit/s
// 01 = 212 kbit/s
// 10 = 424 kbit/s
// 11 = 847 kbit/s
// PARAM3 0 -- ISO14443-4 not compliance
// 1 -- ISO14443-4 compliance
// RETURN:
// COMMENT: This function send out a ATTRIB to select and assigned a PICC to a
// dedicated channel as defined by CID. After sending the command to
// the card the function waits for the card's answer.
//
// ATTRIB format:
//
// +----+----+----+----+----+----+----+----+----+----+----+
// | B1 | B2 | B3 | B4 | B5 | B6 | B7 | B8 | B9 |B10 |B11 |
// +----+----+----+----+----+----+----+----+----+----+----+
// | | | | | | | |
// |0x1d| PUPI |PAR1|PAR2|PAR3| CID| CRC16 |
// | | | | | | | |
//
//
char M531PiccAttrib(unsigned char *PUPI,
unsigned char CID,
unsigned char brTx,
unsigned char brRx,
unsigned char PARAM3);
// _____________________________________________________________________________
//
// FUNCTION: MfPcdRfReset
// IN: msec Duration of RF-field off in mseconds.
// If parameter msec is 0 => RF OFF forever
// OUT: -
// GLOBAL: -
// RETURN:
// COMMENT: Turns off RF-field for a certain time in mseconds. The period
// is specified in variable 'msec'. Subsequently RF-field is
// turned on again (after about 1 msec). If value 0 is chosen,
// the RF-field is simply turned off.
//
char M500PcdRfReset(unsigned int ms);
unsigned long M500PcdStopWatch (unsigned char start);
#ifdef __cplusplus
}
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -