1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - RTC - include
3   File:     swclock.h
4 
5   Copyright 2003-2008 Nintendo. All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law. They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Date$
14   $Rev$
15   $Author: tokunaga_eiji $
16  *---------------------------------------------------------------------------*/
17 
18 #ifndef NITRO_RTC_ARM9_SWCLOCK_H_
19 #define NITRO_RTC_ARM9_SWCLOCK_H_
20 
21 #ifdef  __cplusplus
22 extern "C" {
23 #endif
24 
25 #include    <nitro/types.h>
26 
27 /*---------------------------------------------------------------------------*
28   Name:         RTC_InitSWClock
29 
30   Description:  Initializes the software clock.
31                 Synchronizes the value of the software clock with the current value of the RTC, and adds a sleep recovery callback function to re-synchronize the software clock with the RTC.
32                 This must be called before the RTC_GetDateTimeExFromSWClock and RTC_SyncSWClock functions.
33 
34 
35 
36   Arguments:    None.
37 
38   Returns:      RTCResult - Returns the device operation processing result.
39  *---------------------------------------------------------------------------*/
40 RTCResult RTC_InitSWClock(void);
41 
42 /*---------------------------------------------------------------------------*
43   Name:         RTC_GetSWClockTick
44 
45   Description:  Returns the time duration from 2000/01/01 00:00 until now as a converted tick value that is the sum of the current tick value and the RTC check converted tick value at boot time.
46 
47 
48   Arguments:    None.
49 
50   Returns:      OSTick - The converted tick value for the time duration from 2000/01/01 00:00 until now.
51  *---------------------------------------------------------------------------*/
52 OSTick RTC_GetSWClockTick(void);
53 
54 /*---------------------------------------------------------------------------*
55   Name:         RTC_GetSyncSWClockResult
56 
57   Description:  Returns the result of calling RTC_GetDateTime the last time the software clock was synchronized.
58 
59 
60   Arguments:    None.
61 
62   Returns:      RTCResult - The result of calling RTC_GetDateTime when synchronization was performed.
63  *---------------------------------------------------------------------------*/
64 RTCResult RTC_GetLastSyncSWClockResult(void);
65 
66 /*---------------------------------------------------------------------------*
67   Name:         RTC_GetDateTimeExFromSWClock
68 
69   Description:  Loads date and time data (in milliseconds) from the software clock that uses CPU ticks.
70 
71 
72   Arguments:    date      - Specifies the buffer for storing date data.
73                 time      - Specifies the buffer for storing time data.
74 
75   Returns:      RTCResult - Returns the RTCResult that was saved during the last synchronization.
76  *---------------------------------------------------------------------------*/
77 RTCResult RTC_GetDateTimeExFromSWClock(RTCDate *date, RTCTimeEx *time);
78 
79 /*---------------------------------------------------------------------------*
80   Name:         RTC_SyncSWClock
81 
82   Description:  Synchronizes the software clock that uses CPU ticks with the RTC.
83 
84   Arguments:    None.
85 
86   Returns:      RTCResult - Returns the device operation processing result.
87  *---------------------------------------------------------------------------*/
88 RTCResult RTC_SyncSWClock(void);
89 
90 /*===========================================================================*/
91 
92 #ifdef  __cplusplus
93 }       /* extern "C" */
94 #endif
95 
96 #endif /* NITRO_RTC_ARM9_SWCLOCK_H_ */
97 
98 
99 /*---------------------------------------------------------------------------*
100   End of file
101  *---------------------------------------------------------------------------*/
102