Skip to content

Commit ad46e3c

Browse files
committed
sdpin + rominit + format + fat
1 parent 3536764 commit ad46e3c

File tree

19 files changed

+84
-110
lines changed

19 files changed

+84
-110
lines changed

arch/m68k-amiga/boot/rom_init.S

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -97,35 +97,10 @@ arosbootstrap_init:
9797
/* set AttnFlags AFB_ADDR32 */
9898
or.w #0x2000,%a4@(2)
9999

100-
#if VAMPIRECARDSERIES==4
101-
//V4 version
102100
move.l #0x01800000,%a0 // Reserve 8MB for ApolloFloppy
103-
move.l #0x40000000,%a1 // SA 1Gb
101+
move.l #0x80000000,%a1 // UniCorn 2Gb
104102
move.l #0x00100000,%d0
105103
jsr __MemoryTest
106-
#else
107-
108-
#if VAMPIRECARDSERIES==8
109-
//V4 version
110-
move.l #0x01800000,%a0 // Reserve 8MB for ApolloFloppy
111-
move.l #0x80000000,%a1 // UniCorn 2Gb
112-
move.l #0x00100000,%d0
113-
jsr __MemoryTest
114-
115-
#else
116-
move.l #0x08000000,%a0
117-
move.l #0x20000000,%a1
118-
move.l #0x00100000,%d0
119-
jsr __MemoryTest
120-
121-
move.l #0x01000000,%a0
122-
move.l #0x08000000,%a1
123-
move.l #0x00100000,%d0
124-
jsr __MemoryTest
125-
#endif
126-
127-
#endif
128-
129104

130105
/* Memory region array is put into the
131106
* system stack from the bottom up, so

arch/m68k-amiga/boot/romlog.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
Idx Name Size VMA LMA File off Algn
2-
0 .rom 0007e76c 00f80000 00f80000 00080000 2**2
3-
1 .ext 0007dd7e 00e00000 00e00000 00002000 2**2
2+
0 .rom 0007e770 00f80000 00f80000 00082000 2**2
3+
1 .ext 0007e966 00e00000 00e00000 00002000 2**2

arch/m68k-amiga/devs/sagasd/sagasd_device.c

Lines changed: 51 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -746,10 +746,12 @@ static void SAGASD_IOTask(struct Library *SysBase)
746746
ULONG sigset;
747747
struct Message status;
748748
BOOL present;
749-
BOOL sdpin = FALSE;
750-
ULONG detectcounter = 0;
751749

752-
if (sdu->sdu_SDCmd.unitnumber > 0) sdpin = TRUE; //hardware pin enable for SD-Cards Slots #1 and higher
750+
BOOL sdpin = TRUE;
751+
752+
//sdpin = apolloreadbios(APOLLO_SDHWPIN);
753+
754+
ULONG detectcounter = 0;
753755

754756
debug("Starting SAGASD_IOTask");
755757

@@ -778,24 +780,30 @@ static void SAGASD_IOTask(struct Library *SysBase)
778780
sdu->sdu_MsgPort = status.mn_ReplyPort;
779781

780782
/* Update status for the boot node */
781-
782-
present = sdcmd_sw_detect_full(&sdu->sdu_SDCmd);
783+
if (sdpin)
784+
{
785+
present = sdcmd_hw_detect(&sdu->sdu_SDCmd);
786+
} else {
787+
Forbid();
788+
present = sdcmd_sw_detect_full(&sdu->sdu_SDCmd); // In sdu_Present == FALSE mode we need a full software detect
789+
Permit();
790+
}
783791
sdu->sdu_ChangeNum++;
784792
if (present)
785793
{
786-
//Forbid();
794+
if (sdpin) present = sdcmd_sw_detect_full(&sdu->sdu_SDCmd);
795+
Forbid();
787796
sdu->sdu_Present = TRUE;
788-
789797
sdu->sdu_Valid = present;
790-
debug("\t sdu_Valid: %s", sdu->sdu_Valid ? "TRUE" : "FALSE");
791-
debug("\t Blocks: %ld", sdu->sdu_SDCmd.info.blocks);
792-
//Permit();
798+
Permit();
793799
} else {
794-
//Forbid();
800+
Forbid();
795801
sdu->sdu_Present = FALSE;
796802
sdu->sdu_Valid = FALSE;
797-
//Permit();
803+
Permit();
798804
}
805+
debug("\t sdu_Valid: %s", sdu->sdu_Valid ? "TRUE" : "FALSE");
806+
debug("\t Blocks: %ld", sdu->sdu_SDCmd.info.blocks);
799807

