NXP Reader Library  v17.1.0.2535
Commands_DataManagement

These Components implement the MIFARE DESFire EVx Data Management related commands. More...

Collaboration diagram for Commands_DataManagement:

Functions

phStatus_t phalMfdfEVx_ReadData (void *pDataParams, uint8_t bOption, uint8_t bIns, uint8_t bFileNo, uint8_t *pOffset, uint8_t *pLength, uint8_t **ppRxdata, uint16_t *pRxdataLen)
 Reads data from standard data files or backup data files. More...
 
phStatus_t phalMfdfEVx_WriteData (void *pDataParams, uint8_t bOption, uint8_t bIns, uint8_t bFileNo, uint8_t *pOffset, uint8_t *pTxData, uint8_t *pTxDataLen)
 Writes data to standard data files or backup data files. More...
 
phStatus_t phalMfdfEVx_GetValue (void *pDataParams, uint8_t bCommOption, uint8_t bFileNo, uint8_t *pValue)
 Reads the currently stored value from value files. More...
 
phStatus_t phalMfdfEVx_Credit (void *pDataParams, uint8_t bCommOption, uint8_t bFileNo, uint8_t *pValue)
 Increases a value stored in a Value File. More...
 
phStatus_t phalMfdfEVx_Debit (void *pDataParams, uint8_t bCommOption, uint8_t bFileNo, uint8_t *pValue)
 Decreases a value stored in a Value File. More...
 
phStatus_t phalMfdfEVx_LimitedCredit (void *pDataParams, uint8_t bCommOption, uint8_t bFileNo, uint8_t *pValue)
 Allows a limited increase of a value stored in a Value File without having full credit permissions to the file. More...
 
phStatus_t phalMfdfEVx_ReadRecords (void *pDataParams, uint8_t bCommOption, uint8_t bIns, uint8_t bFileNo, uint8_t *pRecNo, uint8_t *pRecCount, uint8_t *pRecSize, uint8_t **ppRxdata, uint16_t *pRxdataLen)
 Reads out a set of complete records from a Cyclic or Linear Record File. More...
 
phStatus_t phalMfdfEVx_WriteRecord (void *pDataParams, uint8_t bCommOption, uint8_t bIns, uint8_t bFileNo, uint8_t *pOffset, uint8_t *pData, uint8_t *pDataLen)
 Writes data to a record in a Cyclic or Linear Record File. More...
 
phStatus_t phalMfdfEVx_UpdateRecord (void *pDataParams, uint8_t bCommOption, uint8_t bIns, uint8_t bFileNo, uint8_t *pRecNo, uint8_t *pOffset, uint8_t *pData, uint8_t *pDataLen)
 Updates data to a record in a Cyclic or Linear Record File. More...
 
phStatus_t phalMfdfEVx_ClearRecordFile (void *pDataParams, uint8_t bFileNo)
 Resets a Cyclic or Linear Record File. More...
 

Chaining format to be used for DataManagement commands.

#define PHAL_MFDFEVX_APPLICATION_CHAINING   0x00U
 Option to represent the application chaining format. More...
 
#define PHAL_MFDFEVX_ISO_CHAINING   0x01U
 Option to represent the ISO14443-4 chaining format. More...
 

Detailed Description

These Components implement the MIFARE DESFire EVx Data Management related commands.

Macro Definition Documentation

◆ PHAL_MFDFEVX_APPLICATION_CHAINING

#define PHAL_MFDFEVX_APPLICATION_CHAINING   0x00U

Option to represent the application chaining format.

Here AF will be available in command and response.

◆ PHAL_MFDFEVX_ISO_CHAINING

#define PHAL_MFDFEVX_ISO_CHAINING   0x01U

Option to represent the ISO14443-4 chaining format.

Here AF will not be available in command and response rather the chaining will be done using the ISO14443-4 protocol.

Function Documentation

◆ phalMfdfEVx_ReadData()

phStatus_t phalMfdfEVx_ReadData ( void *  pDataParams,
uint8_t  bOption,
uint8_t  bIns,
uint8_t  bFileNo,
uint8_t pOffset,
uint8_t pLength,
uint8_t **  ppRxdata,
uint16_t pRxdataLen 
)

Reads data from standard data files or backup data files.

