2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
6 #include <devices/trackdisk.h>
8 #include <prefs/trackdisk.h>
9 #include <utility/tagitem.h>
10 #include <proto/dos.h>
11 #include <proto/exec.h>
14 #include "trackdiskprefs.h"
16 struct td_UnitPrefs TDPrefs
[TD_NUMUNITS
];
17 struct IORequest TDIO
;
25 cf
= Open(TRACKDISK_PREFS_NAME
, MODE_OLDFILE
);
28 while (FRead(cf
, &PrefsBuf
, sizeof(PrefsBuf
), 1)) {
30 if (PrefsBuf
[0] == TDPR_UnitNum
)
33 if (Unit
< TD_NUMUNITS
) {
37 TDPrefs
[Unit
].PubFlags
= PrefsBuf
[1];
40 TDPrefs
[Unit
].RetryCnt
= PrefsBuf
[1];
45 if (PrefsBuf
[0] == TAG_DONE
)
52 void ReadTDPrefs(void)
55 struct TDU_PublicUnit
*tdu
;
57 if (FindResident(TD_NAME
)) {
58 for (i
= 0; i
< TD_NUMUNITS
; i
++) {
59 TDPrefs
[i
].PubFlags
= 0;
60 TDPrefs
[i
].RetryCnt
= 3;
63 for (i
= 0; i
< TD_NUMUNITS
; i
++) {
64 if (!OpenDevice(TD_NAME
, i
, &TDIO
, 0)) {
65 tdu
= (struct TDU_PublicUnit
*)TDIO
.io_Unit
;
66 tdu
->tdu_PubFlags
= TDPrefs
[i
].PubFlags
;
67 tdu
->tdu_RetryCnt
= TDPrefs
[i
].RetryCnt
;