/** * @brief CPU pulse. * @note The current implementation is not totally reliable. * * @param[in] duration CPU pulse duration in milliseconds */ void test_cpu_pulse(unsigned duration) { systime_t start, end, now; start = chThdGetTicksX(chThdGetSelfX()); end = start + MS2ST(duration); do { now = chThdGetTicksX(chThdGetSelfX()); #if defined(SIMULATOR) _sim_check_for_interrupts(); #endif } while (chVTIsTimeWithinX(now, start, end)); }
/** * @brief CPU pulse. * @note The current implementation is not totally reliable. * * @param[in] duration CPU pulse duration in milliseconds */ void test_cpu_pulse(unsigned duration) { systime_t start, end, now; start = chThdGetTicksX(chThdGetSelfX()); end = start + MS2ST(duration); do { now = chThdGetTicksX(chThdGetSelfX()); #if defined(SIMULATOR) _sim_check_for_interrupts(); #endif } while (end > start ? (now >= start) && (now < end) : (now >= start) || (now < end)); }