1 /*---------------------------------------------------------------------------*
2   Project:  Wii Connect 24
3   File:     NWC24Schedule.h
4 
5   Copyright (C) 2006 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   $Log: NWC24Schedule.h,v $
14   Revision 1.7  2007/05/23 09:31:41  adachi_hiroaki
15   Added NWC24_SCD_DL_FLAG_NONE definition
16 
17   Revision 1.6  2006/10/19 06:27:32  adachi_hiroaki
18   Eliminated NWC24DownloadPages() and added NWC24ExecDownloadTask().
19 
20   Revision 1.5  2006/10/18 13:31:44  hirose_kazuki
21   Comments added
22 
23   Revision 1.4  2006/09/22 10:44:21  hirose_kazuki
24   Added NWC24GetSchedulerError()
25 
26   Revision 1.3  2006/07/22 12:06:13  terui
27   Fixed comments.
28 
29   Revision 1.2  2006/07/18 08:21:28  terui
30   Added public API definitions
31   Moved private API definitions into the directory private/.
32 
33   Revision 1.1  2006/07/15 12:43:13  terui
34   Initial upload
35 
36   $NoKeywords: $
37  *---------------------------------------------------------------------------*/
38 
39 #ifndef __NWC24SCHEDULE_H__
40 #define __NWC24SCHEDULE_H__
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 /*===========================================================================*/
45 
46 #include <revolution/nwc24/NWC24Err.h>
47 
48 #define NWC24_SCD_DL_FLAG_NONE              (0)
49 #define NWC24_SCD_DL_FLAG_SPECIFY_ID        (1<<01)
50 #define NWC24_SCD_DL_FLAG_SPECIFY_SUBID     (1<<02)
51 #define NWC24_SCD_DL_FLAG_REFRESH           (1<<03)
52 
53 
54 /* subroutine prototype */
55 /*---------------------------------------------------------------------------*
56   Name: NWC24SuspendScheduler
57   Description: Temporarily stops the automatic scheduler. Block and wait until stopped.
58   Arguments: None
59   Returns     : s32 -   Returns the the pre-processing suspend counter.
60                         Returns 0 if the automatic scheduler was in an executable state before suspension started.
61                         Shows that it was in an executable state before suspension started. If a positive value is returned, it indicates that it was in a pause state was since before the start of processing.
62 
63                         Returns a negative NWC24Err enum type if the process fails.
64  *---------------------------------------------------------------------------*/
65 s32         NWC24SuspendScheduler( void );
66 
67 /*---------------------------------------------------------------------------*
68   Name: NWC24TrySuspendScheduler
69   Description: Attempts to suspend the automatic scheduler. Unless blocking is performed until suspension, execution will fail because scheduler-based processes are running.
70 
71   Arguments: None
72   Returns: s32 -   Returns the suspend counter if suspension is successful.
73                         Returns 0 if the automatic scheduler was in an executable state before suspension started.
74                         If a positive value is returned, it indicates that it was in a pause state since before the start of processing.
75 
76                         Returns a negative NWC24Err enum type if the process fails.
77  *---------------------------------------------------------------------------*/
78 s32         NWC24TrySuspendScheduler( void );
79 
80 /*---------------------------------------------------------------------------*
81   Name: NWC24ResumeScheduler
82   Description: Resumes automatic scheduler operations.
83   Arguments: None
84   Returns: s32 -   Returns the counter from the pre-process start suspend.
85                         Returns 0 if the automatic scheduler was in an executable state before suspension started.
86 
87                         it indicates that the pause state was entered before beginning processing.
88                         Returns a negative NWC24Err enum type if the process fails.
89  *---------------------------------------------------------------------------*/
90 s32         NWC24ResumeScheduler( void );
91 
92 /*---------------------------------------------------------------------------*
93   Name: NWC24GetScheduleSpan
94   Description: Gets the schedule span (in minutes) for the automatic scheduler.
95   Arguments: pMailSpan       -   Buffer for getting the mail send/receive span.
96                 pDwonloadSpan   -   Buffer for getting the download span.
97   Returns: NWC24Err        -   Returns the result of processing.
98  *---------------------------------------------------------------------------*/
99 NWC24Err    NWC24GetScheduleSpan( u32* pMailSpan, u32* pDownloadSpan );
100 
101 /*---------------------------------------------------------------------------*
102   Name: NWC24SetScheduleSpan
103   Description: Sets the schedule span (in minutes) for the automatic scheduler.
104                 (For testing and debugging)
105   Arguments: mailSpan        -   Specifies the mail send/receive span.
106                 downloadSpan    -   Specifies the download span.
107   Returns: NWC24Err        -   Returns the result of processing.
108  *---------------------------------------------------------------------------*/
109 NWC24Err    NWC24SetScheduleSpan( u32 mailSpan, u32 downloadSpan );
110 
111 /*---------------------------------------------------------------------------*
112   Name: NWC24SendMails
113   Description: Immediately sends send-reserved mail to the NAND flash.
114                 (For testing and debugging)
115   Arguments: None
116   Returns: NWC24Err        -   Returns the result of processing.
117  *---------------------------------------------------------------------------*/
118 NWC24Err    NWC24SendMails( void );
119 
120 /*---------------------------------------------------------------------------*
121   Name: NWC24ReceiveMails
122   Description: Immediately receives mail and stores it in the NAND flash.
123                 (For testing and debugging)
124   Arguments: None
125   Returns: NWC24Err        -   Returns the result of processing.
126  *---------------------------------------------------------------------------*/
127 NWC24Err    NWC24ReceiveMails( void );
128 
129 /*---------------------------------------------------------------------------*
130   Name: NWC24ExecDownloadTask
131   Description: Starts download process immediately.
132   Arguments: operationFlags - Specify the task to perform with a flag.
133                 taskId - Specify the ID of the task to start.
134                                     (Valid only when NWC24_SCD_DL_FLAG_SPECIFY_ID is specified as a flag)
135 
136                 subTaskMask - Specify the subtask ID to start using the mask value.
137                                     (Valid only when NWC24_SCD_DL_FLAG_SPECIFY_SUBID is specified as a flag)
138 
139   Returns: NWC24Err        -   Returns the result of processing.
140  *---------------------------------------------------------------------------*/
141 NWC24Err    NWC24ExecDownloadTask( u32 operationFlags, u16 taskId, u32 subTaskMask );
142 
143 /*---------------------------------------------------------------------------*
144   Name: NWC24GetSchedulerError
145   Description: Gets the error code generated by the automatic scheduler process
146   Arguments: pNumErrors   -   Pointer to the variable that obtains the number of errors generated
147                 pErrorCode  -   Error code for the error generated most recently
148   Returns: NWC24Err        -   Returns the result of processing.
149 
150  *---------------------------------------------------------------------------*/
151 NWC24Err    NWC24GetSchedulerError( s32* pNumErrors, s32* pErrorCode );
152 
153 /*===========================================================================*/
154 #ifdef __cplusplus
155 }
156 #endif
157 #endif  /* __NWC24SCHEDULE_H__ */
158