haiku/headers/private/graphics/common/memmgr.h
Michael Lotz bccfa80b9b Changed radeons memory manager to use areas instead of malloc. Now the radeon.driver should work without hacking the kernel heap bigger.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12134 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-03-29 21:09:05 +00:00

45 lines
848 B
C

/*
Copyright (c) 2002, Thomas Kurschel
Part of Radeon kernel driver
Memory manager used for graphics mem
*/
#ifndef _MEMMGR_H
#define _MEMMGR_H
#include <OS.h>
// allocated memory block
typedef struct mem_block {
struct mem_block *prev, *next;
uint32 base;
uint32 size;
void *tag;
bool alloced;
} mem_block;
// memory heap
typedef struct mem_info {
mem_block *first;
area_id heap_area;
uint32 block_size;
sem_id lock;
mem_block *heap;
mem_block *unused;
uint32 heap_entries;
} mem_info;
mem_info *mem_init( uint32 start, uint32 len, uint32 block_size, uint32 heap_entries );
void mem_destroy( mem_info *mem );
status_t mem_alloc( mem_info *mem, uint32 size, void *tag, uint32 *block, uint32 *offset );
status_t mem_free( mem_info *mem, uint32 block_id, void *tag );
void mem_freetag( mem_info *mem, void *tag );
#endif