1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - WXC - include -
3   File:     scheduler.h
4 
5   Copyright 2005-2009 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-18#$
14   $Rev: 8573 $
15   $Author: okubata_ryoma $
16  *---------------------------------------------------------------------------*/
17 
18 #ifndef	NITRO_WXC_SCHEDULER_H_
19 #define	NITRO_WXC_SCHEDULER_H_
20 
21 
22 #include <nitro.h>
23 
24 
25 /*****************************************************************************/
26 /* Constants */
27 
28 /* Parent/child switch pattern */
29 #define WXC_SCHEDULER_PATTERN_MAX   4
30 #define WXC_SCHEDULER_SEQ_MAX       4
31 
32 
33 /*****************************************************************************/
34 /* Declaration */
35 
36 /* Structure managing switching between parent and child mode */
37 typedef struct WXCScheduler
38 {
39     /* Current switch sequence */
40     int     seq;
41     int     pattern;
42     int     start;
43     BOOL    child_mode;
44     /* Switch table (TRUE is parent, FALSE is child) */
45     BOOL    table[WXC_SCHEDULER_PATTERN_MAX][WXC_SCHEDULER_SEQ_MAX];
46 }
47 WXCScheduler;
48 
49 
50 /*****************************************************************************/
51 /* Functions */
52 
53 #ifdef __cplusplus
54 extern "C"
55 {
56 #endif
57 
58 
59 /*---------------------------------------------------------------------------*
60   Name:         WXCi_InitScheduler
61 
62   Description:  Initializes the mode-switch scheduler.
63 
64   Arguments:    p: WXCScheduler structure
65 
66   Returns:      None.
67  *---------------------------------------------------------------------------*/
68 void    WXCi_InitScheduler(WXCScheduler * p);
69 
70 /*---------------------------------------------------------------------------*
71   Name:         WXCi_SetChildMode
72 
73   Description:  Sets scheduler to operate with child device fixed.
74 
75   Arguments:    p: WXCScheduler structure
76                 enable: If it can only be run on the child side, TRUE
77 
78   Returns:      None.
79  *---------------------------------------------------------------------------*/
80 void    WXCi_SetChildMode(WXCScheduler * p, BOOL enable);
81 
82 /*---------------------------------------------------------------------------*
83   Name:         WXCi_UpdateScheduler
84 
85   Description:  Updates mode switch scheduler.
86 
87   Arguments:    p: WXCScheduler structure
88 
89   Returns:      Return TRUE if currently in parent mode. Return FALSE if currently in child mode.
90  *---------------------------------------------------------------------------*/
91 BOOL    WXCi_UpdateScheduler(WXCScheduler * p);
92 
93 
94 #ifdef __cplusplus
95 }
96 #endif
97 
98 
99 #endif /* NITRO_WXC_SCHEDULER_H_ */
100 
101 /*---------------------------------------------------------------------------*
102   End of file
103  *---------------------------------------------------------------------------*/
104