time.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #pragma once
  2. #include "software-modes.h"
  3. // INIT MODE
  4. void busyWaitDuring_initMode (INIT_MODE_ const uint32_t inDelayMS) ;
  5. // FAULT MODE
  6. void configureSystick_faultMode (FAULT_MODE) ;
  7. void busyWaitDuring_faultMode (FAULT_MODE_ const uint32_t inDelayMS) ;
  8. // USER MODE
  9. void waitDuring (USER_MODE_ const uint32_t inDelayMS) ;
  10. void waitUntil (USER_MODE_ const uint32_t inDeadlineMS) asm ("wait.until");
  11. // SERVICE
  12. void service_waitUntil (KERNEL_MODE_ const uint32_t inDeadLineMS) asm ("service.wait.until");
  13. //$service wait.until
  14. // ANY MODE
  15. uint32_t systick (ANY_MODE) ;
  16. uint32_t millis (ANY_MODE) ;
  17. // micros current value
  18. //$section time.micros
  19. uint64_t micros (USER_MODE) asm ("time.micros") ;
  20. uint64_t section_micros (SECTION_MODE) asm ("section.time.micros") ;
  21. // INTERRUPT ROUTINE
  22. //$interrupt-service SysTick
  23. void systickInterruptServiceRoutine (IRQ_MODE) asm ("interrupt.service.SysTick") ;
  24. // Insert routine address into 'real.time.interrupt.routine.array' section
  25. #define MACRO_REAL_TIME_ISR(ROUTINE) \
  26. static void (* UNIQUE_IDENTIFIER) (IRQ_MODE_ const uint32_t inUptime) \
  27. __attribute__ ((section ("real.time.interrupt.routine.array"))) \
  28. __attribute__ ((unused)) \
  29. __attribute__ ((used)) = ROUTINE ;