Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
uweseimet committed Dec 11, 2024
1 parent 1469717 commit a02a21f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
22 changes: 16 additions & 6 deletions cpp/buses/rpi_bus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ using namespace spdlog;

bool RpiBus::Init(bool target)
{
assert(!target);
assert(target);

Bus::Init(false);
Bus::Init(target);

int fd = open("/dev/mem", O_RDWR | O_SYNC);
if (fd == -1) {
Expand Down Expand Up @@ -173,6 +173,9 @@ bool RpiBus::Init(bool target)

CreateWorkTable();

// Enable ENABLE in order to show the user that s2p is running
SetControl(PIN_ENB, ENB_ON);

return true;
}

Expand Down Expand Up @@ -293,9 +296,18 @@ bool RpiBus::GetIO()
return state;
}

void RpiBus::SetIO(bool)
void RpiBus::SetIO(bool state)
{
assert(false);
assert(IsTarget());

SetSignal(PIN_IO, state);

// Change the data input/output direction by IO signal
SetControl(PIN_DTD, state ? DTD_OUT : DTD_IN);

for (int pin : DATA_PINS) {
SetMode(pin, state ? OUT : IN);
}
}

inline uint8_t RpiBus::GetDAT()
Expand Down Expand Up @@ -359,8 +371,6 @@ void RpiBus::CreateWorkTable(void)

void RpiBus::SetControl(int pin, bool state)
{
assert(!state);

PinSetSignal(pin, state);
}

Expand Down
3 changes: 0 additions & 3 deletions cpp/s2p/s2p_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,9 +452,6 @@ void S2p::ProcessScsiCommands()
while (service_thread.IsRunning()) {
// Only process the SCSI command if the bus is not busy and no other device responded
if (bus->WaitForSelection() && WaitForNotBusy()) {

scoped_lock<mutex> lock(executor->GetExecutionLocker());

// Process command on the responsible controller based on the current initiator and target ID
if (const auto shutdown_mode = controller_factory.ProcessOnController(bus->GetDAT()); shutdown_mode
!= shutdown_mode::none) {
Expand Down

0 comments on commit a02a21f

Please sign in to comment.