cpuidc.c 704 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #include <stdio.h>
  2. #include "nuclei_sdk_soc.h"
  3. #include "cpuidh.h"
  4. #include "config.h"
  5. volatile SPDP theseSecs = 0.0;
  6. volatile SPDP startSecs = 0.0;
  7. volatile SPDP secs;
  8. SPDP time()
  9. {
  10. #if defined(CPU_SERIES) && CPU_SERIES == 100
  11. return (SPDP)__get_rv_time() / SOC_TIMER_FREQ;
  12. #else
  13. #if defined(__SYSTIMER_PRESENT) && (__SYSTIMER_PRESENT == 1)
  14. return (SPDP) SysTimer_GetLoadValue() / SOC_TIMER_FREQ;
  15. #else
  16. #error "This example require CPU System Timer feature"
  17. #endif
  18. #endif
  19. }
  20. void getSecs()
  21. {
  22. theseSecs = time() ;
  23. return;
  24. }
  25. void start_time()
  26. {
  27. getSecs();
  28. startSecs = theseSecs;
  29. return;
  30. }
  31. void end_time()
  32. {
  33. getSecs();
  34. secs = theseSecs - startSecs;
  35. return;
  36. }