2 Copyright (C) 2013, The AROS Development Team.
6 #define MUIMASTER_YES_INLINE_STDARG
8 #include <exec/memory.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>
26 #include "cpuspecific.h"
29 #include <aros/debug.h>
31 #include <zune/customclasses.h>
33 /*** Instance Data **********************************************************/
34 struct ATAUnitWindow_DATA
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",
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)
63 str
+= strlen(*names
);
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
;
81 char xfermodes_str
[256];
82 char usemodes_str
[256];
83 char multisector_str
[4];
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
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
,
114 MUIA_Background
, MUII_TextBack
,
116 MUIA_Text_Contents
, (IPTR
)unit_str
,
118 Child
, (IPTR
)Label(_(MSG_MODEL
)),
119 Child
, (IPTR
)(TextObject
,
121 MUIA_Background
, MUII_TextBack
,
123 MUIA_Text_Contents
, model
,
125 Child
, (IPTR
)Label(_(MSG_REVISION
)),
126 Child
, (IPTR
)(TextObject
,
128 MUIA_Background
, MUII_TextBack
,
130 MUIA_Text_Contents
, revision
,
132 Child
, (IPTR
)Label(_(MSG_SERIAL
)),
133 Child
, (IPTR
)(TextObject
,
135 MUIA_Background
, MUII_TextBack
,
137 MUIA_Text_Contents
, serial
,
139 Child
, (IPTR
)Label(_(MSG_TRANSFER_MODES
)),
140 Child
, (IPTR
)(NFloattextObject
,
142 MUIA_Background
, MUII_TextBack
,
144 MUIA_Floattext_Text
, (IPTR
)xfermodes_str
,
146 Child
, (IPTR
)Label(_(MSG_CONFIG_MODES
)),
147 Child
, (IPTR
)(NFloattextObject
,
149 MUIA_Background
, MUII_TextBack
,
151 MUIA_Floattext_Text
, (IPTR
)usemodes_str
,
153 Child
, (IPTR
)Label(_(MSG_MULTISECTOR
)),
154 Child
, (IPTR
)(TextObject
,
156 MUIA_Background
, MUII_TextBack
,
158 MUIA_Text_Contents
, (IPTR
)multisector_str
,
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
,
167 MUIA_Background
, MUII_TextBack
,
169 Child
, (IPTR
)HSpace(0),
176 /*** Setup ******************************************************************/
179 ATAUnitWindow
, NULL
, MUIC_Window
, NULL
,
180 OM_NEW
, struct opSet
*