1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - CARD - include
3   File:     pullOut.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-18#$
14   $Rev: 8573 $
15   $Author: okubata_ryoma $
16 
17  *---------------------------------------------------------------------------*/
18 #ifndef NITRO_CARD_PULLOUT_H_
19 #define NITRO_CARD_PULLOUT_H_
20 
21 
22 #include <nitro/types.h>
23 
24 
25 #ifdef __cplusplus
26 extern  "C"
27 {
28 #endif
29 
30 
31 /*---------------------------------------------------------------------------*/
32 /* Declarations */
33 
34 //---- Callback type for card pulled out
35 typedef BOOL (*CARDPulledOutCallback) (void);
36 
37 
38 /*---------------------------------------------------------------------------*/
39 /* Functions */
40 
41 /*---------------------------------------------------------------------------*
42   Name:         CARD_InitPulledOutCallback
43 
44   Description:  Sets system callback for card being pulled out.
45 
46   Arguments:    None.
47 
48   Returns:      None.
49  *---------------------------------------------------------------------------*/
50 void    CARD_InitPulledOutCallback(void);
51 
52 /*---------------------------------------------------------------------------*
53   Name:         CARD_IsPulledOut
54 
55   Description:  Returns whether card is pulled out.
56 
57   Arguments:    None.
58 
59   Returns:      TRUE if pull out detected
60  *---------------------------------------------------------------------------*/
61 BOOL    CARD_IsPulledOut(void);
62 
63 #ifdef SDK_ARM9
64 
65 /*---------------------------------------------------------------------------*
66   Name:         CARD_SetPulledOutCallback
67 
68   Description:  Sets user callback for card being pulled out.
69 
70   Arguments:    callback: callback
71 
72   Returns:      None.
73  *---------------------------------------------------------------------------*/
74 void    CARD_SetPulledOutCallback(CARDPulledOutCallback callback);
75 
76 /*---------------------------------------------------------------------------*
77   Name:         CARD_TerminateForPulledOut
78 
79   Description:  Terminates for card being pulled out.
80                 Sends message for ARM7 to perform termination.
81 
82   Arguments:    None.
83 
84   Returns:      None.
85  *---------------------------------------------------------------------------*/
86 void    CARD_TerminateForPulledOut(void);
87 
88 /*---------------------------------------------------------------------------*
89   Name:         CARD_PulledOutCallbackProc
90 
91   Description:  Callback for card pulled out.
92 
93   Arguments:    None.
94 
95   Returns:      None.
96  *---------------------------------------------------------------------------*/
97 void    CARD_PulledOutCallbackProc(void);
98 
99 /*---------------------------------------------------------------------------*
100   Name:         CARD_CheckPulledOut
101 
102   Description:  Get whether system has detected pulled-out card
103                 by comparing IPL cardID with current cardID
104                 (notice that once the card has been pulled out, IDs will definitely be different.)
105 
106   Arguments:    None.
107 
108   Returns:      TRUE if current cardID is equal to IPL cardID
109  *---------------------------------------------------------------------------*/
110 void    CARD_CheckPulledOut(void);
111 
112 #endif
113 
114 #ifdef SDK_ARM7
115 
116 /*---------------------------------------------------------------------------*
117   Name:         CARD_CheckPullOut_Polling
118 
119   Description:  Polling to see if card has been pulled out.
120 
121   Arguments:    None.
122 
123   Returns:      None.
124  *---------------------------------------------------------------------------*/
125 void    CARD_CheckPullOut_Polling(void);
126 
127 #endif
128 
129 
130 /*---------------------------------------------------------------------------*
131  * Internal Functions
132  *---------------------------------------------------------------------------*/
133 
134 /*---------------------------------------------------------------------------*
135   Name:         CARDi_ResetSlotStatus
136 
137   Description:  Initializes the card removal state when a card is reinserted into the slot.
138                 This is an internal function used for system development. Note that the slot's hardware state will not be initialized if this function is simply called by a normal application.
139 
140 
141 
142   Arguments:    None.
143 
144   Returns:      None.
145  *---------------------------------------------------------------------------*/
146 void    CARDi_ResetSlotStatus(void);
147 
148 /*---------------------------------------------------------------------------*
149   Name:         CARDi_GetSlotResetCount
150 
151   Description:  Gets the number of times that a card was reinserted into the slot.
152                 This simply returns the number of times that the CARDi_ResetSlotStatus function was called.
153 
154   Arguments:    None.
155 
156   Returns:      The number of times that a card was reinserted into the slot. This is initially 0.
157  *---------------------------------------------------------------------------*/
158 u32     CARDi_GetSlotResetCount(void);
159 
160 /*---------------------------------------------------------------------------*
161   Name:         CARDi_IsPulledOutEx
162 
163   Description:  Determines if a card has been removed from the slot.
164 
165   Arguments:    count: The number of times that a card had been reinserted into the slot when last you checked
166                              This can be obtained with the CARDi_GetSlotResetCount function.
167 
168   Returns:      TRUE if the specified slot reinsertion count has not changed and we are not currently in the slot removal state.
169 
170  *---------------------------------------------------------------------------*/
171 BOOL    CARDi_IsPulledOutEx(u32 count);
172 
173 
174 
175 
176 #ifdef __cplusplus
177 } // extern "C"
178 #endif
179 
180 
181 #endif // NITRO_CARD_PULLOUT_H_
182