b2fd4bb1d2d5e9abe0eb31630426610b3bf525e6
[AROS.git] / arch / all-pc / hpet / getunitattrsa.c
blobb2fd4bb1d2d5e9abe0eb31630426610b3bf525e6
1 #include <resources/hpet.h>
2 #include <proto/arossupport.h>
4 #include "hpet_intern.h"
6 /*****************************************************************************
8 NAME */
9 #include <proto/hpet.h>
11 AROS_LH2(BOOL, GetUnitAttrsA,
13 /* SYNOPSIS */
14 AROS_LHA(ULONG, unit, D0),
15 AROS_LHA(const struct TagItem *, tags, A0),
17 /* LOCATION */
18 struct HPETBase *, base, 4, Hpet)
20 /* FUNCTION
21 Query attributes of HPET unit.
23 INPUTS
24 unit - a number of previously allocated HPET unit.
26 RESULT
27 TRUE in case of success or FALSE if the given unit number is out of range.
29 NOTES
31 EXAMPLE
33 BUGS
35 SEE ALSO
37 INTERNALS
39 ******************************************************************************/
41 AROS_LIBFUNC_INIT
43 struct TagItem *tag, *tstate = (struct TagItem *)tags;
45 /* Owner is the only thing which can be modified, so we don't need a semaphore here */
47 if (unit >= base->unitCnt)
48 return FALSE;
50 while ((tag = LibNextTagItem(&tstate)))
52 switch (tag->ti_Tag)
54 case HPET_BASE_ADDR:
55 *(IPTR *)tag->ti_Data = base->units[unit].base;
56 break;
58 case HPET_UNIT_ADDR:
59 *(IPTR *)tag->ti_Data = base->units[unit].block;
60 break;
62 case HPET_UNIT_OWNER:
63 *(const char **)tag->ti_Data = base->units[unit].Owner;
64 break;
68 return TRUE;
70 AROS_LIBFUNC_EXIT