@@ -236,9 +236,9 @@ static LONG SAGASD_PerformSCSI(struct IORequest *io)
236236            default :
237237                    if  (i  >= 8  &&  i  <  36 )
238238                    {
239-                         if  (sdu -> sdu_SDCmd .unitnumber  ==  1 ) val  =  "Apollo  SD-Card Slot #1     " [i  -  8 ];
240-                         if  (sdu -> sdu_SDCmd .unitnumber  ==  2 ) val  =  "Apollo  SD-Card Slot #2     " [i  -  8 ];
241-                         if  (sdu -> sdu_SDCmd .unitnumber  ==  3 ) val  =  "Apollo  SD-Card Slot #3     " [i  -  8 ];
239+                         if  (sdu -> sdu_SDCmd .unitnumber  ==  0 ) val  =  "Apollo  SD-Card Slot #1     " [i  -  8 ];
240+                         if  (sdu -> sdu_SDCmd .unitnumber  ==  1 ) val  =  "Apollo  SD-Card Slot #2     " [i  -  8 ];
241+                         if  (sdu -> sdu_SDCmd .unitnumber  ==  2 ) val  =  "Apollo  SD-Card Slot #3     " [i  -  8 ];
242242                    } else  {
243243                        if  (i  >= 36  &&  i  <  44 )
244244                        {
@@ -593,7 +593,7 @@ static LONG SAGASD_PerformIO(struct IORequest *io)
593593            sprintf (message ,"Inserted SD-Card in Slot#%d contains a RDB Boot Record\n" 
594594                "Only FAT File System is supported for hot-swap Disks\n" 
595595                "For RDB Disks with OFS, FFS, SFS or PFS File Systems\n" 
596-                 "Please Reboot ApolloOS with Disk inserted to Mount" , sdu -> sdu_SDCmd .unitnumber );
596+                 "Please Reboot ApolloOS with Disk inserted to Mount" , sdu -> sdu_SDCmd .unitnumber + 1 );
597597            choices  =  "Reboot|Continue" ;
598598
599599            struct  IntuitionBase  * IntuitionBase ;
@@ -625,7 +625,7 @@ static LONG SAGASD_PerformIO(struct IORequest *io)
625625            sprintf (message ,"Inserted SD-Card in Slot#%d contains a MBR Boot Record\n" 
626626                "But the FAT File System is not readable/initialised\n" 
627627                "Please use HDToolBox to create one fullsize FAT partition\n" 
628-                 "After that use Format to initialize the FAT Partition" , sdu -> sdu_SDCmd .unitnumber );
628+                 "After that use Format to initialize the FAT Partition" , sdu -> sdu_SDCmd .unitnumber + 1 );
629629            choices  =  "Continue" ;
630630
631631            struct  IntuitionBase  * IntuitionBase ;
@@ -749,7 +749,7 @@ static void SAGASD_IOTask(struct Library *SysBase)
749749    BOOL  sdpin  =  FALSE;
750750    ULONG  detectcounter  =  0 ;
751751
752-     if  (sdu -> sdu_SDCmd .unitnumber  >  0 ) sdpin  =  TRUE;           //hardware pin enable for SD-Cards Slots #1 and higher 
752+     // if (sdu->sdu_SDCmd.unitnumber > 0) sdpin = TRUE;           //hardware pin enable for SD-Cards Slots #1 and higher
753753
754754    debug ("Starting SAGASD_IOTask" );
755755
@@ -859,14 +859,14 @@ static void SAGASD_IOTask(struct Library *SysBase)
859859                        if (present )                                 
860860                        {
861861                            sdpin  =  TRUE;                                               // If hw detect reports TRUE, so we know now that SD pin works    
862-                             if  ( sdu -> sdu_SDCmd . unitnumber   ==   2 )  debug ("SD-Card Quick HW Detection: unit = %d | sdu_Present = %s | detect = %s" ,
862+                             debug ("SD-Card Quick HW Detection: unit = %d | sdu_Present = %s | detect = %s" ,
863863                            sdu -> sdu_SDCmd .unitnumber , sdu -> sdu_Present  ? "TRUE" :"FALSE" , present  ? "TRUE" :"FALSE" );
864864                            present  =  sdcmd_sw_detect_full (& sdu -> sdu_SDCmd );                                          
865865                        } else  {
866866                            if  (!sdpin )
867867                            {
868868                                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-                                 if  ( sdu -> sdu_SDCmd . unitnumber   ==   2 )  debug ("SD-Card Full  SW Detection: unit = %d | sdu_Present = %s | detect = %s" ,
869+                                 debug ("SD-Card Full  SW Detection: unit = %d | sdu_Present = %s | detect = %s" ,
870870                                sdu -> sdu_SDCmd .unitnumber , sdu -> sdu_Present  ? "TRUE" :"FALSE" , present  ? "TRUE" :"FALSE" );
871871                            }
872872                        }
@@ -899,16 +899,14 @@ static void SAGASD_IOTask(struct Library *SysBase)
899899                        if  (sdpin )
900900                        {
901901                            present  =  sdcmd_hw_detect (& sdu -> sdu_SDCmd );
902-                             if  ( sdu -> sdu_SDCmd . unitnumber   ==   2 )  debug ("SD-Card Quick HW Detection: unit = %d | sdu_Present = %s | detect = %s" ,
902+                             debug ("SD-Card Quick HW Detection: unit = %d | sdu_Present = %s | detect = %s" ,
903903                            sdu -> sdu_SDCmd .unitnumber , sdu -> sdu_Present  ? "TRUE" :"FALSE" , present  ? "TRUE" :"FALSE" );
904904                        } else  {
905905                            present  =  sdcmd_sw_detect_quick (& sdu -> sdu_SDCmd );           // We can do a "light" detect when in sdu_Present mode 
906-                             if  ( sdu -> sdu_SDCmd . unitnumber   ==   2 )  debug ("SD-Card Quick SW Detection: unit = %d | sdu_Present = %s | detect = %s" ,
906+                             debug ("SD-Card Quick SW Detection: unit = %d | sdu_Present = %s | detect = %s" ,
907907                            sdu -> sdu_SDCmd .unitnumber , sdu -> sdu_Present  ? "TRUE" :"FALSE" , present  ? "TRUE" :"FALSE" );
908908                        }
909909
910- 
911- 
912910                        if  (!present )                                       // SD-Card is Removed 
913911                        {
914912                            //Forbid(); 
@@ -1081,14 +1079,14 @@ static void SAGASD_InitUnit(struct SAGASDBase * SAGASDBase, int id)
10811079        case  0 :                                             // SPI#1 | CS=0 | Micro-SD-Card slot (backside) 
10821080        sdu -> sdu_SDCmd .iobase  =  SAGA_SD_BASE_SPI1 ;
10831081        sdu -> sdu_SDCmd .cs  =  SAGA_SD_CTL_NCS ;   
1084-         sdu -> sdu_SDCmd .unitnumber  =  id + 1 ;    
1082+         sdu -> sdu_SDCmd .unitnumber  =  id ;    
10851083        sdu -> sdu_Enabled  =  TRUE;
10861084        break ;
10871085
10881086        case  1 :                                             // SPI#2 | CS=0 | SD-Card slot 1 (Expansion Port) 
10891087        sdu -> sdu_SDCmd .iobase   =  SAGA_SD_BASE_SPI2 ;
10901088        sdu -> sdu_SDCmd .cs  =  SAGA_CS_DRIVE0 ; 
1091-         sdu -> sdu_SDCmd .unitnumber  =  id + 1 ; 
1089+         sdu -> sdu_SDCmd .unitnumber  =  id ; 
10921090        sdu -> sdu_Enabled  =  TRUE;
10931091        break ;
10941092
0 commit comments