[riot-notifications] [RIOT-OS/RIOT] cpu/atmega_common: RTT and RTC support (#8842)

ZetaR60 notifications at github.com
Thu Apr 18 19:51:41 CEST 2019


ZetaR60 commented on this pull request.



> +        /* Clear interrupt flag */
+        TIFR2 = (1 << OCF2A);
+
+        /* Enable interrupt */
+        TIMSK2 |= (1 << OCIE2A);
+
+        DEBUG("RTT alarm interrupt active\n");
+    }
+    else {
+        DEBUG("RTT alarm interrupt not active\n");
+    }
+}
+
+uint32_t rtt_get_alarm(void)
+{
+    return (((uint32_t)rtt_state.ext_comp << 8) | (uint32_t)OCR2A);

Out of scope for the reason why volatile is employed here. Consistency is only guaranteed for multiple threads if they are only reading. Multi-thread read/write consistency is not guaranteed unless global interrupts are disabled before making the API calls. However, multi-thread writes are in general undesirable for this API as you cannot e.g. set an alarm for each thread anyway.

Your critique applies to e.g. `rtt_get_counter` with respect to timer events, so I will work on fixing that.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/8842#discussion_r276768606
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190418/7ae396b9/attachment.html>


More information about the notifications mailing list