800808
/* Send the 'I'm Ready' message */
801809
//debug("sdu_MsgPort=%p", sdu->sdu_MsgPort);
@@ -807,21 +815,17 @@ static void SAGASD_IOTask(struct Library *SysBase)
807815
WaitPort(status.mn_ReplyPort);
808816
GetMsg(status.mn_ReplyPort);
809817
}
810-
//debug("");
811818

812819
if (status.mn_Length)
813820
{
814-
/* There was an error... */
815821
DeleteMsgPort(mport);
816-
//debug("");
817822
return;
818823
}
819824

820-
//debug("");
821825
mport = sdu->sdu_MsgPort;
822-
823826
sigset = (1 << tport->mp_SigBit) | (1 << mport->mp_SigBit);
824827

828+
// SAGA-SD LOOP =============================================================================================================
825829
for (;;)
826830
{
827831
struct IORequest *io;
@@ -852,64 +856,60 @@ static void SAGASD_IOTask(struct Library *SysBase)
852856
io = NULL;
853857

854858
if(detectcounter++ == 10)
855-
{
859+
{
856860
if (!sdu->sdu_Present)
857861
{
858-
present = sdcmd_hw_detect(&sdu->sdu_SDCmd); // First we try hw detect
859-
if(present)
862+
if (sdpin)
860863
{
861-
sdpin = TRUE; // If hw detect reports TRUE, so we know now that SD pin works
862-
debug("SD-Card Quick HW Detection: unit = %d | sdu_Present = %s | detect = %s",
863-
sdu->sdu_SDCmd.unitnumber, sdu->sdu_Present ? "TRUE":"FALSE", present ? "TRUE":"FALSE");
864-
present = sdcmd_sw_detect_full(&sdu->sdu_SDCmd);
864+
present = sdcmd_hw_detect(&sdu->sdu_SDCmd);
865865
} else {
866-
if (!sdpin)
867-
{
868-
present = sdcmd_sw_detect_full(&sdu->sdu_SDCmd); // If hw detect reports FALSE we have to do a second sw detect for V4 without SD pin
869-
debug("SD-Card Full SW Detection: unit = %d | sdu_Present = %s | detect = %s",
870-
sdu->sdu_SDCmd.unitnumber, sdu->sdu_Present ? "TRUE":"FALSE", present ? "TRUE":"FALSE");
871-
}
866+
Forbid();
867+
present = sdcmd_sw_detect_full(&sdu->sdu_SDCmd); // In sdu_Present == FALSE mode we need a full software detect
868+
Permit();
872869
}
873870

874-
if (present) // SD-Card is Inserted
871+
debug("SD-Card Change Detection: unit = %d | Detect Mode = %s | sdu_Present = %s | detect = %s",
872+
sdu->sdu_SDCmd.unitnumber, sdpin ? "HW":"SW", sdu->sdu_Present ? "TRUE":"FALSE", present ? "TRUE":"FALSE");
873+
874+
if (present)
875875
{
876-
//Forbid();
876+
// SD-Card is Inserted
877+
present = sdcmd_sw_detect_full(&sdu->sdu_SDCmd);
878+
Forbid();
877879
sdu->sdu_Present = TRUE;
878880
sdu->sdu_ChangeNum++;
879881
sdu->sdu_Valid = TRUE;
880-
//debug("\t sdu_Valid: %s", sdu->sdu_Valid ? "TRUE" : "FALSE");
881-
//debug("\t Blocks: %ld", sdu->sdu_SDCmd.info.blocks);
882+
debug("\t sdu_Valid: %s", sdu->sdu_Valid ? "TRUE" : "FALSE");
883+
debug("\t Blocks: %ld", sdu->sdu_SDCmd.info.blocks);
882884

883885
for (int i=sdu->sdu_AddChangeListItems; i>0; i--)
884886
{
885887
if (sdu->sdu_AddChangeList[i])
886888
{
887889
io_int = (struct Interrupt*)sdu->sdu_AddChangeList[i];
888-
889-
debug("SD-Card INSERT = Calling sdu->sdu_AddChangeList[%d] (%x) from %s for %s", i,
890-
sdu->sdu_AddChangeList[i], (char*)io_int->is_Node.ln_Name, sdu->sdu_Name);
891-
890+
debug("SD-Card INSERT = Calling sdu->sdu_AddChangeList[%d] (%x) from %s for %s", i, sdu->sdu_AddChangeList[i], (char*)io_int->is_Node.ln_Name, sdu->sdu_Name);
892891
Cause((struct Interrupt *)(sdu->sdu_AddChangeList[i]));
893-
894892
}
895893
}
896-
//Permit();
894+
Permit();
897895
}
898896
} else {
899897
if (sdpin)
900898
{
901-
present = sdcmd_hw_detect(&sdu->sdu_SDCmd);
902-
debug("SD-Card Quick HW Detection: unit = %d | sdu_Present = %s | detect = %s",
903-
sdu->sdu_SDCmd.unitnumber, sdu->sdu_Present ? "TRUE":"FALSE", present ? "TRUE":"FALSE");
899+
present = sdcmd_hw_detect(&sdu->sdu_SDCmd);
904900
} else {
905-
present = sdcmd_sw_detect_quick(&sdu->sdu_SDCmd); // We can do a "light" detect when in sdu_Present mode
906-
debug("SD-Card Quick SW Detection: unit = %d | sdu_Present = %s | detect = %s",
907-
sdu->sdu_SDCmd.unitnumber, sdu->sdu_Present ? "TRUE":"FALSE", present ? "TRUE":"FALSE");
901+
Forbid();
902+
present = sdcmd_sw_detect_quick(&sdu->sdu_SDCmd); // In sdu_Present == TRUE mode we can do a quick software detect
903+
Permit();
908904
}
909-
910-
if (!present) // SD-Card is Removed
905+
906+
debug("SD-Card Change Detection: unit = %d | Detect Mode = %s | sdu_Present = %s | detect = %s",
907+
sdu->sdu_SDCmd.unitnumber, sdpin ? "HW":"SW", sdu->sdu_Present ? "TRUE":"FALSE", present ? "TRUE":"FALSE");
908+
909+
if (!present)
911910
{
912-
//Forbid();
911+
// SD-Card is Removed
912+
Forbid();
913913
sdu->sdu_Present = FALSE;
914914
sdu->sdu_Valid = FALSE;
915915

@@ -919,8 +919,7 @@ static void SAGASD_IOTask(struct Library *SysBase)
919919
{
920920
io_int = (struct Interrupt*)sdu->sdu_AddChangeList[i];
921921

922-
debug("SD-Card EJECT = Calling sdu->sdu_AddChangeList[%d] (%x) from %s for %s", i,
923-
sdu->sdu_AddChangeList[i], (char*)io_int->is_Node.ln_Name, sdu->sdu_Name);
922+
debug("SD-Card EJECT = Calling sdu->sdu_AddChangeList[%d] (%x) from %s for %s", i, sdu->sdu_AddChangeList[i], (char*)io_int->is_Node.ln_Name, sdu->sdu_Name);
924923

925924
Cause((struct Interrupt *)(sdu->sdu_AddChangeList[i]));
926925

@@ -932,10 +931,9 @@ static void SAGASD_IOTask(struct Library *SysBase)
932931
}
933932
}
934933
}
935-
//Permit();
934+
Permit();
936935
}
937936
}
938-
939937
detectcounter = 0;
940938
}
941939
}

