1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     init_StartUp.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: 27876 $
14  *---------------------------------------------------------------------------*/
15 
16 /*! @file
17   @brief    StartUp に関するAPI の宣言
18 
19 */
20 #ifndef NN_INIT_INIT_STARTUP_H_
21 #define NN_INIT_INIT_STARTUP_H_
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 /*!
27   @addtogroup init    init
28   @{
29 */
30 /*!
31   @defgroup     init_StartUp    StartUp
32   @brief StartUp に関するAPI
33 
34   nn/init/init_StartUp.h
35   @{
36 */
37 
38 /*!
39   @defgroup     about_StartUp   StartUp APIについて
40 
41   @brief        アプリケーションのスタートアップに関するAPI です。
42 
43   アプリケーションの起動は下記の流れで行われます。
44 
45   @li BSS 領域の初期化。<br>
46   @li nninitSystem の呼び出し。<br>
47   @li nninitStartUp の呼び出し。<br>
48   @li スタティックイニシャライザの呼び出し。<br>
49   @li nninitSetup の呼び出し。<br>
50   @li nnMain の実行。<br>
51   <br>
52   nninitStartUp は weak シンボルでコンパイルされているため、
53   ユーザ独自の定義に書き換えが可能です。
54 
55   これらの関数は C++ のスタティックイニシャライザの呼び出しよりも先に呼ばれるため、
56   自明でないコンストラクタを持つクラスの static に置かれたインスタンスを使うことはできません。
57   そのため呼べる関数は大きく制限されています。
58   ライブラリにある関数のうち、スタティックイニシャライザより前に呼ぶことのできる関数は以下のもののみです。
59 
60     @li @ref nn::init::InitializeAllocator<br>
61     @li @ref nn::os::InitializeDeviceMemory<br>
62 
63   これらの関数以外を呼んだ場合の動作は保障されません。
64   独自の処理を書く場合も、十分に注意をする必要があります。
65   @{
66   @}
67 */
68 
69 
70 
71 
72 /*!
73   @brief        アプリケーションのエントリ関数です。
74 
75   @return       なし。
76 */
77 void nnMain(void);
78 
79 /*!
80   @brief        アプリケーションのスタートアップルーチンです。
81 
82                 nnMain が呼ばれる前に実行されます。
83                 デフォルトの実装は weak シンボルでコンパイルされているため、ユーザが上書きをすることができます。
84 
85                 デフォルトの実装では、以下のことをします。
86                     @li @ref nn::init::InitializeAllocator (8MB);
87                     @li @ref nn::os::InitializeDeviceMemory ();
88 
89                 オーバライドする場合は、基本的に os ライブラリの初期化とヒープの初期化以外をしないことを、
90                 強くお勧めします。
91 
92   @return       なし。
93 */
94 void nninitStartUp(void);
95 
96 typedef void (*nninitStaticInitFunc)(void);
97 
98 void nninitCallStaticInitializers(void);
99 void nninitSetup(void);
100 void nninitSetupDaemons(void);
101 void nninitSystem(void);
102 
103 
104 /*!
105   @}
106 */
107 /*!
108   @}
109 */
110 
111 #ifdef __cplusplus
112 }   // extern "C"
113 #endif
114 
115 #endif // NN_INIT_INIT_STARTUP_H_
116