CM_NOPOWER.c 940 B

1234567891011121314151617181920212223242526272829303132333435
  1. // Functions control the logical power on/off for the chip
  2. #include "CM_LIB.h"
  3. #include "CM_I2C.h"
  4. #include "CM_I2C_L.h"
  5. #include "CM_GPA.h"
  6. #include "hal_interface_api.h"
  7. // Power On Chip
  8. //
  9. // Returns 0 (SUCCESS) if no error
  10. //
  11. void cm_PowerOn(void)
  12. {
  13. // Reset chip data
  14. cm_ResetCrypto();
  15. ucCM_UserZone = ucCM_AntiTearing = 0;
  16. // Sequence for powering on secure memory according to ATMEL spec
  17. CM_DATA_OUT; // SDA and SCL start as outputs
  18. CM_CLK_OUT;
  19. CM_CLK_LO; // Clock should start LOW
  20. CM_DATA_HI; // Data high during reset
  21. cm_ClockCycles(CM_PWRON_CLKS); // Give chip some clocks cycles to get started
  22. // Chip should now be in sync mode and ready to operate
  23. }
  24. // Shut down secure memory
  25. //
  26. void cm_PowerOff(void)
  27. {
  28. cm_Delay(1);
  29. CM_CLK_LO;
  30. cm_Delay(6);
  31. }