?? rc500_m500a.h
字號:
// _____________________________________________________________________________
//
// FUNCTION: PcdReadE2
// IN: startaddr 2 bytes of starting address of the E2PROM
// length number of byte of data to be read
// OUT: *_data buffer for the read bytes
// RETURN:
// 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 idata * _data);
// _____________________________________________________________________________
//
// 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: M500PcdLoadKeyE2
// IN: key_type PICC_AUTHENT1A or PICC_AUTHENT1B
// sector key sector number, on which the key should be stored
// values from 0 to 15 are valid
// uncoded_keys 6 bytes key
// OUT: -
// RETURN:
// COMMENT: This function stores the keys in the reader internal E2PROM.
// These keys are available for the function M500PiccAuthE2.
//
char M500PcdLoadKeyE2(unsigned char key_type,
unsigned char sector,
unsigned char *uncoded_keys);
// _____________________________________________________________________________
//
// FUNCTION: M500HostCodeKey
// IN: uncoded 6 bytes master key for card authentication
// OUT: coded 12 bytes master key for card authentication
// RETURN:
// COMMENT: In order to authenticate a memory sector of a card, a 6
// bytes master key is necessary. This master key has to be passed
// to the reader modul coded. The conversion between uncoded and
// coded keys is made by this function.
//
char M500HostCodeKey(unsigned char *uncoded,
unsigned char *coded);
// _____________________________________________________________________________
//
// 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: 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: 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 two 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);
void idle_request(void);
#ifdef __cplusplus
}
#endif
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -