- Last polishing of ATA HIDD API. PIO control and data transfer functions are separat...
[AROS.git] / rom / devs / ata / ata_class.c
blob46d758b3fbaf8f58b288617c6ab0a7b5669c3ff5
1 /*
2 Copyright (C) 2013, The AROS Development Team. All rights reserved.
3 $Id: kbdsubsystem.c 46449 2013-02-02 15:08:09Z sonic $
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 HIDD_ATABus_GetDMAInterface(Msg->driverObject);
67 /* Add the bus to the device and start service */
68 return Hidd_ATABus_Start(Msg->driverObject, ATABase);