From b7cd4c9e90be42476a2e242571d36cbbca2fbd4c Mon Sep 17 00:00:00 2001 From: bunnei Date: Thu, 24 Apr 2014 22:32:26 -0400 Subject: added functions to map Heap and Shared memory space --- src/core/mem_map.h | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'src/core/mem_map.h') diff --git a/src/core/mem_map.h b/src/core/mem_map.h index ab1eb260..5346d04e 100644 --- a/src/core/mem_map.h +++ b/src/core/mem_map.h @@ -22,6 +22,8 @@ enum { HEAP_GSP_SIZE = 0x02000000, ///< GSP heap size... TODO: Define correctly? HEAP_SIZE = FCRAM_SIZE, ///< Application heap size + SHARED_MEMORY_VADDR = 0x10000000, ///< Shared memory + HEAP_PADDR = HEAP_GSP_SIZE, HEAP_PADDR_END = (HEAP_PADDR + HEAP_SIZE), HEAP_VADDR = 0x08000000, @@ -49,10 +51,11 @@ enum { //////////////////////////////////////////////////////////////////////////////////////////////////// -/// Represents a block of heap memory mapped by ControlMemory -struct HeapBlock { - HeapBlock() : base_address(0), address(0), size(0), operation(0), permissions(0) { +/// Represents a block of memory mapped by ControlMemory/MapMemoryBlock +struct MemoryBlock { + MemoryBlock() : handle(0), base_address(0), address(0), size(0), operation(0), permissions(0) { } + u32 handle; u32 base_address; u32 address; u32 size; @@ -98,10 +101,26 @@ void Write32(const u32 addr, const u32 data); u8* GetPointer(const u32 Address); +/** + * Maps a block of memory in shared memory + * @param handle Handle to map memory block for + * @param addr Address to map memory block to + * @param permissions Memory map permissions + */ +u32 MapBlock_Shared(u32 handle, u32 addr,u32 permissions) ; + +/** + * Maps a block of memory on the heap + * @param size Size of block in bytes + * @param operation Memory map operation type + * @param flags Memory allocation flags + */ +u32 MapBlock_Heap(u32 size, u32 operation, u32 permissions); + /** * Maps a block of memory on the GSP heap * @param size Size of block in bytes - * @param operation Control memory operation + * @param operation Memory map operation type * @param permissions Control memory permissions */ u32 MapBlock_HeapGSP(u32 size, u32 operation, u32 permissions); -- cgit v1.2.3