Author: wmb Date: Tue Jul 12 11:26:19 2011 New Revision: 2347 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2347
Log: Checked in some demonstration/test code for the Marvel MMP2 internal RTC.
Added: cpu/arm/mmp2/rtc.fth
Added: cpu/arm/mmp2/rtc.fth ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ cpu/arm/mmp2/rtc.fth Tue Jul 12 11:26:19 2011 (r2347) @@ -0,0 +1,26 @@ +purpose: Driver for MMP2 internal RTC + +\ This code was written as a test/demonstration of using +\ the MMP2 internal RTC to generate alarm interrupts. +\ It is not currently used by anything, and should it +\ ever be needed, it should be put in a device node. + +: int5-mask! ( value -- ) h# d428.216c l! ; +: int5-mask@ ( -- value ) h# d428.216c l@ ; +: int5-status@ ( -- value ) h# d428.2154 l@ ; +: enable-rtc ( -- ) h# 81 h# d401.5000 l! ; +: soc-rtc@ ( offset -- value ) h# d401.0000 + l@ ; +: soc-rtc! ( value offset -- value ) h# d401.0000 + l! ; +: take-alarm ( -- ) + ." Alarm fired" cr + 0 8 soc-rtc! + int5-mask@ 1 or int5-mask! \ Mask alarm +; +: alarm-in-5 ( -- ) + enable-rtc \ Turn on clocks + int5-mask@ 1 invert and int5-mask! \ Unmask alarm + 0 soc-rtc@ d# 5 + 4 soc-rtc! \ Set alarm for 5 seconds from now + 7 8 soc-rtc! \ Ack old interrupts and enable new ones + ['] take-alarm 5 interrupt-handler! + 5 enable-interrupt +;
openfirmware@openfirmware.info