/*---------------------------------------------------------------------------* Project: Horizon File: os_Memory.h Copyright (C)2009 Nintendo Co., Ltd. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. $Rev: 24156 $ *---------------------------------------------------------------------------*/ /*! @file @brief OS からメモリを確保するための API の宣言 :include nn/os.h */ #ifndef NN_OS_OS_MEMORY_H_ #define NN_OS_OS_MEMORY_H_ #include #include #include #include #ifdef __cplusplus #include #include #include #define NN_OS_DEVICE_MEMORY_SIZE (32 * 1024 * 1024) // 32MB namespace nn{ namespace os{ /*! @brief この定数は廃止されます。 デバイスメモリサイズはプログラムで設定できるようになりました。 @ref SetDeviceMemorySize を参照してください この定数は将来のリリースで削除される予定です。 */ const size_t DEVICE_MEMORY_SIZE NN_ATTRIBUTE_DEPRECATED = NN_OS_DEVICE_MEMORY_SIZE; /*! @brief この関数は廃止されます。 この関数は @ref SetDeviceMemorySize で置き換えられました。 この関数は将来のリリースで削除される予定です。 */ void InitializeDeviceMemory() NN_ATTRIBUTE_DEPRECATED; /*!--------------------------------------------------------------------------* @brief この関数は SDK 0.9 以前と同様のメモリ環境を エミュレーションするように OS を設定します。 この関数を呼び出すと以下のようにメモリ環境がセットアップされます。 @li MemoryBlock クラスを使用できるようになります。 @li プログラムで使用できる残りのメモリ全領域が ヒープに設定されます。 @li ヒープから 8 MB の MemoryBlock が作成され C の malloc、 C++ の new が、その MemoryBlock からメモリを 確保するように初期化されます。 @return なし *---------------------------------------------------------------------------*/ void SetupHeapForMemoryBlock(size_t heapSize); /*!--------------------------------------------------------------------------* @brief デバイスメモリの開始アドレスを取得します。 あらかじめ @ref SetDeviceMemorySize で 0 より大きい値を指定しておく必要があります。 @return デバイスメモリの開始アドレスを返します。 *---------------------------------------------------------------------------*/ uptr GetDeviceMemoryAddress(); /*!--------------------------------------------------------------------------* @brief デバイスメモリのサイズを変更します。 @param[in] size 新しいデバイスメモリのサイズを指定します。 size は 4096 の倍数でなければなりません。 @return *---------------------------------------------------------------------------*/ Result SetDeviceMemorySize(size_t size); /*!--------------------------------------------------------------------------* @brief デバイスメモリのサイズを取得します。 @return 現在のデバイスメモリのサイズを返します。 *---------------------------------------------------------------------------*/ size_t GetDeviceMemorySize(); /*!--------------------------------------------------------------------------* @brief ヒープの開始アドレスを取得します。 あらかじめ @ref SetHeapSize で 0 より大きい値を指定しておく必要があります。 @return ヒープの開始アドレスを返します。 *---------------------------------------------------------------------------*/ inline uptr GetHeapAddress() { return NN_OS_ADDR_HEAP_BEGIN; } /*!--------------------------------------------------------------------------* @brief ヒープのサイズを変更します。 @param[in] size 新しいヒープのサイズを指定します。 size は 4096 の倍数でなければなりません。 @return *---------------------------------------------------------------------------*/ Result SetHeapSize(size_t size); /*!--------------------------------------------------------------------------* @brief ヒープのサイズを取得します。 @return 現在のヒープのサイズを返します。 *---------------------------------------------------------------------------*/ size_t GetHeapSize(); }} // namespace nn::os #endif // __cplusplus // 以下、C 用宣言 #include /*! @addtogroup nn_os os @{ */ /*! @brief 対応する C++ 関数 @ref nn::os::InitializeDeviceMemory を参照してください。 */ NN_EXTERN_C void nnosInitializeDeviceMemory(void); /*! @brief 対応する C++ 関数 @ref nn::os::GetDeviceMemoryAddress を参照してください。 */ NN_EXTERN_C uptr nnosGetDeviceMemoryAddress(void); /*! @} */ /* NN_OS_MEMORY_H_ */ #endif /* NN_OS_OS_MEMORY_H_ */