- Main Page
- Classes
- Files

- File List
- File Members

# flMemoryVMem.c File Reference

`#include "flGlobal.h"`
`#include <string.h>`
`#include <stdio.h>`
`#include <pspkernel.h>`

Go to the source code of this file.

## Functions
void | vmemInit ()
void | vmemTerm ()
void * | vmemNormalPtr (void *inPtr)
void * | vmemAllocBuffer (u32 inWidth, u32 inHeight, u8 inBitDepth, u32 inStride)
void * | vmemAllocFrom (u32 inSize, const char *inFile, const char *inFunc, int inLine)
void * | vmemCallocFrom (u32 inSize0, u32 inSize1, const char *inFile, const char *inFunc, int inLine)
void * | vmemReallocFrom (void *inData, u32 inSize, const char *inFile, const char *inFunc, int inLine)
void | vmemFreeFrom (void *inData, const char *inFile, const char *inFunc, int inLine)
u32 | vmemFreeSpace ()
u32 | vmemLargestFreeBlock ()
float | vmemFragmentation ()
void | vmemStrideBlockAdd (void *inStart, u32 inStride, u32 inBlockSize, u32 inBlockCount)
void | vmemStrideBlockDel (VmemStrideBlock *inBlock)
void | vmemStrideBlockDelRecursive (VmemStrideBlock *inBlock)
void * | vmemStrideAlign (u32 inAlign, u32 inSize)
void * | vmemStrideAlloc (u32 inSize)
void * | vmemStrideCalloc (u32 inSize0, u32 inSize1)
bool | vmemStrideFree (void *inData)
float | vmemStrideUsage ()
u32 | vmemStrideFreeSpace ()
## Variables
u32 | vmemStart = MEMORY_VMEM_BASE
u32 | vmemSize = MEMORY_VMEM_SIZE
u32 * | vmemBlockTable = NULL
u32 | vmemBlocks = 0
u32 | vmemFreeBlocks = 0
bool | vmemInitialized = false
void * | vmemCache = (void*)((MEMORY_VMEM_BASE + MEMORY_VMEM_SIZE) - FL_MEMORY_VMEM_CACHE)
VmemStrideBlock * | vmemStrideBlocks = NULL

## Function Documentation

void* vmemAllocBuffer | ( | u32 | inWidth,
|  | u32 | inHeight,
|  | u8 | inBitDepth,
|  | u32 | inStride |
| ) |  |  |

Definition at line 97 of file flMemoryVMem.c.

References debugDevWarning, debugError, MEMORY_VMEM_SIZE, vmemAlloc, vmemInitialized, vmemRelativePtr, vmemSize, vmemStart, and vmemStrideBlockAdd().

Referenced by graphicsInit(), and vmemInit().

void* vmemAllocFrom | ( | u32 | inSize,
|  | const char * | inFile,
|  | const char * | inFunc,
|  | int | inLine |
| ) |  |  |

Definition at line 126 of file flMemoryVMem.c.

References debugWarning, debugWarningFrom(), FL_MEMORY_VMEM_BLOCKSIZE, NULL, vmemAlloc, vmemBlocks, vmemBlockTable, vmemFreeBlocks, vmemInitialized, vmemStart, and vmemStrideAlloc().

Referenced by vmemCallocFrom().

void* vmemCallocFrom | ( | u32 | inSize0,
|  | u32 | inSize1,
|  | const char * | inFile,
|  | const char * | inFunc,
|  | int | inLine |
| ) |  |  |

Definition at line 216 of file flMemoryVMem.c.

References memClear, NULL, vmemAlloc, vmemAllocFrom(), vmemCalloc, and vmemStrideCalloc().

float vmemFragmentation | ( |  | ) |

Definition at line 376 of file flMemoryVMem.c.

References debugWarning, FL_MEMORY_VMEM_BLOCKSIZE, vmemBlocks, vmemBlockTable, vmemFreeSpace(), and vmemInitialized.

void vmemFreeFrom | ( | void * | inData,
|  | const char * | inFile,
|  | const char * | inFunc,
|  | int | inLine |
| ) |  |  |

Definition at line 290 of file flMemoryVMem.c.

References debugError, debugErrorFrom(), FL_DEBUG_CALLEDFROM, FL_DEBUG_ERROR, FL_MEMORY_VMEM_BLOCKSIZE, vmemBlocks, vmemBlockTable, vmemFree, vmemFreeBlocks, vmemInitialized, vmemNormalPtr(), vmemSize, vmemStart, and vmemStrideFree().

