/** * * @brief Get the time ticks before test starts * * Routine does necessary preparations for the test to start * * @return N/A */ void begin_test(void) { /* * Invoke bench_test_start in order to be able to use * tCheck static variable. */ bench_test_start(); }
/** * * @brief The test main function * * @return 0 on success */ int nanoIntLockUnlock(void) { int i; unsigned int mask; PRINT_FORMAT(" 5- Measure average time to lock then unlock interrupts"); bench_test_start(); timestamp = TIME_STAMP_DELTA_GET(0); for (i = 0; i < NTESTS; i++) { mask = irq_lock(); irq_unlock(mask); } timestamp = TIME_STAMP_DELTA_GET(timestamp); if (bench_test_end() == 0) { PRINT_FORMAT(" Average time for lock then unlock " "is %lu tcs = %lu nsec", timestamp / NTESTS, SYS_CLOCK_HW_CYCLES_TO_NS_AVG(timestamp, NTESTS)); } else { errorCount++; PRINT_OVERFLOW_ERROR(); } return 0; }