delint
[AROS.git] / rom / devs / ata / ata_class.c
blob4e9da76711df04e01bd4a66f8e62c6f49ab303a7
1 /*
2 Copyright (C) 2013, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <aros/debug.h>
7 #include <hidd/ata.h>
8 #include <hidd/hidd.h>
9 #include <hidd/keyboard.h>
10 #include <oop/oop.h>
11 #include <utility/tagitem.h>
13 #include "ata.h"
15 OOP_Object *ATA__Root__New(OOP_Class *cl, OOP_Object *o, struct pRoot_New *msg)
17 struct ataBase *ATABase = cl->UserData;
19 if (!ATABase->ataObj)
21 struct TagItem new_tags[] =
23 {aHW_ClassName, (IPTR)"IDE"},
24 {TAG_DONE , 0 }
26 struct pRoot_New new_msg =
28 .mID = msg->mID,
29 .attrList = new_tags
32 ATABase->ataObj = (OOP_Object *)OOP_DoSuperMethod(cl, o, &new_msg.mID);
34 return ATABase->ataObj;
37 VOID ATA__Root__Dispose(OOP_Class *cl, OOP_Object *o, OOP_Msg msg)
39 /* We are singletone. Cannot dispose. */
42 BOOL ATA__HW__RemoveDriver(OOP_Class *cl, OOP_Object *o, struct pHW_RemoveDriver *Msg)
45 * Currently we don't support unloading bus drivers.
46 * This is a very-very big TODO.
48 return FALSE;
51 BOOL ATA__HW__SetUpDriver(OOP_Class *cl, OOP_Object *o, struct pHW_SetUpDriver *Msg)
53 struct ataBase *ATABase = cl->UserData;
56 * Instantiate interfaces. PIO is mandatory, DMA is not.
57 * We don't keep interface pointers here because our bus class
58 * stores them itself.
59 * We do this in SetUpDriver because the object must be fully
60 * created in order for this stuff to work.
62 if (!HIDD_ATABus_GetPIOInterface(Msg->driverObject))
63 return FALSE;
65 if (!ATABase->ata_NoDMA)
66 HIDD_ATABus_GetDMAInterface(Msg->driverObject);
68 /* Add the bus to the device and start service */
69 return Hidd_ATABus_Start(Msg->driverObject, ATABase);