Referenced by memFreeFrom().

u32 vmemFreeSpace | ( |  | ) |

Definition at line 353 of file flMemoryVMem.c.

References FL_MEMORY_VMEM_BLOCKSIZE, vmemFreeBlocks, and vmemStrideFreeSpace().

Referenced by memFreeSpaceTotal(), and vmemFragmentation().

void vmemInit | ( |  | ) |

Definition at line 29 of file flMemoryVMem.c.

References debugWarning, FL_MEMORY_VMEM_BLOCKSIZE, FL_MEMORY_VMEM_CACHE, memAlloc, memUncachedPtr, vmemAbsolutePtr, vmemAllocBuffer(), vmemBlocks, vmemBlockTable, vmemCache, vmemFreeBlocks, vmemInitialized, vmemSize, and vmemStart.

Referenced by graphicsInit().

u32 vmemLargestFreeBlock | ( |  | ) |

Definition at line 357 of file flMemoryVMem.c.

References debugWarning, FL_MEMORY_VMEM_BLOCKSIZE, vmemBlocks, and vmemBlockTable.

void* vmemNormalPtr | ( | void * | inPtr | ) |

Definition at line 82 of file flMemoryVMem.c.

References memCachedPtr, MEMORY_VMEM_BASE, MEMORY_VMEM_SIZE, and NULL.

Referenced by vmemFreeFrom(), vmemStrideBlockAdd(), and vmemStrideFree().

void* vmemReallocFrom | ( | void * | inData,
|  | u32 | inSize,
|  | const char * | inFile,
|  | const char * | inFunc,
|  | int | inLine |
| ) |  |  |

Definition at line 237 of file flMemoryVMem.c.

References debugDevWarning, debugDevWarningFrom(), debugError, debugErrorFrom(), debugWarning, debugWarningFrom(), FL_MEMORY_VMEM_BLOCKSIZE, memCachedPtr, memCopy, NULL, vmemAlloc, vmemBlocks, vmemBlockTable, vmemFree, vmemRealloc, vmemRelativePtr, and vmemStart.

void* vmemStrideAlign | ( | u32 | inAlign,
|  | u32 | inSize |
| ) |  |  |

Definition at line 456 of file flMemoryVMem.c.

References FL_MEMORY_ALIGNMENT_DEFAULT, flRunning, NULL, vmemStrideBlocks, VmemStrideBlock::vmsbBlockAlign, VmemStrideBlock::vmsbBlockCount, VmemStrideBlock::vmsbBlockSize, VmemStrideBlock::vmsbBlockTable, and VmemStrideBlock::vmsbNext.

Referenced by memAlignFrom(), and vmemStrideAlloc().

void* vmemStrideAlloc | ( | u32 | inSize | ) |

Definition at line 492 of file flMemoryVMem.c.

References FL_MEMORY_ALIGNMENT_DEFAULT, and vmemStrideAlign().

Referenced by vmemAllocFrom(), and vmemStrideCalloc().

void vmemStrideBlockAdd | ( | void * | inStart,
|  | u32 | inStride,
|  | u32 | inBlockSize,
|  | u32 | inBlockCount |
| ) |  |  |

Definition at line 396 of file flMemoryVMem.c.

References debugWarning, memAddressAlignment(), memAlloc, memBlockValid(), memClear, min, NULL, vmemNormalPtr(), vmemStrideBlocks, VmemStrideBlock::vmsbBlockAlign, VmemStrideBlock::vmsbBlockCount, VmemStrideBlock::vmsbBlockSize, VmemStrideBlock::vmsbBlockTable, VmemStrideBlock::vmsbLast, VmemStrideBlock::vmsbNext, VmemStrideBlock::vmsbStart, and VmemStrideBlock::vmsbStride.

Referenced by vmemAllocBuffer().

void vmemStrideBlockDel | ( | VmemStrideBlock * | inBlock | ) |

Definition at line 434 of file flMemoryVMem.c.

References memFree, vmemStrideBlocks, VmemStrideBlock::vmsbLast, and VmemStrideBlock::vmsbNext.

void vmemStrideBlockDelRecursive | ( | VmemStrideBlock * | inBlock | ) |

Definition at line 444 of file flMemoryVMem.c.

References memFree, vmemStrideBlockDelRecursive(), VmemStrideBlock::vmsbLast, and VmemStrideBlock::vmsbNext.

Referenced by vmemStrideBlockDelRecursive(), and vmemTerm().

