alsa.audio: add debug logs
[AROS.git] / workbench / tools / SysExplorer / ataunit_window_cl.c
blob28ff71ff01797df9697b4e622a5bf40ccbd818ae
1 /*
2 Copyright (C) 2013, The AROS Development Team.
3 $Id$
4 */
6 #define MUIMASTER_YES_INLINE_STDARG
8 #include <exec/memory.h>
9 #include <hidd/ata.h>
10 #include <libraries/mui.h>
11 #include <mui/NFloattext_mcc.h>
12 #include <utility/tagitem.h>
13 #include <utility/hooks.h>
15 #include <proto/alib.h>
16 #include <proto/exec.h>
17 #include <proto/muimaster.h>
18 #include <proto/utility.h>
19 #include <proto/intuition.h>
21 #include <ctype.h>
22 #include <stdio.h>
23 #include <stdlib.h>
25 #include "classes.h"
26 #include "cpuspecific.h"
27 #include "locale.h"
29 #include <aros/debug.h>
31 #include <zune/customclasses.h>
33 /*** Instance Data **********************************************************/
34 struct ATAUnitWindow_DATA
36 /* Nothing to add */
39 static const char *const xferModeNames[] =
41 "PIO0" , "PIO1" , "PIO2 ", "PIO3" , "PIO4" ,
42 "MDMA0", "MDMA1", "MDMA2",
43 "UDMA0", "UDMA1", "UDMA2", "UDMA3", "UDMA4", "UDMA5", "UDMA6",
44 (const char *)AB_XFER_48BIT,
45 "LBA48", "Multisector", "ATAPI", "LBA", "PIO32",
46 NULL
49 static void DecodeBits(char *str, ULONG flags, const char *const *names)
51 unsigned char i, done;
53 for (i = 0, done = 0; *names; names++)
55 if ((IPTR)*names < 32)
57 i = (IPTR)*names;
58 continue;
60 if (flags & (1 << i))
62 strcpy(str, *names);
63 str += strlen(*names);
64 if ((done % 5) == 4)
65 *str++ = '\n';
66 else
67 *str++ = ' ';
68 done++;
70 i++;
73 *str = 0;
76 static Object *ATAUnitWindow__OM_NEW(Class *cl, Object *self, struct opSet *msg)
78 OOP_Object *dev = (OOP_Object *)GetTagData(MUIA_PropertyWin_Object, 0, msg->ops_AttrList);
79 IPTR model, revision, serial;
80 IPTR val;
81 char xfermodes_str[256];
82 char usemodes_str[256];
83 char multisector_str[4];
84 char unit_str[6];
85 LONG removable;
87 OOP_GetAttr(dev, aHidd_ATAUnit_Model , &model);
88 OOP_GetAttr(dev, aHidd_ATAUnit_Revision, &revision);
89 OOP_GetAttr(dev, aHidd_ATAUnit_Serial , &serial);
91 removable = OOP_GET(dev, aHidd_ATAUnit_Removable) ? IDS_SELECTED : IDS_NORMAL;
93 OOP_GetAttr(dev, aHidd_ATAUnit_Number, &val);
94 snprintf(unit_str, sizeof(unit_str), "%ld", val);
96 OOP_GetAttr(dev, aHidd_ATAUnit_XferModes, &val);
97 DecodeBits(xfermodes_str, val, xferModeNames),
99 OOP_GetAttr(dev, aHidd_ATAUnit_ConfiguredModes, &val);
100 DecodeBits(usemodes_str, val, xferModeNames),
102 OOP_GetAttr(dev, aHidd_ATAUnit_MultiSector, &val);
103 snprintf(multisector_str, sizeof(multisector_str), "%ld", val);
105 return (Object *) DoSuperNewTags
107 cl, self, NULL,
108 MUIA_Window_Title, __(MSG_ATA_UNIT_PROPERTIES),
109 MUIA_Window_ID, MAKE_ID('A', 'U', 'N', 'P'),
110 WindowContents, (IPTR)(ColGroup(2),
111 Child, (IPTR)Label(_(MSG_UNIT_NUMBER)),
112 Child, (IPTR)(TextObject,
113 TextFrame,
114 MUIA_Background, MUII_TextBack,
115 MUIA_CycleChain, 1,
116 MUIA_Text_Contents, (IPTR)unit_str,
117 End),
118 Child, (IPTR)Label(_(MSG_MODEL)),
119 Child, (IPTR)(TextObject,
120 TextFrame,
121 MUIA_Background, MUII_TextBack,
122 MUIA_CycleChain, 1,
123 MUIA_Text_Contents, model,
124 End),
125 Child, (IPTR)Label(_(MSG_REVISION)),
126 Child, (IPTR)(TextObject,
127 TextFrame,
128 MUIA_Background, MUII_TextBack,
129 MUIA_CycleChain, 1,
130 MUIA_Text_Contents, revision,
131 End),
132 Child, (IPTR)Label(_(MSG_SERIAL)),
133 Child, (IPTR)(TextObject,
134 TextFrame,
135 MUIA_Background, MUII_TextBack,
136 MUIA_CycleChain, 1,
137 MUIA_Text_Contents, serial,
138 End),
139 Child, (IPTR)Label(_(MSG_TRANSFER_MODES)),
140 Child, (IPTR)(NFloattextObject,
141 TextFrame,
142 MUIA_Background, MUII_TextBack,
143 MUIA_CycleChain, 1,
144 MUIA_Floattext_Text, (IPTR)xfermodes_str,
145 End),
146 Child, (IPTR)Label(_(MSG_CONFIG_MODES)),
147 Child, (IPTR)(NFloattextObject,
148 TextFrame,
149 MUIA_Background, MUII_TextBack,
150 MUIA_CycleChain, 1,
151 MUIA_Floattext_Text, (IPTR)usemodes_str,
152 End),
153 Child, (IPTR)Label(_(MSG_MULTISECTOR)),
154 Child, (IPTR)(TextObject,
155 TextFrame,
156 MUIA_Background, MUII_TextBack,
157 MUIA_CycleChain, 1,
158 MUIA_Text_Contents, (IPTR)multisector_str,
159 End),
160 Child, (IPTR)Label(_(MSG_REMOVABLE)),
161 Child, (IPTR)(HGroup,
162 Child, (IPTR)(ImageObject,
163 MUIA_Image_Spec, MUII_CheckMark,
164 MUIA_Image_State, removable,
165 TextFrame,
166 MUIA_CycleChain, 1,
167 MUIA_Background, MUII_TextBack,
168 End),
169 Child, (IPTR)HSpace(0),
170 End),
171 End),
172 TAG_DONE
176 /*** Setup ******************************************************************/
177 ZUNE_CUSTOMCLASS_1
179 ATAUnitWindow, NULL, MUIC_Window, NULL,
180 OM_NEW, struct opSet *