1234567891011121314151617181920212223242526272829 |
- // Read Checksum
- //
- // CryptoMemory Library Include Files
- #include "CM_LIB.h"
- #include "CM_I2C.h"
- #include "CM_I2C_L.h"
- #include "CM_GPA.h"
- uint8_t ucCmdRdChk[4] = {0xb6, 0x02, 0x00, 0x02};
- // Read Checksum
- uint8_t cm_ReadChecksum(uint8_t * pucChkSum)
- {
- uint8_t ucDCR[1];
- uint8_t ucReturn;
- // 20 0x00s (10 0x00s, ignore first byte, 5 0x00s, ignore second byte, 5 0x00s
- cm_GPAGenN(20);
-
- // Read the checksum
- if((ucReturn = cm_ReadCommand(ucCmdRdChk, pucChkSum, 2))!= SUCCESS) return ucReturn;
-
- // Check if unlimited reads allowed
- if ((ucReturn = cm_ReadConfigZone(DCR_ADDR, ucDCR, 1)) != SUCCESS) return ucReturn;
- if ((ucDCR[0]&DCR_UCR)) cm_ResetCrypto();
-
- return SUCCESS;
- }
|