1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     FsSample.cpp
4 
5   Copyright (C)2009-2012 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: 47228 $
14  *---------------------------------------------------------------------------*/
15 
16 #include "FsSample.h"
17 #include <nn/os.h>
18 #include <nn/fnd.h>
19 
20 
21 namespace
22 {
23     // This sample allocates memory from the expanded heap
24     nn::fnd::ExpHeap s_ExtHeap;
25 }
26 
27 
FsSampleInitialize()28 void FsSampleInitialize()
29 {
30     // fs initialization
31     nn::fs::Initialize();
32 
33     // Initialize the heap
34     s_ExtHeap.Initialize(nn::os::GetDeviceMemoryAddress(), nn::os::GetDeviceMemorySize() );
35 }
36 
FsSampleFinalize()37 void FsSampleFinalize()
38 {
39     // Heap cleanup
40     s_ExtHeap.Finalize();
41 }
42 
FsSampleAllocateMemory(size_t size)43 void* FsSampleAllocateMemory(size_t size)
44 {
45     return s_ExtHeap.Allocate(size);
46 }
47 
FsSampleFreeMemory(void * p)48 void FsSampleFreeMemory(void* p)
49 {
50     s_ExtHeap.Free(p);
51 }
52 
53