Remarks
Chaining upto the size of the HAL Rx buffer is handled within this function. If more data is to be read, the user has to call this function again with bOption = PH_EXCHANGE_RXCHAINING | [one of the communication options]
Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_SUCCESS_CHAININGindicating more data to be read.
Dependingon implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Communication settings for the file. PH_EXCHANGE_RXCHAINING: To be Or'd with the above option flag if Chaining status is returned.
[in]bIns[In] One of the below options.
[in]bFileNo[In] The file number from where the data to be read. ORed with PHAL_MFDFEVX_SAI to indicate secondary application indicator.
[in]pOffset[In] The offset from where the data should be read. Will be of 3 bytes with LSB first. If 0x10 need to be offset then it will be 10 00 00.
[in]pLength[In] The number of bytes to be read. Will be of 3 bytes with LSB first. If 0x10 bytes need to be read then it will be 10 00 00.
If complete file need to be read then it will be 00 00 00.
[out]ppRxdata[Out] The data returned by the PICC.
[out]pRxdataLen[Out] Length of bytes available in RxData buffer.

◆ phalMfdfEVx_WriteData()

phStatus_t phalMfdfEVx_WriteData ( void *  pDataParams,
uint8_t  bOption,
uint8_t  bIns,
uint8_t  bFileNo,
uint8_t pOffset,
uint8_t pTxData,
uint8_t pTxDataLen 
)

Writes data to standard data files or backup data files.

Remarks
Implements chaining to the card.
Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Communication settings for the file.
[in]bIns[In] One of the below options.
[in]bFileNo[In] The file number to which the data to be written. ORed with PHAL_MFDFEVX_SAI to indicate secondary application indicator.
[in]pOffset[In] The offset from where the data should be written. Will be of 3 bytes with LSB first. If 0x10 need to be offset then it will be 10 00 00.
[in]pTxData[In] The data to be written to the PICC.
[in]pTxDataLen[In] The number of bytes to be written. Will be of 3 bytes with LSB first. If 0x10 bytes need to be written then it will be 10 00 00.

◆ phalMfdfEVx_GetValue()

phStatus_t phalMfdfEVx_GetValue ( void *  pDataParams,
uint8_t  bCommOption,
uint8_t  bFileNo,
uint8_t pValue 
)

Reads the currently stored value from value files.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bCommOption[In] Communication settings for the file.
[in]bFileNo[In] The file number for which the value to the retrieved. ORed with PHAL_MFDFEVX_SAI to indicate secondary application indicator.
[out]pValue[Out] The value returned by the PICC. The buffer should be 4 bytes.

◆ phalMfdfEVx_Credit()

phStatus_t phalMfdfEVx_Credit ( void *  pDataParams,
uint8_t  bCommOption,
uint8_t  bFileNo,
uint8_t pValue 
)

Increases a value stored in a Value File.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bCommOption[In] Communication settings for the file.
[in]bFileNo[In] The file number to which the value should be credited. ORed with PHAL_MFDFEVX_SAI to indicate secondary application indicator.
[out]pValue[Out] The value to be credited. Will be of 4 bytes with LSB first. If 0x10 bytes need to be credited then it will be 10 00 00 00.

◆ phalMfdfEVx_Debit()

phStatus_t phalMfdfEVx_Debit ( void *  pDataParams,
uint8_t  bCommOption,
uint8_t  bFileNo,
uint8_t pValue 
)

Decreases a value stored in a Value File.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bCommOption[In] Communication settings for the file.
[in]bFileNo[In] The file number to which the value should be debited. ORed with PHAL_MFDFEVX_SAI to indicate secondary application indicator.
[out]pValue[Out] The value to be debited. Will be of 4 bytes with LSB first. If 0x10 bytes need to be debited then it will be 10 00 00 00.

◆ phalMfdfEVx_LimitedCredit()

phStatus_t phalMfdfEVx_LimitedCredit ( void *  pDataParams,
uint8_t  bCommOption,
uint8_t  bFileNo,
uint8_t pValue 
)

Allows a limited increase of a value stored in a Value File without having full credit permissions to the file.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bCommOption[In] Communication settings for the file.
[in]bFileNo[In] The file number to which the value should be credited. ORed with PHAL_MFDFEVX_SAI to indicate secondary application indicator.
[out]pValue[Out] The value to be credited. Will be of 4 bytes with LSB first. If 0x10 bytes need to be credited then it will be 10 00 00 00.

◆ phalMfdfEVx_ReadRecords()

