Forráskód Böngészése

Fixed input pins ports due to use of multipel ports

Per Mårtensson 3 éve
szülő
commit
0dc3368681
1 módosított fájl, 3 hozzáadás és 5 törlés
  1. 3 5
      sw/include/blacksasi.h

+ 3 - 5
sw/include/blacksasi.h

@@ -103,8 +103,7 @@
 
 // Virtual pin decoding
 #define GPIOREG(VPIN)     ((VPIN) >= 16 ? ((VPIN) >= 32 ? ((VPIN) >= 48 ? ((VPIN) >= 48 ? PEREG : PDREG) : PCREG) : PBREG) : PAREG)
-//BLACKSASI need to be fixed
-#define BITMASK(VPIN)     (1 << ((VPIN) & 15))
+#define BITMASK(VPIN)     (1 << ((VPIN % 16) & 15))
 
 #define vATN       PB(14)     // SCSI:ATN
 #define vBSY       PB(6)      // SCSI:BSY
@@ -121,12 +120,11 @@
 #define vTAD       PC(2)      // SCSI:TAD
 #define vTRANS_OE  PB(12)     // SCSI:TRANS_OE
 // SCSI output pin control: opendrain active LOW (direct pin drive)
-//BLACKSASI need to be fixed
 #define SCSI_OUT(VPIN,ACTIVE) { GPIOREG(VPIN)->BSRR = BITMASK(VPIN) << ((ACTIVE) ? 16 : 0); }
 
 // SCSI input pin check (inactive=0,active=1)
-//BLACKSASI need to be fixed
-#define SCSI_IN(VPIN) ((~GPIOREG(VPIN)->IDR >> (VPIN & 15)) & 1)
+//BLACKSASI need to be checked
+#define SCSI_IN(VPIN) ((~GPIOREG(VPIN)->IDR >> ((VPIN % 16) & 15)) & 1)
 
 // HDDiamge file
 #define HDIMG_ID_POS  2                 // Position to embed ID number