From 6f855715a17a0ae98f9a1d96adc9d00746236e54 Mon Sep 17 00:00:00 2001 From: Tony Kuker Date: Thu, 27 Oct 2022 21:32:23 -0500 Subject: [PATCH] remove old header files --- cpp/hal/gpiobus.cpp | 42 +++++++++++++++---------- cpp/hal/gpiobus.h | 59 ++++++++++++++++++++++------------- cpp/hal/gpiobus_aibom.h | 56 --------------------------------- cpp/hal/gpiobus_fullspec.h | 56 --------------------------------- cpp/hal/gpiobus_gamernium.h | 56 --------------------------------- cpp/hal/gpiobus_raspberry.cpp | 12 +++---- cpp/hal/gpiobus_standard.h | 56 --------------------------------- cpp/rascsi.cpp | 2 +- 8 files changed, 70 insertions(+), 269 deletions(-) delete mode 100644 cpp/hal/gpiobus_aibom.h delete mode 100644 cpp/hal/gpiobus_fullspec.h delete mode 100644 cpp/hal/gpiobus_gamernium.h delete mode 100644 cpp/hal/gpiobus_standard.h diff --git a/cpp/hal/gpiobus.cpp b/cpp/hal/gpiobus.cpp index 8c0461a6..ab49c0c9 100644 --- a/cpp/hal/gpiobus.cpp +++ b/cpp/hal/gpiobus.cpp @@ -24,17 +24,17 @@ #include #endif -#if defined CONNECT_TYPE_STANDARD -#include "hal/gpiobus_standard.h" -#elif defined CONNECT_TYPE_FULLSPEC -#include "hal/gpiobus_fullspec.h" -#elif defined CONNECT_TYPE_AIBOM -#include "hal/gpiobus_aibom.h" -#elif defined CONNECT_TYPE_GAMERNIUM -#include "hal/gpiobus_gamernium.h" -#else -#error Invalid connection type or none specified -#endif +// #if defined CONNECT_TYPE_STANDARD +// #include "hal/gpiobus_standard.h" +// #elif defined CONNECT_TYPE_FULLSPEC +// #include "hal/gpiobus_fullspec.h" +// #elif defined CONNECT_TYPE_AIBOM +// #include "hal/gpiobus_aibom.h" +// #elif defined CONNECT_TYPE_GAMERNIUM +// #include "hal/gpiobus_gamernium.h" +// #else +// #error Invalid connection type or none specified +// #endif //--------------------------------------------------------------------------- // @@ -638,7 +638,9 @@ int GPIOBUS::ReceiveHandShake(BYTE *buf, int count) } } else { // Get phase - uint32_t phase = Acquire() & GPIO_MCI; + // uint32_t phase = Acquire() & GPIO_MCI; + (void)Acquire(); + phase_t phase = GetPhase(); for (i = 0; i < count; i++) { // Wait for the REQ signal to be asserted @@ -650,7 +652,8 @@ int GPIOBUS::ReceiveHandShake(BYTE *buf, int count) } // Phase error - if ((signals & GPIO_MCI) != phase) { + (void)Acquire(); + if (GetPhase() != phase) { break; } @@ -675,7 +678,8 @@ int GPIOBUS::ReceiveHandShake(BYTE *buf, int count) } // Phase error - if ((signals & GPIO_MCI) != phase) { + (void)Acquire(); + if (GetPhase() != phase) { break; } @@ -748,7 +752,9 @@ int GPIOBUS::SendHandShake(BYTE *buf, int count, int delay_after_bytes) WaitSignal(board->pin_ack, board_type::gpio_high_low_e::GPIO_STATE_LOW); } else { // Get Phase - uint32_t phase = Acquire() & GPIO_MCI; + // uint32_t phase = Acquire() & GPIO_MCI; + (void)Acquire(); + phase_t phase = GetPhase(); for (i = 0; i < count; i++) { if (i == delay_after_bytes) { @@ -769,7 +775,8 @@ int GPIOBUS::SendHandShake(BYTE *buf, int count, int delay_after_bytes) } // Phase error - if ((signals & GPIO_MCI) != phase) { + Acquire(); + if (GetPhase() != phase) { break; } @@ -790,7 +797,8 @@ int GPIOBUS::SendHandShake(BYTE *buf, int count, int delay_after_bytes) } // Phase error - if ((signals & GPIO_MCI) != phase) { + Acquire(); + if (GetPhase() != phase) { break; } diff --git a/cpp/hal/gpiobus.h b/cpp/hal/gpiobus.h index d090ff18..56f80feb 100644 --- a/cpp/hal/gpiobus.h +++ b/cpp/hal/gpiobus.h @@ -11,8 +11,8 @@ #pragma once -#include "hal/board_type.h" #include "config.h" +#include "hal/board_type.h" #include "scsi.h" #include #include @@ -31,17 +31,17 @@ //#define CONNECT_TYPE_AIBOM // AIBOM version (positive logic, unique pin assignment) //#define CONNECT_TYPE_GAMERNIUM // GAMERnium.com version (standard logic, unique pin assignment) -#if defined CONNECT_TYPE_STANDARD -#include "hal/gpiobus_standard.h" -#elif defined CONNECT_TYPE_FULLSPEC -#include "hal/gpiobus_fullspec.h" -#elif defined CONNECT_TYPE_AIBOM -#include "hal/gpiobus_aibom.h" -#elif defined CONNECT_TYPE_GAMERNIUM -#include "hal/gpiobus_gamernium.h" -#else -#error Invalid connection type or none specified -#endif +// #if defined CONNECT_TYPE_STANDARD +// #include "hal/gpiobus_standard.h" +// #elif defined CONNECT_TYPE_FULLSPEC +// #include "hal/gpiobus_fullspec.h" +// #elif defined CONNECT_TYPE_AIBOM +// #include "hal/gpiobus_aibom.h" +// #elif defined CONNECT_TYPE_GAMERNIUM +// #include "hal/gpiobus_gamernium.h" +// #else +// #error Invalid connection type or none specified +// #endif #ifdef ENABLE_GPIO_TRACE #define GPIO_FUNCTION_TRACE LOGTRACE("%s", __PRETTY_FUNCTION__) @@ -125,10 +125,25 @@ using namespace std; // NOSONAR Not relevant for rascsi // //--------------------------------------------------------------------------- -#define ALL_SCSI_PINS \ - ((1 << PIN_DT0) | (1 << PIN_DT1) | (1 << PIN_DT2) | (1 << PIN_DT3) | (1 << PIN_DT4) | (1 << PIN_DT5) | \ - (1 << PIN_DT6) | (1 << PIN_DT7) | (1 << PIN_DP) | (1 << PIN_ATN) | (1 << PIN_RST) | (1 << PIN_ACK) | \ - (1 << PIN_REQ) | (1 << PIN_MSG) | (1 << PIN_CD) | (1 << PIN_IO) | (1 << PIN_BSY) | (1 << PIN_SEL)) +#define ALL_SCSI_PINS \ + ((1 << phys_to_gpio_map.at(board->pin_dt0))) | \ + ((1 << phys_to_gpio_map.at(board->pin_dt1))) | \ + ((1 << phys_to_gpio_map.at(board->pin_dt2))) | \ + ((1 << phys_to_gpio_map.at(board->pin_dt3))) | \ + ((1 << phys_to_gpio_map.at(board->pin_dt4))) | \ + ((1 << phys_to_gpio_map.at(board->pin_dt5))) | \ + ((1 << phys_to_gpio_map.at(board->pin_dt6))) | \ + ((1 << phys_to_gpio_map.at(board->pin_dt7))) | \ + ((1 << phys_to_gpio_map.at(board->pin_dp))) | \ + ((1 << phys_to_gpio_map.at(board->pin_atn))) | \ + ((1 << phys_to_gpio_map.at(board->pin_rst))) | \ + ((1 << phys_to_gpio_map.at(board->pin_ack))) | \ + ((1 << phys_to_gpio_map.at(board->pin_req))) | \ + ((1 << phys_to_gpio_map.at(board->pin_msg))) | \ + ((1 << phys_to_gpio_map.at(board->pin_cd))) | \ + ((1 << phys_to_gpio_map.at(board->pin_io))) | \ + ((1 << phys_to_gpio_map.at(board->pin_bsy)) | \ + ((1 << phys_to_gpio_map.at(board->pin_sel))) //--------------------------------------------------------------------------- // @@ -196,9 +211,9 @@ const static int IRPT_DIS_IRQ_B = 9; const static int QA7_CORE0_TINTC = 16; const static int GPIO_IRQ = (32 + 20); // GPIO3 -#define GPIO_INEDGE ((1 << PIN_BSY) | (1 << PIN_SEL) | (1 << PIN_ATN) | (1 << PIN_ACK) | (1 << PIN_RST)) +// #define GPIO_INEDGE ((1 << PIN_BSY) | (1 << PIN_SEL) | (1 << PIN_ATN) | (1 << PIN_ACK) | (1 << PIN_RST)) -#define GPIO_MCI ((1 << PIN_MSG) | (1 << PIN_CD) | (1 << PIN_IO)) +// #define GPIO_MCI ((1 << PIN_MSG) | (1 << PIN_CD) | (1 << PIN_IO)) //--------------------------------------------------------------------------- // @@ -247,8 +262,8 @@ class GPIOBUS : public BUS GPIOBUS() = default; ~GPIOBUS() override = default; // Destructor - bool Init(mode_e mode = mode_e::TARGET, board_type::rascsi_board_type_e - rascsi_type = board_type::rascsi_board_type_e::BOARD_TYPE_FULLSPEC) override; + bool Init(mode_e mode = mode_e::TARGET, board_type::rascsi_board_type_e rascsi_type = + board_type::rascsi_board_type_e::BOARD_TYPE_FULLSPEC) override; // Initialization void Reset() override; // Reset @@ -318,11 +333,13 @@ class GPIOBUS : public BUS int SendHandShake(BYTE *buf, int count, int delay_after_bytes) override; // Data transmission handshake - static BUS::phase_t GetPhaseRaw(uint32_t raw_data); // Get the phase based on raw data + static BUS::phase_t GetPhaseRaw(uint32_t raw_data); static int GetCommandByteCount(BYTE opcode); + const string GetConnectDesc(){return board->connect_desc;} + #ifdef USE_SEL_EVENT_ENABLE // SEL signal interrupt bool PollSelectEvent(); diff --git a/cpp/hal/gpiobus_aibom.h b/cpp/hal/gpiobus_aibom.h deleted file mode 100644 index 49aaba66..00000000 --- a/cpp/hal/gpiobus_aibom.h +++ /dev/null @@ -1,56 +0,0 @@ -//--------------------------------------------------------------------------- -// -// SCSI Target Emulator RaSCSI Reloaded -// for Raspberry Pi -// -// Powered by XM6 TypeG Technology. -// Copyright (C) 2016-2020 GIMONS -// -//--------------------------------------------------------------------------- - -#pragma once - -#include - -// -// RaSCSI Adapter Aibom version -// - -const std::string CONNECT_DESC = "AIBOM PRODUCTS version"; // Startup message - -// Select signal control mode -const static int SIGNAL_CONTROL_MODE = 2; // SCSI positive logic specification - -// Control signal output logic -#define ACT_ON board_type::gpio_high_low_e::GPIO_STATE_HIGH // ACTIVE SIGNAL ON -#define ENB_ON board_type::gpio_high_low_e::GPIO_STATE_HIGH // ENABLE SIGNAL ON -#define IND_IN RASCSI_PIN_OFF // INITIATOR SIGNAL INPUT -#define TAD_IN RASCSI_PIN_OFF // TARGET SIGNAL INPUT -#define DTD_IN RASCSI_PIN_OFF // DATA SIGNAL INPUT - -// Control signal pin assignment (-1 means no control) -const static int PIN_ACT = 4; // ACTIVE -const static int PIN_ENB = 17; // ENABLE -const static int PIN_IND = 27; // INITIATOR CTRL DIRECTION -const static int PIN_TAD = -1; // TARGET CTRL DIRECTION -const static int PIN_DTD = 18; // DATA DIRECTION - -// SCSI signal pin assignment -const static int PIN_DT0 = 6; // Data 0 -const static int PIN_DT1 = 12; // Data 1 -const static int PIN_DT2 = 13; // Data 2 -const static int PIN_DT3 = 16; // Data 3 -const static int PIN_DT4 = 19; // Data 4 -const static int PIN_DT5 = 20; // Data 5 -const static int PIN_DT6 = 26; // Data 6 -const static int PIN_DT7 = 21; // Data 7 -const static int PIN_DP = 5; // Data parity -const static int PIN_ATN = 22; // ATN -const static int PIN_RST = 25; // RST -const static int PIN_ACK = 10; // ACK -const static int PIN_REQ = 7; // REQ -const static int PIN_MSG = 9; // MSG -const static int PIN_CD = 11; // CD -const static int PIN_IO = 23; // IO -const static int PIN_BSY = 24; // BSY -const static int PIN_SEL = 8; // SEL diff --git a/cpp/hal/gpiobus_fullspec.h b/cpp/hal/gpiobus_fullspec.h deleted file mode 100644 index f57f2a1e..00000000 --- a/cpp/hal/gpiobus_fullspec.h +++ /dev/null @@ -1,56 +0,0 @@ -//--------------------------------------------------------------------------- -// -// SCSI Target Emulator RaSCSI Reloaded -// for Raspberry Pi -// -// Powered by XM6 TypeG Technology. -// Copyright (C) 2016-2020 GIMONS -// -//--------------------------------------------------------------------------- - -#pragma once - -#include - -// -// RaSCSI standard (SCSI logic, standard pin assignment) -// - -const std::string CONNECT_DESC = "FULLSPEC"; // Startup message - -// Select signal control mode -const static int SIGNAL_CONTROL_MODE = 0; // SCSI logical specification - -// Control signal pin assignment (-1 means no control) -const static int PIN_ACT = 4; // ACTIVE -const static int PIN_ENB = 5; // ENABLE -const static int PIN_IND = 6; // INITIATOR CTRL DIRECTION -const static int PIN_TAD = 7; // TARGET CTRL DIRECTION -const static int PIN_DTD = 8; // DATA DIRECTION - -// Control signal output logic -#define ACT_ON board_type::gpio_high_low_e::GPIO_STATE_HIGH // ACTIVE SIGNAL ON -#define ENB_ON board_type::gpio_high_low_e::GPIO_STATE_HIGH // ENABLE SIGNAL ON -#define IND_IN board_type::gpio_high_low_e::GPIO_STATE_LOW // INITIATOR SIGNAL INPUT -#define TAD_IN board_type::gpio_high_low_e::GPIO_STATE_LOW // TARGET SIGNAL INPUT -#define DTD_IN board_type::gpio_high_low_e::GPIO_STATE_HIGH // DATA SIGNAL INPUT - -// SCSI signal pin assignment -const static int PIN_DT0 = 10; // Data 0 -const static int PIN_DT1 = 11; // Data 1 -const static int PIN_DT2 = 12; // Data 2 -const static int PIN_DT3 = 13; // Data 3 -const static int PIN_DT4 = 14; // Data 4 -const static int PIN_DT5 = 15; // Data 5 -const static int PIN_DT6 = 16; // Data 6 -const static int PIN_DT7 = 17; // Data 7 -const static int PIN_DP = 18; // Data parity -const static int PIN_ATN = 19; // ATN -const static int PIN_RST = 20; // RST -const static int PIN_ACK = 21; // ACK -const static int PIN_REQ = 22; // REQ -const static int PIN_MSG = 23; // MSG -const static int PIN_CD = 24; // CD -const static int PIN_IO = 25; // IO -const static int PIN_BSY = 26; // BSY -const static int PIN_SEL = 27; // SEL diff --git a/cpp/hal/gpiobus_gamernium.h b/cpp/hal/gpiobus_gamernium.h deleted file mode 100644 index 65536238..00000000 --- a/cpp/hal/gpiobus_gamernium.h +++ /dev/null @@ -1,56 +0,0 @@ -//--------------------------------------------------------------------------- -// -// SCSI Target Emulator RaSCSI Reloaded -// for Raspberry Pi -// -// Powered by XM6 TypeG Technology. -// Copyright (C) 2016-2020 GIMONS -// -//--------------------------------------------------------------------------- - -#pragma once - -#include - -// -// RaSCSI Adapter GAMERnium.com version -// - -const std::string CONNECT_DESC = "GAMERnium.com version"; // Startup message - -// Select signal control mode -const static int SIGNAL_CONTROL_MODE = 0; // SCSI logical specification - -// Control signal output logic -#define ACT_ON board_type::gpio_high_low_e::GPIO_STATE_HIGH // ACTIVE SIGNAL ON -#define ENB_ON board_type::gpio_high_low_e::GPIO_STATE_HIGH // ENABLE SIGNAL ON -#define IND_IN board_type::gpio_high_low_e::GPIO_STATE_LOW // INITIATOR SIGNAL INPUT -#define TAD_IN board_type::gpio_high_low_e::GPIO_STATE_LOW // TARGET SIGNAL INPUT -#define DTD_IN board_type::gpio_high_low_e::GPIO_STATE_HIGH // DATA SIGNAL INPUT - -// Control signal pin assignment (-1 means no control) -const static int PIN_ACT = 14; // ACTIVE -const static int PIN_ENB = 6; // ENABLE -const static int PIN_IND = 7; // INITIATOR CTRL DIRECTION -const static int PIN_TAD = 8; // TARGET CTRL DIRECTION -const static int PIN_DTD = 5; // DATA DIRECTION - -// SCSI signal pin assignment -const static int PIN_DT0 = 21; // Data 0 -const static int PIN_DT1 = 26; // Data 1 -const static int PIN_DT2 = 20; // Data 2 -const static int PIN_DT3 = 19; // Data 3 -const static int PIN_DT4 = 16; // Data 4 -const static int PIN_DT5 = 13; // Data 5 -const static int PIN_DT6 = 12; // Data 6 -const static int PIN_DT7 = 11; // Data 7 -const static int PIN_DP = 25; // Data parity -const static int PIN_ATN = 10; // ATN -const static int PIN_RST = 22; // RST -const static int PIN_ACK = 24; // ACK -const static int PIN_REQ = 15; // REQ -const static int PIN_MSG = 17; // MSG -const static int PIN_CD = 18; // CD -const static int PIN_IO = 4; // IO -const static int PIN_BSY = 27; // BSY -const static int PIN_SEL = 23; // SEL diff --git a/cpp/hal/gpiobus_raspberry.cpp b/cpp/hal/gpiobus_raspberry.cpp index a13834d9..45277d99 100644 --- a/cpp/hal/gpiobus_raspberry.cpp +++ b/cpp/hal/gpiobus_raspberry.cpp @@ -253,9 +253,9 @@ bool GPIOBUS_Raspberry::Init(mode_e mode, board_type::rascsi_board_type_e rascsi } // Event request setting - LOGTRACE("%s Event request setting (pin sel: %d)", __PRETTY_FUNCTION__, PIN_SEL); + LOGTRACE("%s Event request setting (pin sel: %d)", __PRETTY_FUNCTION__, phys_to_gpio_map.at(board->pin_sel)); strcpy(selevreq.consumer_label, "RaSCSI"); - selevreq.lineoffset = PIN_SEL; + selevreq.lineoffset = phys_to_gpio_map.at(board->pin_sel); selevreq.handleflags = GPIOHANDLE_REQUEST_INPUT; #if SIGNAL_CONTROL_MODE < 2 selevreq.eventflags = GPIOEVENT_REQUEST_FALLING_EDGE; @@ -293,14 +293,14 @@ bool GPIOBUS_Raspberry::Init(mode_e mode, board_type::rascsi_board_type_e rascsi // Edge detection setting if (board->signal_control_mode == 2) { // #if SIGNAL_CONTROL_MODE == 2 - gpio[GPIO_AREN_0] = 1 << PIN_SEL; + gpio[GPIO_AREN_0] = 1 << phys_to_gpio_map.at(board->pin_sel); } else { // #else - gpio[GPIO_AFEN_0] = 1 << PIN_SEL; + gpio[GPIO_AFEN_0] = 1 << phys_to_gpio_map.at(board->pin_sel); // #endif // SIGNAL_CONTROL_MODE } // Clear event - gpio[GPIO_EDS_0] = 1 << PIN_SEL; + gpio[GPIO_EDS_0] = 1 << phys_to_gpio_map.at(board->pin_sel); // Register interrupt handler setIrqFuncAddress(IrqHandler); @@ -348,7 +348,7 @@ bool GPIOBUS_Raspberry::Init(mode_e mode, board_type::rascsi_board_type_e rascsi // Finally, enable ENABLE LOGTRACE("%s Finally, enable ENABLE....", __PRETTY_FUNCTION__); // Show the user that this app is running - SetControl(board->pin_enb, ENB_ON); + SetControl(board->pin_enb, board->EnbOn()); return true; #endif // ifdef __x86_64__ || __X86__ diff --git a/cpp/hal/gpiobus_standard.h b/cpp/hal/gpiobus_standard.h deleted file mode 100644 index 23c92c32..00000000 --- a/cpp/hal/gpiobus_standard.h +++ /dev/null @@ -1,56 +0,0 @@ -//--------------------------------------------------------------------------- -// -// SCSI Target Emulator RaSCSI Reloaded -// for Raspberry Pi -// -// Powered by XM6 TypeG Technology. -// Copyright (C) 2016-2020 GIMONS -// -//--------------------------------------------------------------------------- - -#pragma once - -#include - -// -// RaSCSI standard (SCSI logic, standard pin assignment) -// - -const std::string CONNECT_DESC = "STANDARD"; // Startup message - -// Select signal control mode -const static int SIGNAL_CONTROL_MODE = 0; // SCSI logical specification - -// Control signal pin assignment (-1 means no control) -const static int PIN_ACT = 4; // ACTIVE -const static int PIN_ENB = 5; // ENABLE -const static int PIN_IND = -1; // INITIATOR CTRL DIRECTION -const static int PIN_TAD = -1; // TARGET CTRL DIRECTION -const static int PIN_DTD = -1; // DATA DIRECTION - -// Control signal output logic -#define ACT_ON board_type::gpio_high_low_e::GPIO_STATE_HIGH // ACTIVE SIGNAL ON -#define ENB_ON board_type::gpio_high_low_e::GPIO_STATE_HIGH // ENABLE SIGNAL ON -#define IND_IN board_type::gpio_high_low_e::GPIO_STATE_LOW // INITIATOR SIGNAL INPUT -#define TAD_IN board_type::gpio_high_low_e::GPIO_STATE_LOW // TARGET SIGNAL INPUT -#define DTD_IN board_type::gpio_high_low_e::GPIO_STATE_HIGH // DATA SIGNAL INPUT - -// SCSI signal pin assignment -const static int PIN_DT0 = 10; // Data 0 -const static int PIN_DT1 = 11; // Data 1 -const static int PIN_DT2 = 12; // Data 2 -const static int PIN_DT3 = 13; // Data 3 -const static int PIN_DT4 = 14; // Data 4 -const static int PIN_DT5 = 15; // Data 5 -const static int PIN_DT6 = 16; // Data 6 -const static int PIN_DT7 = 17; // Data 7 -const static int PIN_DP = 18; // Data parity -const static int PIN_ATN = 19; // ATN -const static int PIN_RST = 20; // RST -const static int PIN_ACK = 21; // ACK -const static int PIN_REQ = 22; // REQ -const static int PIN_MSG = 23; // MSG -const static int PIN_CD = 24; // CD -const static int PIN_IO = 25; // IO -const static int PIN_BSY = 26; // BSY -const static int PIN_SEL = 27; // SEL diff --git a/cpp/rascsi.cpp b/cpp/rascsi.cpp index e4e5cf8f..4c5b698f 100644 --- a/cpp/rascsi.cpp +++ b/cpp/rascsi.cpp @@ -74,7 +74,7 @@ const ProtobufSerializer serializer; void Banner(int argc, char* argv[]) { cout << Banner("Reloaded"); - cout << "Connect type: " << CONNECT_DESC << '\n' << flush; + cout << "Connect type: " << bus->GetConnectDesc() << '\n' << flush; if ((argc > 1 && strcmp(argv[1], "-h") == 0) || (argc > 1 && strcmp(argv[1], "--help") == 0)){ cout << "\nUsage: " << argv[0] << " [-idn[:m] FILE] ...\n\n";