time.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 busyWaitDuring (USER_MODE_ const uint32_t inDelayMS) ;
  10. void busyWaitUntil (USER_MODE_ const uint32_t inDeadlineMS) ;
  11. // ANY MODE
  12. uint32_t systick (ANY_MODE) ;
  13. uint32_t millis (ANY_MODE) ;
  14. // micros current value
  15. //$section time.micros
  16. uint64_t micros (USER_MODE) asm ("time.micros") ;
  17. uint64_t section_micros (SECTION_MODE) asm ("section.time.micros") ;
  18. // INTERRUPT ROUTINE
  19. //$interrupt-section SysTick
  20. void systickInterruptServiceRoutine (SECTION_MODE) asm ("interrupt.section.SysTick") ;
  21. // Insert routine address into 'real.time.interrupt.routine.array' section
  22. #define MACRO_REAL_TIME_ISR(ROUTINE) \
  23. static void (* UNIQUE_IDENTIFIER) (SECTION_MODE_ const uint32_t inUptime) \
  24. __attribute__ ((section ("real.time.interrupt.routine.array"))) \
  25. __attribute__ ((unused)) \
  26. __attribute__ ((used)) = ROUTINE ;