Documented GVF_SAVE_VAR alongside other flags, and removed a query/doubt
[AROS.git] / rom / usb / classes / massstorage / massstorage.h
blobd6238772b07670e9d3d75cd52894e76a16868b1e
1 #ifndef MASSSTORAGE_H
2 #define MASSSTORAGE_H
4 #include <intuition/intuition.h>
5 #include <intuition/intuitionbase.h>
6 #include <libraries/mui.h>
7 #include <libraries/gadtools.h>
8 #include <devices/newstyle.h>
9 #include <devices/trackdisk.h>
10 #include <devices/scsidisk.h>
11 #include <devices/hardblocks.h>
13 #define NIL_PTR 0xffffffff
15 #if defined(__GNUC__)
16 # pragma pack(2)
17 #endif
19 #define ID_ABOUT 0x55555555
20 #define ID_STORE_CONFIG 0xaaaaaaaa
21 #define ID_DEF_CONFIG 0xaaaaaaab
22 #define ID_SELECT_LUN 0x22222222
23 #define ID_AUTODTXMAXTX 0x11111111
25 struct ClsDevCfg
27 ULONG cdc_ChunkID;
28 ULONG cdc_Length;
29 IPTR cdc_NakTimeout;
30 IPTR cdc_PatchFlags;
31 char cdc_FATFSName[64];
32 ULONG cdc_FATDosType;
33 IPTR cdc_StartupDelay;
34 char cdc_FATControl[64];
35 ULONG cdc_MaxTransfer;
36 char cdc_CDFSName[64];
37 ULONG cdc_CDDosType;
38 char cdc_CDControl[64];
39 char cdc_NTFSName[64];
40 ULONG cdc_NTFSDosType;
41 char cdc_NTFSControl[64];
44 struct ClsUnitCfg
46 ULONG cuc_ChunkID;
47 ULONG cuc_Length;
48 IPTR cuc_AutoMountFAT;
49 char cuc_FATDOSName[32];
50 IPTR cuc_FATBuffers;
51 IPTR cuc_AutoMountRDB;
52 IPTR cuc_BootRDB;
53 IPTR cuc_DefaultUnit;
54 IPTR cuc_AutoUnmount;
55 IPTR cuc_MountAllFAT;
56 IPTR cuc_AutoMountCD;
59 struct PartitionEntry
61 UBYTE pe_Flags; /* Offset 0 */
62 UBYTE pe_StartCHS[3]; /* Offset 1 */
63 UBYTE pe_Type; /* Offset 4 */
64 UBYTE pe_EndCHS[3]; /* Offset 5 */
65 ULONG pe_StartLBA; /* Offset 8 */
66 ULONG pe_SectorCount; /* Offset 12 */
69 #define PE_FLAGB_ACTIVE 7
70 #define PE_FLAGF_ACTIVE (1 << PE_FLAGB_ACTIVE)
72 struct MasterBootRecord {
73 UBYTE mbr_pad0[446];
74 struct PartitionEntry mbr_Partition[4];
75 UBYTE mbr_Signature[2];
78 #define MBR_SIGNATURE 0x55aa
80 struct FATSuperBlock
82 UBYTE fsb_Jump[3]; // 0000
83 UBYTE fsb_Vendor[8]; // 0003
84 UBYTE fsb_BytesPerSector[2]; // 000B
85 UBYTE fsb_SectorsPerCluster; // 000D
86 UBYTE fsb_ReservedSectors[2]; // 000E
87 UBYTE fsb_NumberFATs; // 0010
88 UBYTE fsb_NumberRootEntries[2]; // 0011
89 UBYTE fsb_SectorsPerVolume[2]; // 0013
90 UBYTE fsb_MediaDescriptor; // 0015
91 UBYTE fsb_SectorsPerFAT[2]; // 0016
92 UBYTE fsb_SectorsPerTrack[2]; // 0018
93 UBYTE fsb_Heads[2]; // 001A
94 UBYTE fsb_FirstVolumeSector[2]; // 001C
95 UBYTE fsb_pad0[13]; // 001E
96 UBYTE fsb_Label[11]; // 002B
97 UBYTE fsb_FileSystem[8]; // 0036
98 UBYTE fsb_pad1[9]; // 003E
99 UBYTE fsb_Label2[11]; // 0047
100 UBYTE fsb_FileSystem2[8]; // 0052
101 UBYTE fsb_BootCode[512 - 90]; // 005A
104 #if defined(__GNUC__)
105 # pragma pack()
106 #endif
108 struct RigidDisk
110 struct RigidDiskBlock rdsk_RDB;
111 struct PartitionBlock rdsk_PART;
112 struct FileSysHeaderBlock rdsk_FSHD;
115 #define PFF_SINGLE_LUN 0x000001 /* allow access only to LUN 0 */
116 #define PFF_MODE_XLATE 0x000002 /* translate 6 byte commands to 10 byte commands */
117 #define PFF_EMUL_LARGE_BLK 0x000004 /* Emulate access on larger block sizes */
118 #define PFF_REM_SUPPORT 0x000010 /* extended removable support */
119 #define PFF_FIX_INQ36 0x000040 /* inquiry request needs fixing */
120 #define PFF_DELAY_DATA 0x000080 /* delay data phase */
121 #define PFF_SIMPLE_SCSI 0x000100 /* kill all complicated SCSI commands that might crash firmware */
122 #define PFF_NO_RESET 0x000200 /* do not perform initial bulk reset */
123 #define PFF_FAKE_INQUIRY 0x000400 /* filter inquiry and fake it */
124 #define PFF_FIX_CAPACITY 0x000800 /* fix capacity by one */
125 #define PFF_NO_FALLBACK 0x001000 /* don't fall back automatically */
126 #define PFF_CSS_BROKEN 0x002000 /* olympus command status signature fix */
127 #define PFF_CLEAR_EP 0x004000 /* clear endpoint halt */
128 #define PFF_DEBUG 0x008000 /* more debug output */
130 struct NepClassMS
132 struct Unit ncm_Unit; /* Unit structure */
133 struct NepClassMS *ncm_UnitLUN0; /* Head of list */
134 ULONG ncm_UnitNo; /* Unit number */
135 struct NepMSBase *ncm_ClsBase; /* Up linkage */
136 struct NepMSDevBase *ncm_DevBase; /* Device base */
137 struct Library *ncm_Base; /* Poseidon base */
138 struct PsdDevice *ncm_Device; /* Up linkage */
139 struct PsdConfig *ncm_Config; /* Up linkage */
140 struct PsdInterface *ncm_Interface; /* Up linkage */
141 struct Task *ncm_ReadySigTask; /* Task to send ready signal to */
142 LONG ncm_ReadySignal; /* Signal to send when ready */
143 struct Task *ncm_Task; /* Subtask */
144 struct MsgPort *ncm_TaskMsgPort; /* Message Port of Subtask */
145 struct SignalSemaphore ncm_XFerLock; /* LUN allowed to talk to the device */
146 struct PsdPipe *ncm_EP0Pipe; /* Endpoint 0 pipe */
147 struct PsdEndpoint *ncm_EPOut; /* Endpoint OUT */
148 struct PsdPipe *ncm_EPOutPipe; /* Endpoint OUT pipe */
149 struct PsdEndpoint *ncm_EPIn; /* Endpoint IN */
150 struct PsdPipe *ncm_EPInPipe; /* Endpoint IN pipe */
151 struct PsdEndpoint *ncm_EPInt; /* Optional Endpoint INT */
152 struct PsdPipe *ncm_EPIntPipe; /* Optional Endpoint INT pipe */
153 UWORD ncm_EPOutNum; /* Endpoint OUT number */
154 UWORD ncm_EPInNum; /* Endpoint IN number */
155 UWORD ncm_EPIntNum; /* Endpoint INT number */
156 struct MsgPort *ncm_DevMsgPort; /* Message Port for IOParReq */
157 UWORD ncm_UnitProdID; /* ProductID of unit */
158 UWORD ncm_UnitVendorID; /* VendorID of unit */
159 UWORD ncm_UnitIfNum; /* Interface number */
160 UWORD ncm_UnitLUN; /* LUN */
161 UWORD ncm_MaxLUN; /* Number of LUNs */
162 BOOL ncm_DenyRequests; /* Device is gone! */
163 BOOL ncm_HasMounted; /* Has mounted some partitions */
164 BOOL ncm_UnitReady; /* Unit is ready */
165 ULONG ncm_ChangeCount; /* Number of disk changes */
166 ULONG ncm_LastChange; /* Change number last interrupt created */
167 struct List ncm_DCInts; /* DiskChange Interrupt IORequests */
168 ULONG ncm_BlockSize; /* BlockSize = 512 */
169 ULONG ncm_BlockShift; /* Log2 BlockSize */
170 BOOL ncm_WriteProtect; /* Is Disk write protected? */
171 BOOL ncm_Removable; /* Is disk removable? */
172 BOOL ncm_ForceRTCheck; /* Force removable task to be restarted */
173 UWORD ncm_DeviceType; /* Peripheral Device Type (from Inquiry data) */
174 UWORD ncm_TPType; /* Transport type */
175 UWORD ncm_CSType; /* SCSI Commandset type */
176 ULONG ncm_TagCount; /* Tag for CBW */
177 struct DriveGeometry ncm_Geometry; /* Drive Geometry */
178 ULONG ncm_GeoChangeCount; /* when did we last obtained the geometry for caching */
179 BOOL ncm_BulkResetBorks; /* Bulk Reset is broken, don't try to use it */
181 UBYTE *ncm_OneBlock; /* buffer for one block */
182 ULONG ncm_OneBlockSize; /* size of one block buffer */
184 STRPTR ncm_DevIDString; /* Device ID String */
185 STRPTR ncm_IfIDString; /* Interface ID String */
187 struct IOStdReq *ncm_XFerPending; /* XFer IORequest pending */
188 struct List ncm_XFerQueue; /* List of xfer requests */
190 char ncm_LUNIDStr[18];
191 char ncm_LUNNumStr[4];
192 UBYTE ncm_ModePageBuf[256];
193 UBYTE ncm_FATControlBSTR[68];
195 BOOL ncm_UsingDefaultCfg;
197 BOOL ncm_IOStarted; /* IO Running */
198 BOOL ncm_Running; /* Not suspended */
200 struct ClsDevCfg *ncm_CDC;
201 struct ClsUnitCfg *ncm_CUC;
203 struct Library *ncm_MUIBase; /* MUI master base */
204 struct Library *ncm_PsdBase; /* Poseidon base */
205 struct Library *ncm_IntBase; /* Intuition base */
206 struct Task *ncm_GUITask; /* GUI Task */
207 struct NepClassMS *ncm_GUIBinding; /* Window of binding that's open */
209 Object *ncm_App;
210 Object *ncm_MainWindow;
211 Object *ncm_NakTimeoutObj;
212 Object *ncm_SingleLunObj;
213 Object *ncm_FixInquiryObj;
214 Object *ncm_FakeInquiryObj;
215 Object *ncm_SimpleSCSIObj;
216 Object *ncm_XLate610Obj;
217 Object *ncm_CSSBrokenObj;
218 Object *ncm_EmulLargeBlkObj;
219 Object *ncm_FixCapacityObj;
220 Object *ncm_DebugObj;
221 Object *ncm_RemSupportObj;
222 Object *ncm_NoFallbackObj;
223 Object *ncm_MaxTransferObj;
224 Object *ncm_AutoDtxMaxTransObj;
225 Object *ncm_FatFSObj;
226 Object *ncm_FatDosTypeObj;
227 Object *ncm_FatControlObj;
228 Object *ncm_NTFSObj;
229 Object *ncm_NTFSDosTypeObj;
230 Object *ncm_NTFSControlObj;
231 Object *ncm_CDFSObj;
232 Object *ncm_CDDosTypeObj;
233 Object *ncm_CDControlObj;
234 Object *ncm_StartupDelayObj;
235 Object *ncm_InitialResetObj;
237 Object *ncm_LunGroupObj;
238 Object *ncm_LunLVObj;
239 Object *ncm_UnitObj;
240 Object *ncm_AutoMountFATObj;
241 Object *ncm_AutoMountCDObj;
242 Object *ncm_FatDOSNameObj;
243 Object *ncm_FatBuffersObj;
244 Object *ncm_MountAllFATObj;
245 Object *ncm_AutoMountRDBObj;
246 Object *ncm_BootRDBObj;
247 Object *ncm_UnmountObj;
249 Object *ncm_UseObj;
250 Object *ncm_SetDefaultObj;
251 Object *ncm_CloseObj;
253 Object *ncm_AboutMI;
254 Object *ncm_UseMI;
255 Object *ncm_SetDefaultMI;
256 Object *ncm_MUIPrefsMI;
258 struct Hook ncm_LUNListDisplayHook;
261 struct NepMSBase
263 struct Library nh_Library; /* standard */
264 UWORD nh_Flags; /* various flags */
266 struct Library *nh_UtilityBase; /* Utility base */
268 struct NepMSDevBase *nh_DevBase; /* base of device created */
269 struct List nh_Units; /* List of units available */
270 struct NepClassMS nh_DummyNCM; /* Dummy NCM for default config */
272 struct SignalSemaphore nh_TaskLock; /* single task monitor */
273 struct Task *nh_ReadySigTask; /* Task to send ready signal to */
274 LONG nh_ReadySignal; /* Signal to send when ready */
275 struct Task *nh_RemovableTask; /* Task for removable control */
276 struct MsgPort *nh_IOMsgPort; /* Port for local IO */
277 struct IOStdReq nh_IOReq; /* Fake IOReq */
278 struct Library *nh_ExpansionBase; /* ExpansionBase */
279 struct Library *nh_PartitionBase; /* PartitionBase */
280 struct Library *nh_PsdBase; /* PsdBase */
281 struct Library *nh_DOSBase; /* DOS base */
282 struct MsgPort *nh_TimerMsgPort; /* Port for timer.device */
283 struct timerequest *nh_TimerIOReq; /* Timer IO Request */
284 BOOL nh_RestartIt; /* Restart removable task? */
285 struct RigidDisk nh_RDsk; /* RigidDisk */
286 UBYTE *nh_OneBlock; /* buffer for one block */
287 ULONG nh_OneBlockSize; /* size of one block buffer */
291 struct NepMSDevBase
293 struct Library np_Library; /* standard */
294 UWORD np_Flags; /* various flags */
296 BPTR np_SegList; /* device seglist */
297 struct NepMSBase *np_ClsBase; /* pointer to class base */
298 struct Library *np_UtilityBase; /* cached utilitybase */
301 #endif /* MASSSTORAGE_H */