scripts: remove explicit --with-paranoia from configure line as it is enabled by...
[AROS.git] / workbench / hidds / agp / agpclass.c
blobfd0ce11b8e4f1861278cecacacbc51be00e690d8
1 /*
2 Copyright 2010, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <hidd/agp.h>
7 #include <proto/oop.h>
8 #include <proto/exec.h>
9 #include <aros/debug.h>
11 #include "agp_private.h"
13 struct ClassName
15 struct Node node;
16 STRPTR name;
19 /* HELPERS */
20 VOID HiddAgpRegisterClass(struct HIDDAGPData * adata, STRPTR class)
22 struct ClassName * cn = AllocVec(sizeof(struct ClassName), MEMF_ANY | MEMF_CLEAR);
23 cn->name = class;
24 AddTail(&adata->classes, (struct Node *)cn);
27 /* PUBLIC METHODS */
28 OOP_Object * METHOD(AGP, Root, New)
30 o = (OOP_Object *)OOP_DoSuperMethod(cl, o, (OOP_Msg) msg);
32 if (o)
34 struct HIDDAGPData * adata = OOP_INST_DATA(cl, o);
35 NEWLIST(&adata->classes);
36 HiddAgpRegisterClass(adata, CLID_Hidd_i845BridgeDevice);
37 HiddAgpRegisterClass(adata, CLID_Hidd_i7505BridgeDevice);
38 HiddAgpRegisterClass(adata, CLID_Hidd_SiSBridgeDevice);
39 HiddAgpRegisterClass(adata, CLID_Hidd_VIABridgeDevice);
40 HiddAgpRegisterClass(adata, CLID_Hidd_VIAAgp3BridgeDevice);
41 HiddAgpRegisterClass(adata, CLID_Hidd_SiSAgp3BridgeDevice);
44 return o;
47 VOID AGP__Root__Dispose(OOP_Class * cl, OOP_Object * o, OOP_Msg mag)
49 struct HIDDAGPData * adata = OOP_INST_DATA(cl, o);
50 struct ClassName * name = NULL;
52 /* Free registered class information */
53 while((name = (struct ClassName *)RemHead(&adata->classes)) != NULL)
54 FreeVec(name);
58 OOP_Object * METHOD(AGP, Hidd_AGP, GetBridgeDevice)
60 /* Find bridge device matching hardware */
61 if (!SD(cl)->bridgedevice)
63 struct ClassName * name = NULL;
64 struct HIDDAGPData * adata = OOP_INST_DATA(cl, o);
66 ForeachNode(&adata->classes, name)
68 struct pHidd_AGPBridgeDevice_Initialize imsg = {
69 mID : OOP_GetMethodID(IID_Hidd_AGPBridgeDevice, moHidd_AGPBridgeDevice_Initialize)
72 OOP_Object * bridgedevice = OOP_NewObject(NULL, name->name, NULL);
74 if ((BOOL)OOP_DoMethod(bridgedevice, (OOP_Msg)&imsg))
75 SD(cl)->bridgedevice = bridgedevice;
76 else
77 OOP_DisposeObject(bridgedevice);
82 return SD(cl)->bridgedevice;