imc_kernel.c 430 B

1234567891011121314151617181920
  1. #include "ImC/imc_kernel.h"
  2. #include "stm32l5xx.h"
  3. int checkpointCounter = 0;
  4. const int checkpoint_pass_count = imcCHECKPOINT_PASS_COUNT;
  5. void imcInit()
  6. {
  7. FPU->FPCCR &= ~(FPU_FPCCR_LSPEN_Msk); // turn off lazy stacking
  8. }
  9. int needCheckpointExecution() {
  10. if (checkpointCounter == checkpoint_pass_count) {
  11. checkpointCounter = 0;
  12. return 1;
  13. } else {
  14. checkpointCounter++;
  15. return 0;
  16. }
  17. }