1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     fs_API.h
4 
5   Copyright (C)2009 Nintendo Co., Ltd.  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   $Rev: 25831 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NN_FS_FS_API_H_
17 #define NN_FS_FS_API_H_
18 
19 #include <nn/Result.h>
20 #include <nn/fs/fs_IpcFileSystem.h>
21 
22 namespace nn {
23 namespace fs {
24 
25 namespace detail {
26     const char FILE_SERVER_NAME[]   = "fs:USER";
27     ipc::FileSystem GetIpcFileSystem();
28 }
29 
30 /*!
31     @brief fsライブラリを初期化します。
32 
33            fs ライブラリにあるクラスや関数を使うためには、先にこの関数を呼ぶ必要があります。
34 */
35 void  Initialize();
36 void  Finalize();
37 bool  IsInitialized();
38 
39 /*!
40     @brief ゲームカード挿入時にシグナルされる @ref nn::os::LightEvent を登録します。
41 
42     @param[in] p    ゲームカード挿入時にシグナルされる @ref nn::os::LightEvent を指定します。
43     @return         なし。
44 */
45 void RegisterCardInsertedEvent(nn::os::LightEvent* p);
46 
47 /*!
48     @brief @ref nn::fs::RegisterCardInsertedEvent の登録を解除します。
49 
50     @return         なし。
51 */
52 void UnregisterCardInsertedEvent();
53 
54 /*!
55     @brief ゲームカード取り出し時にシグナルされる @ref nn::os::LightEvent を登録します。
56 
57     @param[in] p    ゲームカード取り出し時にシグナルされる @ref nn::os::LightEvent を指定します。
58     @return         なし。
59 */
60 void RegisterCardEjectedEvent(nn::os::LightEvent* p);
61 
62 /*!
63     @brief @ref nn::fs::RegisterCardEjectedEvent の登録を解除します。
64 
65     @return         なし。
66 */
67 void UnregisterCardEjectedEvent();
68 
69 /*!
70     @brief ゲームカードが挿入されているかを返します。
71 
72             本関数は高負荷のため、ゲームカード挿入イベントや取り出しイベントを待つ場合は、
73             @ref nn::fs::RegisterCardInsertedEvent, @ref nn::fs::RegisterCardEjectedEvent 関数で登録した
74             @ref nn::os::LightEvent を使用してください。
75 
76     @return         挿入されていれば true を、挿入されていなければ false を返します。
77 */
78 bool IsCardInserted();
79 
80 /*!
81     @brief SD カード挿入時にシグナルされる @ref nn::os::LightEvent を登録します。
82 
83     @param[in] p    SD カード挿入時にシグナルされる @ref nn::os::LightEvent を指定します。
84     @return         なし。
85 */
86 void RegisterSdmcInsertedEvent(nn::os::LightEvent* p);
87 
88 /*!
89     @brief @ref nn::fs::RegisterSdmcInsertedEvent の登録を解除します。
90 
91     @return         なし。
92 */
93 void UnregisterSdmcInsertedEvent();
94 
95 /*!
96     @brief SD カード取り出し時にシグナルされる @ref nn::os::LightEvent を登録します。
97 
98     @param[in] p    SD カード取り出し時にシグナルされる @ref nn::os::LightEvent を指定します。
99     @return         なし。
100 */
101 void RegisterSdmcEjectedEvent(nn::os::LightEvent* p);
102 
103 /*!
104     @brief @ref nn::fs::RegisterSdmcEjectedEvent の登録を解除します。
105 
106     @return         なし。
107 */
108 void UnregisterSdmcEjectedEvent();
109 
110 /*!
111     @brief SD カードが挿入されているかを返します。
112 
113             本関数は高負荷のため、SD カード挿入イベントや取り出しイベントを待つ場合は、
114             @ref nn::fs::RegisterSdmcInsertedEvent, @ref nn::fs::RegisterSdmcEjectedEvent 関数で登録した
115             @ref nn::os::LightEvent を使用してください。
116 
117     @return         挿入されていれば true を、挿入されていなければ false を返します。
118 */
119 bool IsSdmcInserted();
120 
121 /*!
122     @brief SD カードが書き込み可能かを返します。
123 
124             SD カードが書き込み可能である状態とは、SD カードが挿入されており、
125             かつ、SD カードが LOCK スイッチにより書き込み禁止されていない状態です。
126 
127     @return         書き込み可能であれば true を、書き込み不可能であれば false を返します。
128 */
129 bool IsSdmcWritable();
130 
131 }
132 }
133 
134 #endif /* NN_FS_FS_API_H_ */
135