void* vmemStrideCalloc | ( | u32 | inSize0,
|  | u32 | inSize1 |
| ) |  |  |

Definition at line 496 of file flMemoryVMem.c.

References memClear, and vmemStrideAlloc().

Referenced by vmemCallocFrom().

bool vmemStrideFree | ( | void * | inData | ) |

Definition at line 502 of file flMemoryVMem.c.

References debugWarning, flRunning, vmemNormalPtr(), vmemStrideBlocks, VmemStrideBlock::vmsbBlockCount, VmemStrideBlock::vmsbBlockSize, VmemStrideBlock::vmsbBlockTable, VmemStrideBlock::vmsbNext, VmemStrideBlock::vmsbStart, and VmemStrideBlock::vmsbStride.

Referenced by vmemFreeFrom().

u32 vmemStrideFreeSpace | ( |  | ) |

Definition at line 563 of file flMemoryVMem.c.

References flRunning, vmemStrideBlocks, VmemStrideBlock::vmsbBlockCount, VmemStrideBlock::vmsbBlockSize, VmemStrideBlock::vmsbBlockTable, and VmemStrideBlock::vmsbNext.

Referenced by vmemFreeSpace().

float vmemStrideUsage | ( |  | ) |

Definition at line 534 of file flMemoryVMem.c.

References flRunning, vmemStrideBlocks, VmemStrideBlock::vmsbBlockCount, VmemStrideBlock::vmsbBlockSize, VmemStrideBlock::vmsbBlockTable, and VmemStrideBlock::vmsbNext.

void vmemTerm | ( |  | ) |

Definition at line 67 of file flMemoryVMem.c.

References debugWarning, memFree, MEMORY_VMEM_BASE, MEMORY_VMEM_SIZE, vmemBlocks, vmemBlockTable, vmemInitialized, vmemSize, vmemStart, vmemStrideBlockDelRecursive(), and vmemStrideBlocks.

Referenced by graphicsTerm().

## Variable Documentation

u32 vmemBlocks = 0

Definition at line 19 of file flMemoryVMem.c.

Referenced by vmemAllocFrom(), vmemFragmentation(), vmemFreeFrom(), vmemInit(), vmemLargestFreeBlock(), vmemReallocFrom(), and vmemTerm().

u32* vmemBlockTable = NULL

Definition at line 18 of file flMemoryVMem.c.

Referenced by vmemAllocFrom(), vmemFragmentation(), vmemFreeFrom(), vmemInit(), vmemLargestFreeBlock(), vmemReallocFrom(), and vmemTerm().

void* vmemCache = (void*)((MEMORY_VMEM_BASE + MEMORY_VMEM_SIZE) - FL_MEMORY_VMEM_CACHE)

Definition at line 24 of file flMemoryVMem.c.

Referenced by graphicsEffectFsColorEnhance(), graphicsEffectFsDichrome(), graphicsEffectFsGlow(), graphicsEffectFsGrayscale(), graphicsEffectFsInvert(), graphicsEffectFsLightEnhance(), graphicsEffectFsMonochrome(), graphicsEffectFsNightVision(), graphicsEffectFsThermalVision(), and vmemInit().

u32 vmemFreeBlocks = 0

Definition at line 20 of file flMemoryVMem.c.

Referenced by vmemAllocFrom(), vmemFreeFrom(), vmemFreeSpace(), and vmemInit().

bool vmemInitialized = false

Definition at line 21 of file flMemoryVMem.c.

Referenced by memQallocFrom(), vmemAllocBuffer(), vmemAllocFrom(), vmemFragmentation(), vmemFreeFrom(), vmemInit(), and vmemTerm().

u32 vmemSize = MEMORY_VMEM_SIZE

Definition at line 17 of file flMemoryVMem.c.

Referenced by vmemAllocBuffer(), vmemFreeFrom(), vmemInit(), and vmemTerm().

u32 vmemStart = MEMORY_VMEM_BASE

Definition at line 16 of file flMemoryVMem.c.

Referenced by vmemAllocBuffer(), vmemAllocFrom(), vmemFreeFrom(), vmemInit(), vmemReallocFrom(), and vmemTerm().

VmemStrideBlock* vmemStrideBlocks = NULL

Definition at line 27 of file flMemoryVMem.c.

Referenced by vmemStrideAlign(), vmemStrideBlockAdd(), vmemStrideBlockDel(), vmemStrideFree(), vmemStrideFreeSpace(), vmemStrideUsage(), and vmemTerm().