Merge pull request #846 from simonduq/pr/rtimer-busywait-no-watchdog
Do not refresh watchdog in rtimer busy-wait macros
This commit is contained in:
commit
8974aa19d5
@ -35,6 +35,8 @@
|
|||||||
|
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
#include "sys/clock.h"
|
#include "sys/clock.h"
|
||||||
|
#include "lib/simEnvChange.h"
|
||||||
|
#include "sys/cooja_mt.h"
|
||||||
|
|
||||||
#define RTIMER_ARCH_SECOND UINT64_C(1000000)
|
#define RTIMER_ARCH_SECOND UINT64_C(1000000)
|
||||||
|
|
||||||
@ -47,4 +49,17 @@ int rtimer_arch_check(void);
|
|||||||
int rtimer_arch_pending(void);
|
int rtimer_arch_pending(void);
|
||||||
rtimer_clock_t rtimer_arch_next(void);
|
rtimer_clock_t rtimer_arch_next(void);
|
||||||
|
|
||||||
|
/** \brief A platform-specific implementation that calls cooja_mt_yield()
|
||||||
|
* periodically. Without this, Cooja will get stuck in the busy-loop
|
||||||
|
* without ever updating the current rtimer time. */
|
||||||
|
#define RTIMER_BUSYWAIT_UNTIL_ABS(cond, t0, max_time) \
|
||||||
|
({ \
|
||||||
|
bool c; \
|
||||||
|
while(!(c = cond) && RTIMER_CLOCK_LT(RTIMER_NOW(), (t0) + (max_time))) { \
|
||||||
|
simProcessRunValue = 1; \
|
||||||
|
cooja_mt_yield(); \
|
||||||
|
} \
|
||||||
|
c; \
|
||||||
|
})
|
||||||
|
|
||||||
#endif /* RTIMER_ARCH_H_ */
|
#endif /* RTIMER_ARCH_H_ */
|
||||||
|
@ -189,14 +189,14 @@ void rtimer_arch_schedule(rtimer_clock_t t);
|
|||||||
#endif /* RTIMER_CONF_GUARD_TIME */
|
#endif /* RTIMER_CONF_GUARD_TIME */
|
||||||
|
|
||||||
/** \brief Busy-wait until a condition. Start time is t0, max wait time is max_time */
|
/** \brief Busy-wait until a condition. Start time is t0, max wait time is max_time */
|
||||||
|
#ifndef RTIMER_BUSYWAIT_UNTIL_ABS
|
||||||
#define RTIMER_BUSYWAIT_UNTIL_ABS(cond, t0, max_time) \
|
#define RTIMER_BUSYWAIT_UNTIL_ABS(cond, t0, max_time) \
|
||||||
({ \
|
({ \
|
||||||
bool c; \
|
bool c; \
|
||||||
while(!(c = cond) && RTIMER_CLOCK_LT(RTIMER_NOW(), (t0) + (max_time))) { \
|
while(!(c = cond) && RTIMER_CLOCK_LT(RTIMER_NOW(), (t0) + (max_time))); \
|
||||||
watchdog_periodic(); \
|
|
||||||
} \
|
|
||||||
c; \
|
c; \
|
||||||
})
|
})
|
||||||
|
#endif /* RTIMER_BUSYWAIT_UNTIL_ABS */
|
||||||
|
|
||||||
/** \brief Busy-wait until a condition for at most max_time */
|
/** \brief Busy-wait until a condition for at most max_time */
|
||||||
#define RTIMER_BUSYWAIT_UNTIL(cond, max_time) \
|
#define RTIMER_BUSYWAIT_UNTIL(cond, max_time) \
|
||||||
|
Loading…
Reference in New Issue
Block a user