phStatus_t phalMfdfEVx_ReadRecords ( void *  pDataParams,
uint8_t  bCommOption,
uint8_t  bIns,
uint8_t  bFileNo,
uint8_t pRecNo,
uint8_t pRecCount,
uint8_t pRecSize,
uint8_t **  ppRxdata,
uint16_t pRxdataLen 
)

Reads out a set of complete records from a Cyclic or Linear Record File.

Remarks
The Read Records command reads and stores data in the RxBuffer upto the RxBuffer size before returning to the user. The RxBuffer is configured during the HAL init and this is specified by the user.

Chaining upto the size of the HAL Rx buffer is handled within this function. If more data is to be read, the user has to call this function again with bCommOption = PH_EXCHANGE_RXCHAINING | [one of the communication options]

If TMI collection is ON, if pRecCount is zero then pRecSize is mandatory parameter. If pRecSize and RecCount are zero and TMI collection is ON, then PH_ERR_INVALID_PARAMETER error returned. If TMI collection is ON; and if wrong pRecSize is provided, then wrong RecCount value will be calculated and updated for TMI collection.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_SUCCESS_CHAININGindicating more data to be read.
Dependingon implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bCommOption[In] Communication settings for the file. PH_EXCHANGE_RXCHAINING: To be Or'd with the above option flag if Chaining status is returned.
[in]bIns[In] One of the below options.
[in]bFileNo[In] The file number from where the data to be read. ORed with PHAL_MFDFEVX_SAI to indicate secondary application indicator.
[in]pRecNo[In] 3 bytes LSB first. Record number of the newest record targeted, starting to count from the latest record written.
[in]pRecCount[In] 3 bytes LSB first. Number of records to be read. If 0x00 00 00, then all the records are read.
[in]pRecSize[In] The number of bytes to be read. Will be of 3 bytes with LSB first.
[out]ppRxdata[Out] The data returned by the PICC.
[out]pRxdataLen[Out] Length of bytes available in RxData buffer.

◆ phalMfdfEVx_WriteRecord()

phStatus_t phalMfdfEVx_WriteRecord ( void *  pDataParams,
uint8_t  bCommOption,
uint8_t  bIns,
uint8_t  bFileNo,
uint8_t pOffset,
uint8_t pData,
uint8_t pDataLen 
)

Writes data to a record in a Cyclic or Linear Record File.

Remarks
Implements chaining to the card. The data provided on pData will be chained to the card by sending data upto the frame size of the DESFire PICC, at a time.
Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bCommOption[In] Communication settings for the file.
[in]bIns[In] One of the below options.
[in]bFileNo[In] The file number to which the data should be written. ORed with PHAL_MFDFEVX_SAI to indicate secondary application indicator.
[in]pOffset[In] The offset from where the data should be written. Will be of 3 bytes with LSB first. If 0x10 need to be offset then it will be 10 00 00.
[in]pData[In] The data to be written to the PICC.
[in]pDataLen[In] The number of bytes to be written. Will be of 3 bytes with LSB first. If 0x10 bytes need to be written then it will be 10 00 00.

◆ phalMfdfEVx_UpdateRecord()

phStatus_t phalMfdfEVx_UpdateRecord ( void *  pDataParams,
uint8_t  bCommOption,
uint8_t  bIns,
uint8_t  bFileNo,
uint8_t pRecNo,
uint8_t pOffset,
uint8_t pData,
uint8_t pDataLen 
)

Updates data to a record in a Cyclic or Linear Record File.

Remarks
Implements chaining to the card. The data provided on pData will be chained to the card by sending data upto the frame size of the DESFire PICC, at a time.
Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bCommOption[In] Communication settings for the file.
[in]bIns[In] One of the below options.
[in]bFileNo[In] The file number to which the data should be written. ORed with PHAL_MFDFEVX_SAI to indicate secondary application indicator.
[in]pRecNo[In] Record number. Records are numbered starting with the latest record written.
[in]pOffset[In] Starting position for the update operation within the targeted record.
[in]pData[In] The data to be written to the PICC.
[in]pDataLen[In] The number of bytes to be written. Will be of 3 bytes with LSB first. If 0x10 bytes need to be written then it will be 10 00 00.

◆ phalMfdfEVx_ClearRecordFile()

phStatus_t phalMfdfEVx_ClearRecordFile ( void *  pDataParams,
uint8_t  bFileNo 
)

Resets a Cyclic or Linear Record File.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bFileNo[In] The file number to be cleared. ORed with PHAL_MFDFEVX_SAI to indicate secondary application indicator.