2 Copyright 2010, The AROS Development Team. All rights reserved.
8 #include <proto/exec.h>
9 #include <aros/debug.h>
11 #include "agp_private.h"
20 VOID
HiddAgpRegisterClass(struct HIDDAGPData
* adata
, STRPTR
class)
22 struct ClassName
* cn
= AllocVec(sizeof(struct ClassName
), MEMF_ANY
| MEMF_CLEAR
);
24 AddTail(&adata
->classes
, (struct Node
*)cn
);
28 OOP_Object
* METHOD(AGP
, Root
, New
)
30 o
= (OOP_Object
*)OOP_DoSuperMethod(cl
, o
, (OOP_Msg
) msg
);
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
);
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
)
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
;
77 OOP_DisposeObject(bridgedevice
);
82 return SD(cl
)->bridgedevice
;