2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
6 #include <proto/exec.h>
8 #include "hpet_intern.h"
10 /*****************************************************************************
13 #include <proto/hpet.h>
15 AROS_LH1(ULONG
, AllocHPETUnit
,
18 AROS_LHA(const char *, user
, A0
),
21 struct HPETBase
*, base
, 2, Hpet
)
24 Allocate a free HPET timer for use.
27 user - a string specifying the name of current user. Can not be NULL.
30 A number of HPET timer unit allocated for exclusive use, or -1 if
31 there was no free HPET.
43 ******************************************************************************/
49 ObtainSemaphore(&base
->lock
);
51 for (i
= 0; i
< base
->unitCnt
; i
++)
53 if (!base
->units
[i
].Owner
)
55 base
->units
[i
].Owner
= user
;
57 ReleaseSemaphore(&base
->lock
);
62 ReleaseSemaphore(&base
->lock
);