Marcoen Hirschberg | a45e632 | 2006-11-27 09:44:56 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
| 8 | * $Id$ |
| 9 | * |
| 10 | * Copyright (C) 2002 by Linus Nielsen Feltzing, Uwe Freese, Laurent Baum |
| 11 | * |
Daniel Stenberg | 2acc0ac | 2008-06-28 18:10:04 +0000 | [diff] [blame^] | 12 | * This program is free software; you can redistribute it and/or |
| 13 | * modify it under the terms of the GNU General Public License |
| 14 | * as published by the Free Software Foundation; either version 2 |
| 15 | * of the License, or (at your option) any later version. |
Marcoen Hirschberg | a45e632 | 2006-11-27 09:44:56 +0000 | [diff] [blame] | 16 | * |
| 17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 18 | * KIND, either express or implied. |
| 19 | * |
| 20 | ****************************************************************************/ |
| 21 | #include "config.h" |
| 22 | #include "i2c.h" |
| 23 | #include "rtc.h" |
| 24 | #include "kernel.h" |
| 25 | #include "system.h" |
| 26 | #include "pcf50606.h" |
| 27 | #include <stdbool.h> |
| 28 | |
| 29 | void rtc_init(void) |
| 30 | { |
| 31 | } |
| 32 | |
| 33 | int rtc_read_datetime(unsigned char* buf) { |
| 34 | int rc; |
Michael Sevakis | af395f4 | 2008-03-26 01:50:41 +0000 | [diff] [blame] | 35 | int oldlevel = disable_irq_save(); |
Marcoen Hirschberg | a45e632 | 2006-11-27 09:44:56 +0000 | [diff] [blame] | 36 | |
| 37 | rc = pcf50606_read_multiple(0x0a, buf, 7); |
| 38 | |
Michael Sevakis | af395f4 | 2008-03-26 01:50:41 +0000 | [diff] [blame] | 39 | restore_irq(oldlevel); |
Marcoen Hirschberg | a45e632 | 2006-11-27 09:44:56 +0000 | [diff] [blame] | 40 | return rc; |
| 41 | } |
| 42 | |
| 43 | int rtc_write_datetime(unsigned char* buf) { |
| 44 | int rc; |
Michael Sevakis | af395f4 | 2008-03-26 01:50:41 +0000 | [diff] [blame] | 45 | int oldlevel = disable_irq_save(); |
Marcoen Hirschberg | a45e632 | 2006-11-27 09:44:56 +0000 | [diff] [blame] | 46 | |
| 47 | rc = pcf50606_write_multiple(0x0a, buf, 7); |
| 48 | |
Michael Sevakis | af395f4 | 2008-03-26 01:50:41 +0000 | [diff] [blame] | 49 | restore_irq(oldlevel); |
Marcoen Hirschberg | a45e632 | 2006-11-27 09:44:56 +0000 | [diff] [blame] | 50 | |
| 51 | return rc; |
| 52 | } |
| 53 | |