123456789101112131415161718192021222324252627282930313233 |
- // Read User Zone
- //
- // The Read Large User Zone function is used to read data from CryptoMemory devices
- // that have greater than 256 bytes in each user zone (AT88SC6416C, and larger)
- // CryptoMemory Library Include Files
- #include "CM_LIB.h"
- #include "CM_I2C.h"
- #include "CM_I2C_L.h"
- #include "CM_GPA.h"
- // Read User Zone
- uint8_t cm_ReadLargeZone(uint32_t uiCryptoAddr, uint8_t* pucBuffer, uint8_t ucCount)
- {
- uint8_t ucReturn;
- ucCM_InsBuff[0] = 0xb2;
- ucCM_InsBuff[1] = (uint8_t)(uiCryptoAddr>>8);
- ucCM_InsBuff[2] = (uint8_t)uiCryptoAddr;
- ucCM_InsBuff[3] = ucCount;
- // Three bytes of the command must be included in the polynominals
- cm_GPAcmd3(ucCM_InsBuff);
-
- // Read the data
- if ((ucReturn = cm_ReadCommand(ucCM_InsBuff, pucBuffer, ucCount)) != SUCCESS) return ucReturn;
-
- // Include the data in the polynominals and decrypt if required
- cm_GPAdecrypt(ucCM_Encrypt, pucBuffer, ucCount);
- return SUCCESS;
- }
|