1 /*---------------------------------------------------------------------------* 2 Project: TwlSDK - libraries - rtc 3 File: private.h 4 5 Copyright 2007-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:: 2008-09-17#$ 14 $Rev: 8556 $ 15 $Author: okubata_ryoma $ 16 *---------------------------------------------------------------------------*/ 17 #ifndef TWL_LIBRARIES_RTC_ARM9_PRIVATE_H_ 18 #define TWL_LIBRARIES_RTC_ARM9_PRIVATE_H_ 19 #ifdef __cplusplus 20 extern "C" { 21 #endif 22 23 #include <nitro/rtc/ARM9/api.h> 24 25 /*---------------------------------------------------------------------------*/ 26 27 /*---------------------------------------------------------------------------* 28 Structure Definitions 29 *---------------------------------------------------------------------------*/ 30 /* Lock definition for exclusive processing of asynchronous functions */ 31 typedef enum RTCLock 32 { 33 RTC_LOCK_OFF = 0, /* Unlock status */ 34 RTC_LOCK_ON, /* Lock status */ 35 RTC_LOCK_MAX 36 } 37 RTCLock; 38 39 /* Sequence definitions for processing that includes continuous command transmission */ 40 typedef enum RTCSequence 41 { 42 RTC_SEQ_GET_DATE = 0, /* Sequence for getting dates */ 43 RTC_SEQ_GET_TIME, /* Sequence for getting times */ 44 RTC_SEQ_GET_DATETIME, /* Sequence for getting dates and times */ 45 RTC_SEQ_SET_DATE, /* Sequence for setting dates */ 46 RTC_SEQ_SET_TIME, /* Sequence for setting times */ 47 RTC_SEQ_SET_DATETIME, /* Sequence for setting dates and times */ 48 RTC_SEQ_GET_ALARM1_STATUS, /* Sequence for getting alarm 1's status */ 49 RTC_SEQ_GET_ALARM2_STATUS, /* Sequence for getting alarm 2's status */ 50 RTC_SEQ_GET_ALARM_PARAM, /* Sequence for getting alarm setting values */ 51 RTC_SEQ_SET_ALARM1_STATUS, /* Sequence for changing alarm 1's status */ 52 RTC_SEQ_SET_ALARM2_STATUS, /* Sequence for changing alarm 2's status */ 53 RTC_SEQ_SET_ALARM1_PARAM, /* Sequence for changing alarm 1's setting values */ 54 RTC_SEQ_SET_ALARM2_PARAM, /* Sequence for changing alarm 2's setting values */ 55 RTC_SEQ_SET_HOUR_FORMAT, /* Sequence for changing the format of the time notation */ 56 RTC_SEQ_SET_REG_STATUS2, /* Sequence for status 2 register writes */ 57 RTC_SEQ_SET_REG_ADJUST, /* Sequence for adjust register writes */ 58 RTC_SEQ_GET_COUNTER, /* Sequence to get the up counter value */ 59 RTC_SEQ_GET_FOUT, /* Sequence to get the FOUT value */ 60 RTC_SEQ_SET_FOUT, /* Sequence to change the FOUT value */ 61 RTC_SEQ_MAX 62 } 63 RTCSequence; 64 65 /* Work structure */ 66 typedef struct RTCWork 67 { 68 u32 lock; /* Exclusive lock */ 69 RTCCallback callback; /* For saving an asynchronous callback function */ 70 void *buffer[2]; /* For storing asynchronous function parameters */ 71 void *callbackArg; /* For saving arguments to the callback function */ 72 u32 sequence; /* For controlling continuous processing mode */ 73 u32 index; /* For controlling continuous processing status */ 74 RTCInterrupt interrupt; /* For saving the function called when an alarm notification is sent */ 75 RTCResult commonResult; /* For saving asynchronous function processing results */ 76 77 } 78 RTCWork; 79 80 81 /*---------------------------------------------------------------------------* 82 Function definitions 83 *---------------------------------------------------------------------------*/ 84 RTCWork* RTCi_GetSysWork(void); 85 RTCResult RTCEXi_CommonCallback(void); 86 87 RTCResult RTCEXi_GetCounterAsync(u32* count, RTCCallback callback, void* arg); 88 RTCResult RTCEXi_GetCounter(u32* count); 89 RTCResult RTCEXi_GetFoutAsync(u16* fout, RTCCallback callback, void* arg); 90 RTCResult RTCEXi_GetFout(u16* fout); 91 RTCResult RTCEXi_SetFoutAsync(const u16* fout, RTCCallback callback, void* arg); 92 RTCResult RTCEXi_SetFout(const u16* fout); 93 94 BOOL RTCEXi_ReadRawCounterAsync(void); 95 BOOL RTCEXi_ReadRawFoutAsync(void); 96 BOOL RTCEXi_WriteRawFoutAsync(void); 97 BOOL RTCEXi_ReadRawAlarmEx1Async(void); 98 BOOL RTCEXi_WriteRawAlarmEx1Async(void); 99 BOOL RTCEXi_ReadRawAlarmEx2Async(void); 100 BOOL RTCEXi_WriteRawAlarmEx2Async(void); 101 102 103 /*---------------------------------------------------------------------------*/ 104 #ifdef __cplusplus 105 } /* extern "C" */ 106 #endif 107 #endif /* TWL_LIBRARIES_RTC_ARM9_PRIVATE_H_ */ 108