CM_SETUSER.c 764 B

123456789101112131415161718192021222324252627282930
  1. // Set User Zone
  2. //
  3. // CryptoMemory Library Include Files
  4. #include "CM_LIB.h"
  5. #include "CM_GPA.h"
  6. // Set User Zone
  7. uint8_t cm_SetUserZone(uint8_t ucZoneNumber, uint8_t ucAntiTearing)
  8. {
  9. uint8_t ucReturn;
  10. ucCM_InsBuff[0] = 0xb4;
  11. if (ucAntiTearing) ucCM_InsBuff[1] = 0x0b;
  12. else ucCM_InsBuff[1] = 0x03;
  13. ucCM_InsBuff[2] = ucZoneNumber;
  14. ucCM_InsBuff[3] = 0x00;
  15. // Only zone number is included in the polynomial
  16. cm_GPAGen(ucZoneNumber);
  17. if ((ucReturn = CM_LOW_LEVEL.SendCommand(ucCM_InsBuff))!= SUCCESS) return ucReturn;
  18. // save zone number and anti-tearing state
  19. ucCM_UserZone = ucZoneNumber;
  20. ucCM_AntiTearing = ucAntiTearing;
  21. // done
  22. return SUCCESS;//CM_LOW_LEVEL.ReceiveRet(NULL,0);
  23. }