2 * Copyright (C) 2012-2014, The AROS Development Team
4 * Author: Jason S. McMullan <jason.mcmullan@gmail.com>
6 * Licensed under the AROS PUBLIC LICENSE (APL) Version 1.1
9 #define __DOS_STDLIBBASE__
10 #define __OOP_STDLIBBASE__
12 #include <aros/system.h>
15 #include <proto/exec.h>
16 #include <proto/oop.h>
17 #include <proto/dos.h>
19 #include <aros/shcommands.h>
21 struct Library
*OOPBase
;
22 OOP_AttrBase HiddPCIDeviceAttrBase
;
24 #define PATTR(tag) ({ IPTR _val = ~0; \
25 OOP_GetAttr(obj, aHidd_PCIDevice_##tag, &_val); \
28 AROS_UFH3(void, Callback
,
29 AROS_UFHA(struct Hook
*, hook
, A0
),
30 AROS_UFHA(OOP_Object
*, obj
, A2
),
31 AROS_UFHA(APTR
, msg
, A1
))
35 Printf("%lx: %ld:%ld.%ld %04lx:%04lx, INT %ld, IRQ %ld\n",
36 PATTR(Driver
), PATTR(Bus
), PATTR(Dev
), PATTR(Sub
),
37 PATTR(VendorID
), PATTR(ProductID
),
38 PATTR(INTLine
), PATTR(IRQLine
));
43 struct Hook PCIHook
= {
44 .h_Entry
= (APTR
)Callback
,
47 AROS_SH0(pcilist
, 0.0)
51 int ret
= RETURN_FAIL
;
53 if ((OOPBase
= OpenLibrary("oop.library", 0))) {
56 if ((pci
= OOP_NewObject(NULL
, CLID_Hidd_PCI
, NULL
))) {
57 struct pHidd_PCI_EnumDevices msg
;
58 Printf("PCI Devices:\n");
59 HiddPCIDeviceAttrBase
= OOP_ObtainAttrBase(IID_Hidd_PCIDevice
);
61 msg
.mID
= OOP_GetMethodID(IID_Hidd_PCI
, moHidd_PCI_EnumDevices
);
62 msg
.callback
= &PCIHook
;
63 msg
.requirements
= NULL
;
65 OOP_DoMethod(pci
, (OOP_Msg
)&msg
);
66 OOP_DisposeObject(pci
);
69 Printf("Can't open pci.hidd\n");
71 CloseLibrary(OOPBase
);
73 Printf("Can't open oop.library\n");