// Filename : DCACHE.C // Coded by : Scott Evans // Created/Modified : 31/7/98 // Description : Code to manage D-cache allocation #include u_byte *dcache_ptr; // Function : InitDCachePointer() // Coded by : Scott Evans // Created/Modified : 31/7/98 // Description : Initialise a pointer to start of the D-cache // Parameters : None // Returns : None // Notes : None void InitDCachePointer(void) { dcache_ptr=(u_byte *)DCACHE_START; printf("InitDCachePointer : Completed\n"); } // Function : AllocateDCache() // Coded by : Scott Evans // Created/Modified : 31/7/98 // Description : Allocate part of D-cache to a variable // Parameters : size - size of variable // Returns : Pointer to allocated area, 0 for error // Notes : None void *AllocateDCache(u_long size) { void *p; // Can we fit it into D-cache if(dcache_ptr+size<(u_byte *)(DCACHE_START+DCACHE_SIZE)) { // Allocate part of D-cache p=dcache_ptr; dcache_ptr+=size; return(p); } // No room left printf("AllocateDCache : Failed\n"); return(0); }