From: Michel Pollet Date: Thu, 9 Jan 2014 08:54:49 +0000 (+0000) Subject: core: Declare avr_pending_sleep_usec X-Git-Tag: v1.2~48 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=c39ae55bae12aab4c2d6b9f973beb714c921a43b;p=sx%2Fsimavr.git core: Declare avr_pending_sleep_usec This was meant to be declared for 'boards' to use Signed-off-by: Michel Pollet --- diff --git a/simavr/sim/sim_avr.c b/simavr/sim/sim_avr.c index d020a72..5dcdb09 100644 --- a/simavr/sim/sim_avr.c +++ b/simavr/sim/sim_avr.c @@ -219,7 +219,10 @@ void avr_loadcode(avr_t * avr, uint8_t * code, uint32_t size, avr_flashaddr_t ad * a minimum count of requested sleep microseconds are reached * (low amounts cannot be handled accurately). */ -static inline uint32_t avr_pending_sleep_usec(avr_t * avr, avr_cycle_count_t howLong) +uint32_t +avr_pending_sleep_usec( + avr_t * avr, + avr_cycle_count_t howLong) { avr->sleep_usec += avr_cycles_to_usec(avr, howLong); uint32_t usec = avr->sleep_usec; diff --git a/simavr/sim/sim_avr.h b/simavr/sim/sim_avr.h index 00bfb3a..2eef7eb 100644 --- a/simavr/sim/sim_avr.h +++ b/simavr/sim/sim_avr.h @@ -406,6 +406,17 @@ void avr_callback_run_gdb(avr_t * avr); void avr_callback_sleep_raw(avr_t * avr, avr_cycle_count_t howLong); void avr_callback_run_raw(avr_t * avr); +/** + * Accumulates sleep requests (and returns a sleep time of 0) until + * a minimum count of requested sleep microseconds are reached + * (low amounts cannot be handled accurately). + * This function is an utility function for the sleep callbacks + */ +uint32_t +avr_pending_sleep_usec( + avr_t * avr, + avr_cycle_count_t howLong); + #ifdef __cplusplus }; #endif