disable debug
[AROS.git] / workbench / tools / SysExplorer / Modules / ATA / ata_enum.c
blob66c95a04a4a13d96cb0499e37a5d148bc005c26c
1 /*
2 Copyright (C) 2015-2019, The AROS Development Team.
3 $Id$
4 */
6 #include <aros/debug.h>
8 #define __STORAGE_NOLIBBASE__
10 #include <proto/sysexp.h>
11 #include <proto/storage.h>
13 #include <proto/alib.h>
14 #include <proto/dos.h>
15 #include <proto/exec.h>
16 #include <proto/muimaster.h>
17 #include <proto/oop.h>
18 #include <proto/utility.h>
19 #include <proto/intuition.h>
21 #include <zune/customclasses.h>
22 #include <mui/NListtree_mcc.h>
23 #include <mui/NListview_mcc.h>
24 #include <utility/tagitem.h>
25 #include <utility/hooks.h>
27 #include <hidd/storage.h>
28 #include <hidd/hidd.h>
29 #include <hidd/ata.h>
31 #include "locale.h"
32 #include "storage.h"
34 #include "ata_classes.h"
35 #include "ata_intern.h"
37 extern int ATABusWindow_Initialize(struct SysexpBase *SysexpBase);
38 extern void ATABusWindow_Deinitialize(struct SysexpBase *SysexpBase);
39 extern int ATAUnitWindow_Initialize(struct SysexpBase *SysexpBase);
40 extern void ATAUnitWindow_Deinitialize(struct SysexpBase *SysexpBase);
42 #if (1) // TODO : Move into libbase
43 extern OOP_AttrBase HiddStorageUnitAB;
44 extern OOP_AttrBase HiddATABusAB;
45 extern OOP_AttrBase HiddATAUnitAB;
47 extern OOP_MethodID HiddStorageControllerBase;
48 #endif
50 AROS_UFH3S(BOOL, ataunitenumFunc,
51 AROS_UFHA(struct Hook *, h, A0),
52 AROS_UFHA(OOP_Object*, unit, A2),
53 AROS_UFHA(void *, parent, A1))
55 AROS_USERFUNC_INIT
57 struct SysexpEnum_data *edata = (struct SysexpEnum_data *)h->h_Data;
58 struct InsertObjectMsg msg =
60 .obj = unit,
62 CONST_STRPTR name;
63 struct SysexpBase *SysexpBase;
64 struct SysexpATABase *AtaBase;
66 D(bug("[ata.sysexp] %s()\n", __func__));
68 if (!edata)
69 return TRUE;
71 SysexpBase = edata->ed_sysexpbase;
73 D(bug("[ata.sysexp] ataunit @ %p\n", unit));
74 if (!unit)
75 return TRUE;
77 AtaBase = GetBase("ATA.Module");
78 msg.winClass = AtaBase->seab_ATAUnitWindowCLASS;
79 SysexpBase->GlobalCount++;
81 OOP_GetAttr(unit, aHidd_StorageUnit_Model, (IPTR *)&name);
82 DoMethod(SysexpBase->sesb_Tree, MUIM_NListtree_Insert, name, &msg,
83 parent, MUIV_NListtree_Insert_PrevNode_Tail, 0);
85 return FALSE; /* Continue enumeration */
87 AROS_USERFUNC_EXIT
90 struct SysexpStorageBase *StorageBase;
91 static struct SysexpEnum_data privatehookdata =
93 NULL,
94 NULL
97 static void ataBusEnum(OOP_Object *obj, struct MUI_NListtree_TreeNode *parent)
99 D(bug("[ata.sysexp] atabus: \n"));
101 EnumBusUnits(obj, parent, ataunitenumFunc, &privatehookdata);
104 void ATAStartup(struct SysexpBase *SysexpBase)
106 struct SysexpATABase *AtaBase;
107 D(bug("[ata.sysexp] %s(%p)\n", __func__, SysexpBase));
109 StorageBase = GetBase("Storage.Module");
110 D(bug("[ata.sysexp] %s: StorageBase @ %p\n", __func__, StorageBase));
111 if (!StorageBase)
113 __showerror
114 ( (char *)
115 "ATA enumerator requires `storage.sysexp'.", NULL
118 AtaBase = GetBase("ATA.Module");
119 D(bug("[ata.sysexp] %s: AtaBase @ %p\n", __func__, AtaBase));
121 privatehookdata.ed_sysexpbase = SysexpBase;
123 AtaBase->seab_DevicePageCLASS = GetBase("DevicePage.Class");
124 AtaBase->seab_GenericWindowCLASS = GetBase("GenericWindow.Class");
126 ATABusWindow_Initialize(SysexpBase);
127 ATAUnitWindow_Initialize(SysexpBase);
129 RegisterStorageControllerHandler(CLID_Hidd_ATA, 90, AtaBase->seab_GenericWindowCLASS, NULL, NULL);
130 RegisterStorageBusHandler(CLID_Hidd_ATABus, 90, AtaBase->seab_ATABusWindowCLASS, ataBusEnum, NULL);
133 void ATAShutdown(struct SysexpBase *SysexpBase)
135 D(bug("[ata.sysexp] %s(%p)\n", __func__, SysexpBase));
137 ATAUnitWindow_Deinitialize(SysexpBase);
138 ATABusWindow_Deinitialize(SysexpBase);