From: <pal...@us...> - 2004-10-24 04:35:45
|
Update of /cvsroot/gc-linux/libgx/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16342/src Modified Files: gx.c Log Message: Change to GX_AllocContiguousMemory which supports multiple allocations Index: gx.c =================================================================== RCS file: /cvsroot/gc-linux/libgx/src/gx.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- gx.c 22 Oct 2004 20:13:53 -0000 1.1.1.1 +++ gx.c 24 Oct 2004 04:35:36 -0000 1.2 @@ -72,6 +72,7 @@ static u32 mmap_length; static void *front_buffer; static void *back_buffer; +static u32 alloc_pos = 0; static volatile u32* _piReg; static volatile u16* _viReg; @@ -616,6 +617,7 @@ } mmap_addr = NULL; mmap_length = 0; + alloc_pos = 0; gfd = -1; } @@ -3704,7 +3706,7 @@ pmem->length &= ~(4096-1); pmem->user_mem = mmap(0,pmem->length,PROT_READ|PROT_WRITE,MAP_SHARED,gfd, - 0x0D000000); + 0x0D000000 + alloc_pos); if (pmem->user_mem == NULL || pmem->user_mem == MAP_FAILED) { @@ -3712,6 +3714,8 @@ pmem->user_mem = pmem->phys_mem = NULL; return 1; } + /* increment position so next allocation can occur at different offset */ + alloc_pos += pmem->length; /* the kernel writes the physical address in the first dword, read it */ pmem->phys_mem = (void*)(*((u32*)pmem->user_mem)); return 0; |