rom/devs/ata/scsiemu.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static ULONG rw(UBYTE *p)
4545

4646
static UBYTE scsi_read32(struct ata_Unit *unit, APTR data, ULONG offset, ULONG len, ULONG *outlen)
4747
{
48-
bug("[SCSI] scsi_read32\n");
48+
//bug"[SCSI] scsi_read32\n");
4949

5050
UBYTE io_Error = 0;
5151
if ((unit->au_SectorShift == 9) && ((unit->au_XferModes & AF_XFER_PACKET)==0)) /* use cache with 512 Byte sectors only */
@@ -110,7 +110,7 @@ static UBYTE scsi_read32(struct ata_Unit *unit, APTR data, ULONG offset, ULONG l
110110

111111
static UBYTE scsi_write32(struct ata_Unit *unit, APTR data, ULONG offset, ULONG len, ULONG *outlen)
112112
{
113-
bug("[SCSI] scsi_write32\n");
113+
//bug"[SCSI] scsi_write32\n");
114114

115115
UBYTE err;
116116

@@ -134,7 +134,7 @@ static UBYTE scsi_write32(struct ata_Unit *unit, APTR data, ULONG offset, ULONG
134134

135135
static UBYTE scsi_inquiry(struct ata_Unit *unit, struct SCSICmd *cmd, ULONG *outlen)
136136
{
137-
bug("[SCSI] scsi_inquiry\n");
137+
//bug"[SCSI] scsi_inquiry\n");
138138

139139
struct Library *UtilityBase = unit->au_Bus->ab_Base->ata_UtilityBase;
140140
UBYTE *cmdbuf = cmd->scsi_Command;
@@ -162,7 +162,7 @@ static UBYTE scsi_inquiry(struct ata_Unit *unit, struct SCSICmd *cmd, ULONG *out
162162

163163
static UBYTE scsi_modesense(struct ata_Unit *unit, struct SCSICmd *cmd, ULONG *outlen)
164164
{
165-
bug("[SCSI] scsi_modesense\n");
165+
//bug"[SCSI] scsi_modesense\n");
166166

167167
UBYTE *cmdbuf = cmd->scsi_Command;
168168
UBYTE *out = (UBYTE*)cmd->scsi_Data;
@@ -218,7 +218,7 @@ static UBYTE scsi_modesense(struct ata_Unit *unit, struct SCSICmd *cmd, ULONG *o
218218

219219
static UBYTE scsi_readcapacity(struct ata_Unit *unit, struct SCSICmd *cmd, ULONG *outlen)
220220
{
221-
bug("[SCSI] scsi_readcapacity\n");
221+
//bug"[SCSI] scsi_readcapacity\n");
222222

223223
UBYTE *cmdbuf = cmd->scsi_Command;
224224
UBYTE *out = (UBYTE*)cmd->scsi_Data;
@@ -247,7 +247,7 @@ static UBYTE scsi_readcapacity(struct ata_Unit *unit, struct SCSICmd *cmd, ULONG
247247

248248
BYTE SCSIEmu(struct ata_Unit *unit, struct SCSICmd *cmd)
249249
{
250-
bug("[SCSI] SCSIEmu\n");
250+
//bug"[SCSI] SCSIEmu\n");
251251

252252
struct Library *UtilityBase = unit->au_Bus->ab_Base->ata_UtilityBase;
253253
ULONG len, offset;
@@ -259,7 +259,7 @@ BYTE SCSIEmu(struct ata_Unit *unit, struct SCSICmd *cmd)
259259
UWORD senselen;
260260
UBYTE err, status;
261261

262-
bug("SCSIEMU CMD=%02x\n", cmdbuf[0]);
262+
//bug"SCSIEMU CMD=%02x\n", cmdbuf[0]);
263263
err = 0;
264264
status = 0;
265265
scsi_len = 0;

rom/filesys/fat/volume.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,7 @@ void DoDiskInsert(struct Globals *glob)
10661066
//LBA = Surfaces * BlocksPerTrack * Cylinders or Cylinders = LBA / Surfaces / BlocksPerTrack
10671067
//In most cases the default values of Surfaces = 16 and BlocksPerTrack = 64 will work, but for smaller SD this may fail because Cylinder must be an integer and >0
10681068

1069-
if (MDB_PART1_STATUS == 0x00)
1069+
if (MDB_PART1_STATUS == 0x00 || MDB_PART1_STATUS == 0x80)
10701070
{
10711071
D(bug("[FAT] Valid First Partition Found\n"));
10721072
if ((MDB_PART1_START % de->de_BlocksPerTrack % de->de_Surfaces) == 0)

rom/hidds/pci/pcitool/strings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/****************************************************************
22
This file was created automatically by `FlexCat 2.19'
3-
from "/home/willem/ApolloOS/rom/hidds/pci/pcitool/catalogs/pcitool.cd".
3+
from "/home/willem/ApolloTeam/ApolloOS/rom/hidds/pci/pcitool/catalogs/pcitool.cd".
44
55
Do NOT edit by hand!
66
****************************************************************/

workbench/c/R/strings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/****************************************************************
22
This file was created automatically by `FlexCat 2.19'
3-
from "/home/willem/ApolloOS/workbench/c/R/catalogs/R.cd".
3+
from "/home/willem/ApolloTeam/ApolloOS/workbench/c/R/catalogs/R.cd".
44
55
Do NOT edit by hand!
66
****************************************************************/

workbench/devs/diskimage/device/strings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/****************************************************************
22
This file was created automatically by `FlexCat 2.19'
3-
from "/home/willem/ApolloOS/workbench/devs/diskimage/device/catalogs/diskimagedevice.cd".
3+
from "/home/willem/ApolloTeam/ApolloOS/workbench/devs/diskimage/device/catalogs/diskimagedevice.cd".
44
55
Do NOT edit by hand!
66
****************************************************************/

workbench/devs/diskimage/zune_gui/strings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/****************************************************************
22
This file was created automatically by `FlexCat 2.19'
3-
from "/home/willem/ApolloOS/workbench/devs/diskimage/zune_gui/catalogs/diskimagegui.cd".
3+
from "/home/willem/ApolloTeam/ApolloOS/workbench/devs/diskimage/zune_gui/catalogs/diskimagegui.cd".
44
55
Do NOT edit by hand!
66
****************************************************************/

workbench/libs/muimaster/muimaster_strings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/****************************************************************
22
This file was created automatically by `FlexCat 2.19'
3-
from "/home/willem/ApolloOS/workbench/libs/muimaster/catalogs/muimaster.cd".
3+
from "/home/willem/ApolloTeam/ApolloOS/workbench/libs/muimaster/catalogs/muimaster.cd".
44
55
Do NOT edit by hand!
66
****************************************************************/

0 commit comments

Comments
 (0)