#include <Windows.h>#include <Assert.h>#include "GMemMgr.h"#include "BaseType.h"#include "Glide.h"Go to the source code of this file.
Compounds | |
| struct | GMemMgr |
Defines | |
| #define | TWO_MEG (1024*1024*2) |
Typedefs | |
| typedef GMemMgr | GMemMgr |
Functions | |
| GMemMgr * | GMemMgr_Create (GrChipID_t Tmu, uint32 MinAddress, uint32 MaxAddress) |
| void | GMemMgr_Destroy (GMemMgr *MemMgr) |
| uint32 | GMemMgr_GetTotalMemory (GMemMgr *MemMgr) |
| uint32 | GMemMgr_GetFreeMemory (GMemMgr *MemMgr) |
| geBoolean | GMemMgr_AllocMem (GMemMgr *MemMgr, uint32 Size, uint32 *Address) |
| GrChipID_t | GMemMgr_GetTmu (GMemMgr *MemMgr) |
| void | GMemMgr_Reset (GMemMgr *MemMgr) |
|
|
|
|
|
|
|
||||||||||||||||
|
Definition at line 97 of file GMemMgr.c. References GE_FALSE, GE_TRUE, geBoolean, GMemMgr_GetFreeMemory(), MemMgr, and uint32. Referenced by GCache_AdjustSlots().
00098 {
00099 #define TWO_MEG (1024*1024*2)
00100
00101 uint32 StartAddr;
00102
00103 assert(MemMgr);
00104 assert(GMemMgr_GetFreeMemory(MemMgr) >= Size);
00105
00106 if (GMemMgr_GetFreeMemory(MemMgr) < Size)
00107 return GE_FALSE;
00108
00109 if (((MemMgr->CurrentAddress+Size)%TWO_MEG) < Size) // Align on 2 meg boundry...
00110 {
00111 MemMgr->CurrentAddress = ((MemMgr->CurrentAddress / TWO_MEG)+1) * TWO_MEG;
00112 if (MemMgr->CurrentAddress+Size >= MemMgr->MaxAddress)
00113 return GE_FALSE;
00114 }
00115
00116 while ((MemMgr->CurrentAddress & 7) != 0)
00117 {
00118 MemMgr->CurrentAddress++;
00119 if (MemMgr->CurrentAddress+Size >= MemMgr->MaxAddress)
00120 return GE_FALSE;
00121 }
00122
00123 StartAddr = MemMgr->CurrentAddress;
00124
00125 MemMgr->CurrentAddress += Size;
00126
00127 *Address = StartAddr;
00128
00129 return GE_TRUE;
00130 }
|
|
||||||||||||||||
|
Definition at line 45 of file GMemMgr.c. Referenced by GTHandle_Startup().
00046 {
00047 GMemMgr *MemMgr;
00048
00049 MemMgr = malloc(sizeof(GMemMgr));
00050
00051 if (!MemMgr)
00052 return NULL;
00053
00054 // Clear the memmgr
00055 memset(MemMgr, 0, sizeof(GMemMgr));
00056
00057 // Set the default values...
00058 MemMgr->Tmu = Tmu;
00059
00060 MemMgr->MinAddress = MinAddress;
00061 MemMgr->MaxAddress = MaxAddress;
00062
00063 MemMgr->CurrentAddress = MinAddress;
00064
00065 return MemMgr;
00066 }
|
|
|
Definition at line 71 of file GMemMgr.c. References MemMgr. Referenced by GTHandle_FreeAllCaches().
00072 {
00073 assert(MemMgr);
00074
00075 free(MemMgr);
00076 }
|
|
|
Definition at line 89 of file GMemMgr.c. References MemMgr, and uint32. Referenced by GCache_AdjustSlots(), GCache_WriteToFile(), and GMemMgr_AllocMem().
|
|
|
Definition at line 135 of file GMemMgr.c. References MemMgr. Referenced by GCache_SetTexture(), and GCache_UpdateSlot().
00136 {
00137 assert(MemMgr);
00138
00139 return MemMgr->Tmu;
00140 }
|
|
|
Definition at line 81 of file GMemMgr.c. References MemMgr, and uint32. Referenced by GCache_WriteToFile().
|
|
|
Definition at line 145 of file GMemMgr.c. References MemMgr. Referenced by GCache_AdjustSlots().
|
1.3.2