home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD v1.2 / amidev_cd_12.iso / inc&ad2.0 / text_autodocs / misc.doc < prev    next >
Text File  |  1992-09-01  |  2KB  |  83 lines

  1. TABLE OF CONTENTS
  2.  
  3. misc.resource/AllocMiscResource
  4. misc.resource/FreeMiscResource
  5. misc.resource/AllocMiscResource               misc.resource/AllocMiscResource
  6.  
  7.     NAME
  8.     AllocMiscResource - allocate one of the miscelaneous resources
  9.  
  10.    SYNOPSIS
  11.     CurrentUser = AllocMiscResource( unitNum, name )
  12.     D0                 D0      A1
  13.  
  14.     char * AllocMiscResource(ULONG,char *);
  15.  
  16.    FUNCTION
  17.     This routine attempts to allocate one of the miscellaneous resources
  18.     If the resource had already been allocated, an error is returned. If
  19.     you do get it, your name is associated with the resource (so a user
  20.     can see who has it allocated).
  21.  
  22.     This function may not be called from interrupt code
  23.  
  24.    DESCRIPTION
  25.     There are certain parts of the hardware that a multitasking- friendly
  26.     program may need to take over.    The serial port is a good example. By
  27.     grabbing the misc.resource for the serial port, the caller would
  28.     "own" the hardware registers associated with that function.  Nobody
  29.     else, including the system serial driver, is allowed to interfere.
  30.  
  31.     Resources are called in exactly the same manner as libraries.
  32.     From assembly language, A6 must equal the resource base.  The
  33.     offsets for the function are listed in the resources/misc.i
  34.     include file (MR_ALLOCMISCRESOURCE for this function).
  35.  
  36.    INPUTS
  37.     unitNum - the number of the resource you want to allocate
  38.           (eg.  MR_SERIALBITS).
  39.     name - a mnenonic name that will help the user figure out
  40.         what piece of software is hogging a resource.
  41.         (havoc breaks out if a name of null is passed in...)
  42.  
  43.    RESULTS
  44.     CurrentUser - if the resource is busy, then the name of
  45.         the current user is returned.  If the resource is
  46.         free, then null is returned.
  47.  
  48.    BUGS
  49.  
  50.    SEE ALSO
  51.     resources/misc.i, FreeMiscResource()
  52. misc.resource/FreeMiscResource                 misc.resource/FreeMiscResource
  53.  
  54.    NAME
  55.     FreeMiscResource - make a resource available for reallocation
  56.  
  57.    SYNOPSIS
  58.     FreeMiscResource( unitNum )
  59.               D0
  60.  
  61.     void FreeMiscResource(ULONG);
  62.  
  63.    FUNCTION
  64.     This routine frees one of the resources allocated
  65.     by AllocMiscResource.  The resource is made available
  66.     for reuse.
  67.  
  68.     FreeMiscResource must be called from the same task that
  69.     called AllocMiscResource.  This function may not be called from
  70.     interrupt code.
  71.  
  72.     INPUTS
  73.     unitNum - the number of the miscellaneous resource to be freed.
  74.  
  75.     RESULTS
  76.     Frees the appropriate resource.
  77.  
  78.     BUGS
  79.  
  80.     SEE ALSO
  81.     resources/misc.i, AllocMiscResource()
  82.  
  83.