/*-=-=-=-=-=-=-=-=-=-=-=- RCCL/RCI Notice of Copyright -=-=-=-=-=-=-=-=-=-=-*
 *									    *
 *	Copyright (C) 1987, 1991 by John E. Lloyd.			    *
 *									    *
 *	Information on copyright permissions, as well as a complete	    *
 *	disclaimer of warranty, is given in the file COPYRIGHT.		    *
 *									    *
 *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/

/*---------------------------------------------------------------------------
 *		
 * MODULE NAME:	getMemory
 *
 * DESCRIPTION:	Routines to locate the base address of a memory region
 *		using either a string name or the planning level
 *		addess as the key.
 *
 * AUTHOR/DATE:	John Lloyd, Fall 1987
 *
 * MODIFICATION HISTORY:
 *
 *--------------------------------------------------------------------------*/

#include "../h/cdefs.h"
#include "../h/rciTask.h"
#include "../rci/hashTable.h"

extern int rciTaskId;
extern void *locateSharedMem();

void *getGlobalMemory (name)
const char *name;
{
	void *addr;
	int cpu;
	
	if (hashTableLookup (name, GLOBAL_HASH_ID, &addr, &cpu) < 1)
	 { return (NULL);
	 }
	return (locateSharedMem(addr));
}

void *getSharedMemory (name)
const char *name;
{
	void *addr;
	int cpu;
	
	if (hashTableLookup (name, SHARED_HASH_ID+rciTaskId, &addr, &cpu) < 1)
	 { return (NULL);
	 }
	return (locateSharedMem(addr));
}

void *getLocalMemory (name)
const char *name;
{
	void *addr;
	int cpu;
	
	if (hashTableLookup (name, LOCAL_HASH_ID+rciTaskId, &addr, &cpu) < 1)
	 { return (NULL);
	 }
	return (addr);
}

void *findGlobalMemory (key)
void *key;
{
	return (locateSharedMem(key));
}

void *findSharedMemory (key)
void *key;
{
	return (locateSharedMem(key));
}
