Autodoc formatting fixes.
[AROS.git] / arch / all-pc / hpet / allochpetunit.c
blob0ae470b590a5d015027c9bdcf06eda60eadc40da
1 #include <proto/exec.h>
3 #include "hpet_intern.h"
5 /*****************************************************************************
7 NAME */
8 #include <proto/hpet.h>
10 AROS_LH1(ULONG, AllocHPETUnit,
12 /* SYNOPSIS */
13 AROS_LHA(const char *, user, A0),
15 /* LOCATION */
16 struct HPETBase *, base, 2, Hpet)
18 /* FUNCTION
19 Allocate a free HPET timer for use.
21 INPUTS
22 user - a string specifying the name of current user. Can not be NULL.
24 RESULT
25 A number of HPET timer unit allocated for exclusive use, or -1 if
26 there was no free HPET.
28 NOTES
30 EXAMPLE
32 BUGS
34 SEE ALSO
36 INTERNALS
38 ******************************************************************************/
40 AROS_LIBFUNC_INIT
42 ULONG i;
44 ObtainSemaphore(&base->lock);
46 for (i = 0; i < base->unitCnt; i++)
48 if (!base->units[i].Owner)
50 base->units[i].Owner = user;
52 ReleaseSemaphore(&base->lock);
53 return i;
57 ReleaseSemaphore(&base->lock);
58 return -1;
60 AROS_LIBFUNC_EXIT