2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: AllocMiscResource() function.
8 #include "misc_intern.h"
9 #include <proto/exec.h>
10 #include <resources/misc.h>
12 /*****************************************************************************
16 AROS_LH2(char *, AllocMiscResource
,
19 AROS_LHA(ULONG
, unitNum
, d0
),
20 AROS_LHA(char *, name
, a0
),
23 APTR
, MiscBase
, 1, Misc
)
27 Allocates one of the miscellaneous resources.
31 unitNum -- The resource to allocate
32 name -- An identifying name for you, must NOT be NULL.
36 NULL if the allocation was successful. If the resource couln't be
37 allocated, the name of the holder of the resource is returned.
51 The misc.resource should probably just redirect commands to a HIDD
52 in the future, to support things like multiple serial ports.
56 *****************************************************************************/
60 char *errorStr
= "Error -- invalid unit.";
63 if(unitNum
>= MR_MAXUNIT
)
66 ObtainSemaphore(&GPB(MiscBase
)->mb_Lock
);
68 retval
= GPB(MiscBase
)->mb_owners
[unitNum
];
71 GPB(MiscBase
)->mb_owners
[unitNum
] = name
;
73 ReleaseSemaphore(&GPB(MiscBase
)->mb_Lock
);
78 } /* AllocMiscResource */