• R/O
  • SSH
  • HTTPS

chibios: Commit


Commit MetaInfo

Revisão14751 (tree)
Hora2021-09-13 16:22:58
Autorgdisirio

Mensagem de Log

Bob's optimizations.

Mudança Sumário

Diff

--- trunk/os/rt/src/chvt.c (revision 14750)
+++ trunk/os/rt/src/chvt.c (revision 14751)
@@ -60,7 +60,6 @@
6060 */
6161 static void vt_set_alarm(systime_t basetime, sysinterval_t delta) {
6262 sysinterval_t mindelta;
63- systime_t next_alarm;
6463
6564 /* Initial delta is what is configured statically.*/
6665 mindelta = (sysinterval_t)CH_CFG_ST_TIMEDELTA;
@@ -82,11 +81,8 @@
8281 sysinterval_t nowdelta;
8382 systime_t now;
8483
85- /* Absolute time for next alarm.*/
86- next_alarm = chTimeAddX(basetime, delta);
87-
8884 /* Setting up the alarm on the next deadline.*/
89- port_timer_set_alarm(next_alarm);
85+ port_timer_set_alarm(chTimeAddX(basetime, delta));
9086
9187 /* Check on current time, we need to detect the error condition where
9288 current time skipped past the calculated deadline.*/
@@ -149,7 +145,6 @@
149145 */
150146 static void vt_enqueue(virtual_timers_list_t *vtlp,
151147 virtual_timer_t *vtp,
152- systime_t now,
153148 sysinterval_t delay) {
154149 sysinterval_t delta;
155150
@@ -156,6 +151,7 @@
156151 #if CH_CFG_ST_TIMEDELTA > 0
157152 {
158153 sysinterval_t nowdelta;
154+ systime_t now = chVTGetSystemTimeX();
159155
160156 /* Special case where the timers list is empty.*/
161157 if (ch_dlist_isempty(&vtlp->dlist)) {
@@ -185,7 +181,6 @@
185181 }
186182 }
187183 #else /* CH_CFG_ST_TIMEDELTA == 0 */
188- (void)now;
189184
190185 /* Delta is initially equal to the specified delay.*/
191186 delta = delay;
@@ -233,7 +228,7 @@
233228 vtp->reload = (sysinterval_t)0;
234229
235230 /* Inserting the timer in the delta list.*/
236- vt_enqueue(vtlp, vtp, chVTGetSystemTimeX(), delay);
231+ vt_enqueue(vtlp, vtp, delay);
237232 }
238233
239234 /**
@@ -271,7 +266,7 @@
271266 vtp->reload = delay;
272267
273268 /* Inserting the timer in the delta list.*/
274- vt_enqueue(vtlp, vtp, chVTGetSystemTimeX(), delay);
269+ vt_enqueue(vtlp, vtp, delay);
275270 }
276271
277272 /**
@@ -481,14 +476,13 @@
481476 chSysUnlockFromISR();
482477 vtp->func(vtp, vtp->par);
483478 chSysLockFromISR();
484-
479+ now = chVTGetSystemTimeX();
485480 /* If a reload is defined the timer needs to be restarted.*/
486481 if (unlikely(vtp->reload > (sysinterval_t)0)) {
487482 sysinterval_t delay;
488483
489- /* Refreshing the current time after spending time in the callback for
484+ /* Refreshing the now delta after spending time in the callback for
490485 a more accurate detection of too fast reloads.*/
491- now = chVTGetSystemTimeX();
492486 nowdelta = chTimeDiffX(lasttime, now);
493487
494488 #if !defined(CH_VT_RFCU_DISABLED)
Show on old repository browser