1 /*---------------------------------------------------------------------------* 2 Project: RevolutionDWC public include file 3 File: ./common/dwc_memfunc.h 4 5 Copyright 2005-2008 Nintendo. 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 *---------------------------------------------------------------------------*/ 14 15 #ifndef DWC_MEMFUNC_H_ 16 #define DWC_MEMFUNC_H_ 17 18 19 20 #ifdef __cplusplus 21 extern "C" 22 { 23 #endif 24 25 /* -------------------------------------------------------------------- 26 enums 27 ----------------------------------------------------------------------*/ 28 29 typedef enum 30 { 31 DWC_ALLOCTYPE_AUTH, 32 DWC_ALLOCTYPE_AC, 33 DWC_ALLOCTYPE_BM, 34 DWC_ALLOCTYPE_UTIL, 35 DWC_ALLOCTYPE_BASE, 36 DWC_ALLOCTYPE_LANMATCH, 37 DWC_ALLOCTYPE_GHTTP, 38 DWC_ALLOCTYPE_RANKING, 39 DWC_ALLOCTYPE_ENC, 40 DWC_ALLOCTYPE_GS, 41 DWC_ALLOCTYPE_ND, 42 DWC_ALLOCTYPE_OPTION_CF, 43 DWC_ALLOCTYPE_NHTTP, 44 DWC_ALLOCTYPE_MAIL, 45 DWC_ALLOCTYPE_LAST, 46 47 DWC_ALLOCTYPE_NUM = DWC_ALLOCTYPE_LAST 48 } DWCAllocType; 49 50 51 /* -------------------------------------------------------------------- 52 typedefs 53 ----------------------------------------------------------------------*/ 54 55 /** 56 * The memory allocation function used by the entire DWC library 57 * 58 * This is the memory allocation function used from the DWC library. 59 * Mutual exclusion must be used when processing threads. 60 * 61 * Param: align: Return a pointer to a byte-aligned buffer of size bytes. 62 * 63 * Param: name: Ignore this; it includes information for DWC library development. 64 * 65 * 66 * Version: 1.1.0: Added a comment regarding mutually exclusive thread processing. 67 */ 68 typedef void* (*DWCAllocEx)( DWCAllocType name, u32 size, int align ); 69 70 /** 71 * The memory deallocation function used by the entire DWC library 72 * 73 * This is the memory deallocation function used from the DWC library. 74 * Mutual exclusion must be used when processing threads. 75 * Releases a buffer allocated by DWCAllocEx. 76 * End processing without taking any action if a NULL pointer is passed in. 77 * 78 * Param: ptr: Pointer to a buffer allocated by the memory allocation function. 79 * Param: name: Ignore this; it includes information for DWC library development. 80 * 81 * Param: size: Ignore this because it includes information for DWC library development and may sometimes store an inaccurate value. 82 * 83 * 84 * Version: 1.1.0: Added a comment regarding mutually exclusive thread processing. 85 */ 86 typedef void (*DWCFreeEx )( DWCAllocType name, void* ptr, u32 size ); 87 88 89 /* -------------------------------------------------------------------- 90 Functions 91 ----------------------------------------------------------------------*/ 92 93 void* DWC_Alloc ( DWCAllocType name, u32 size ); 94 void* DWC_AllocEx ( DWCAllocType name, u32 size, int align ); 95 void DWC_Free ( DWCAllocType name, void* ptr, u32 size ); 96 void* DWC_Realloc ( DWCAllocType name, void* ptr, u32 oldsize, u32 newsize ); 97 void* DWC_ReallocEx ( DWCAllocType name, void* ptr, u32 oldsize, u32 newsize, int align ); 98 99 100 #ifdef __cplusplus 101 } 102 #endif 103 104 #endif // DWC_MEMFUNC_H_ 105