mirror of
git://projects.qi-hardware.com/iris.git
synced 2024-11-16 21:36:14 +02:00
59 lines
1.5 KiB
Plaintext
59 lines
1.5 KiB
Plaintext
|
#pypp 0
|
||
|
// Iris: micro-kernel for a capability-based operating system.
|
||
|
// source/rtc.ccp: real-time clock driver.
|
||
|
// Copyright 2010 Bas Wijnen <wijnen@debian.org>
|
||
|
//
|
||
|
// This program is free software: you can redistribute it and/or modify
|
||
|
// it under the terms of the GNU General Public License as published by
|
||
|
// the Free Software Foundation, either version 3 of the License, or
|
||
|
// (at your option) any later version.
|
||
|
//
|
||
|
// This program is distributed in the hope that it will be useful,
|
||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
// GNU General Public License for more details.
|
||
|
//
|
||
|
// You should have received a copy of the GNU General Public License
|
||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
|
||
|
#include "devices.hh"
|
||
|
#define ARCH
|
||
|
#include "arch.hh"
|
||
|
|
||
|
static void ready ():
|
||
|
while !rtc_write_ready ():
|
||
|
Iris::schedule ()
|
||
|
|
||
|
static unsigned get_second ():
|
||
|
ready ()
|
||
|
unsigned ret = rtc_get_second ()
|
||
|
unsigned r2
|
||
|
while true:
|
||
|
ready ()
|
||
|
r2 = rtc_get_second ()
|
||
|
if ret == r2:
|
||
|
return ret
|
||
|
kdebug ("ret != r2\n")
|
||
|
ret = r2
|
||
|
|
||
|
Iris::Num start ():
|
||
|
map_cpm ()
|
||
|
map_rtc ()
|
||
|
cpm_start_rtc ()
|
||
|
ready ()
|
||
|
rtc_enabled ()
|
||
|
ready ()
|
||
|
rtc_set_nc1Hz_val (RTC_CLOCK)
|
||
|
ready ()
|
||
|
rtc_enable_1Hz_irq ()
|
||
|
rtc_clear_alarm_flag ()
|
||
|
rtc_set_hwfcr_val (0)
|
||
|
while true:
|
||
|
ready ()
|
||
|
rtc_clear_1Hz_flag ()
|
||
|
ready ()
|
||
|
Iris::register_interrupt (IRQ_RTC)
|
||
|
Iris::wait ()
|
||
|
kdebug ("tick\n")
|
||
|
return 0
|