@database "misc"

@Node Main "misc.doc"
@toc "Includes_&_Autodocs/Main"
    @{" AllocMiscResource() " Link "AllocMiscResource()"}
    @{" FreeMiscResource() " Link "FreeMiscResource()"}
@EndNode

@Node "AllocMiscResource()" "misc.resource/AllocMiscResource"

@{b}    NAME@{ub}
	AllocMiscResource - allocate one of the miscelaneous resources

@{b}   SYNOPSIS@{ub}
	CurrentUser = AllocMiscResource( unitNum, name )
	D0				 D0	  A1

	char * AllocMiscResource(ULONG,char *);

@{b}   FUNCTION@{ub}
	This routine attempts to allocate one of the miscellaneous resources
	If the resource had already been allocated, an error is returned. If
	you do get it, your name is associated with the resource (so a user
	can see who has it allocated).

	This function may not be called from interrupt code

@{b}   DESCRIPTION@{ub}
	There are certain parts of the hardware that a multitasking- friendly
	program may need to take over.	The serial port is a good example. By
	grabbing the misc.resource for the serial port, the caller would
	"own" the hardware registers associated with that function.  Nobody
	else, including the system serial driver, is allowed to interfere.

	Resources are called in exactly the same manner as libraries.
	From assembly language, A6 must equal the resource base.  The
	offsets for the function are listed in the resources/misc.i
	include file (MR_ALLOCMISCRESOURCE for this function).

@{b}   INPUTS@{ub}
	unitNum - the number of the resource you want to allocate
		  (eg.  MR_SERIALBITS).
	name - a mnenonic name that will help the user figure out
		what piece of software is hogging a resource.
		(havoc breaks out if a name of null is passed in...)

@{b}   RESULTS@{ub}
	CurrentUser - if the resource is busy, then the name of
		the current user is returned.  If the resource is
		free, then null is returned.

@{b}   BUGS@{ub}

@{b}   SEE ALSO@{ub}
	resources/misc.i, @{"FreeMiscResource()" Link "FreeMiscResource()"}
@EndNode

@Node "FreeMiscResource()" "misc.resource/FreeMiscResource"

@{b}   NAME@{ub}
	FreeMiscResource - make a resource available for reallocation

@{b}   SYNOPSIS@{ub}
	FreeMiscResource( unitNum )
			  D0

	void FreeMiscResource(ULONG);

@{b}   FUNCTION@{ub}
	This routine frees one of the resources allocated
	by @{"AllocMiscResource" Link "misc/AllocMiscResource()"}.  The resource is made available
	for reuse.

	FreeMiscResource must be called from the same task that
	called @{"AllocMiscResource" Link "misc/AllocMiscResource()"}.  This function may not be called from
	interrupt code.

@{b}    INPUTS@{ub}
	unitNum - the number of the miscellaneous resource to be freed.

@{b}    RESULTS@{ub}
	Frees the appropriate resource.

@{b}    BUGS@{ub}

@{b}    SEE ALSO@{ub}
	resources/misc.i, @{"AllocMiscResource()" Link "AllocMiscResource()"}

@EndNode

