1 #include <proto/exec.h>
3 #include "hpet_intern.h"
5 /*****************************************************************************
8 #include <proto/hpet.h>
10 AROS_LH1(ULONG
, AllocHPETUnit
,
13 AROS_LHA(const char *, user
, A0
),
16 struct HPETBase
*, base
, 2, Hpet
)
19 Allocate a free HPET timer for use.
22 user - a string specifying the name of current user. Can not be NULL.
25 A number of HPET timer unit allocated for exclusive use, or -1 if
26 there was no free HPET.
38 ******************************************************************************/
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
);
57 ReleaseSemaphore(&base
->lock
);