@database "misc" @master "Cats_CD:IncludesD/Inc&AD1.3/doc/misc.doc" @Node Main "misc.doc" @TOC 1.3Includes_Autodocs/Autodocs @{" MR_ALLOCMISCRESOURCE " Link "MR_ALLOCMISCRESOURCE"} @{" MR_FREEMISCRESOURCE " Link "MR_FREEMISCRESOURCE"} @EndNode @Node "MR_ALLOCMISCRESOURCE" "misc.resource/MR_ALLOCMISCRESOURCE" NAME MR_ALLOCMISCRESOURCE - allocate one of the misc resources SYNOPSIS CurrentUser = MR_ALLOCMISCRESOURCE( unitNum, name ), misc.resource D0 D0 A1 A6 STRPTR CurrentUser; LONG unitNum; STRPTR name; FUNCTION This routine allocates one of the miscellaneous resources. If the resource is currently 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 routine may not be called from an interrupt routine DESCRIPTION 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. The misc.resource must be accessed using assembly language. The set of currently defined units and the function offsets from the resource base are listed in the resources/misc.i include file. INPUTS 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...) RESULTS CurrentUser - if the resource is busy, then the name of the current user is returned. If the resource is free, then null is returned. BUGS SEE ALSO resources/misc.i @{"misc.resource/MR_FREEMISCRESOURCE" Link "MR_FREEMISCRESOURCE"} @EndNode @Node "MR_FREEMISCRESOURCE" "misc.resource/MR_FREEMISCRESOURCE" NAME MR_FREEMISCRESOURCE - make a resource available for reallocation SYNOPSIS MR_FREEMISCRESOURCE( unitNum ), misc.resource D0 A6 LONG unitNum; FUNCTION This routine frees one of the resources allocated by @{"MR_ALLOCMISCRESOURCE" Link "MR_ALLOCMISCRESOURCE"}. The resource is made available for reuse. This routine may not be called from an interrupt routine. INPUTS unitNum - the number of the miscellaneous resource to be freed. RESULTS Frees the appropriate resource. BUGS SEE ALSO @EndNode