Merge with develop

This commit is contained in:
Uwe Seimet 2023-11-16 16:47:07 +01:00
parent ea638ab718
commit 6aa8b93975
4 changed files with 16 additions and 24 deletions

View File

@ -54,7 +54,7 @@ const static int SCSI_DELAY_FAST_NEGATION_PERIOD_NS = 30;
// The DaynaPort SCSI Link do a short delay in the middle of transfering // The DaynaPort SCSI Link do a short delay in the middle of transfering
// a packet. This is the number of uS that will be delayed between the // a packet. This is the number of uS that will be delayed between the
// header and the actual data. // header and the actual data.
const static int SCSI_DELAY_SEND_DATA_DAYNAPORT_US = 100; const static int SCSI_DELAY_SEND_DATA_DAYNAPORT_NS = 100'000;
class bus_exception : public runtime_error class bus_exception : public runtime_error

View File

@ -15,7 +15,7 @@
#include <spdlog/spdlog.h> #include <spdlog/spdlog.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/time.h> #include <time.h>
#ifdef __linux__ #ifdef __linux__
#include <sys/epoll.h> #include <sys/epoll.h>
#endif #endif
@ -278,9 +278,12 @@ int GPIOBUS::SendHandShake(uint8_t *buf, int count, int delay_after_bytes)
if (actmode == mode_e::TARGET) { if (actmode == mode_e::TARGET) {
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
if (i == delay_after_bytes) { if (i == delay_after_bytes) {
spdlog::trace("DELAYING for " + to_string(SCSI_DELAY_SEND_DATA_DAYNAPORT_US) + " us after " + spdlog::trace("DELAYING for " + to_string(SCSI_DELAY_SEND_DATA_DAYNAPORT_NS) + " ns after " +
to_string(delay_after_bytes) + " bytes"); to_string(delay_after_bytes) + " bytes");
SysTimer::SleepUsec(SCSI_DELAY_SEND_DATA_DAYNAPORT_US); EnableIRQ();
const timespec ts = { .tv_sec = 0, .tv_nsec = SCSI_DELAY_SEND_DATA_DAYNAPORT_NS};
nanosleep(&ts, nullptr);
DisableIRQ();
} }
// Set the DATA signals // Set the DATA signals

View File

@ -606,42 +606,31 @@ uint8_t GPIOBUS_Raspberry::GetDAT()
return (uint8_t)data; return (uint8_t)data;
} }
//---------------------------------------------------------------------------
//
// Set data signals
//
//---------------------------------------------------------------------------
void GPIOBUS_Raspberry::SetDAT(uint8_t dat) void GPIOBUS_Raspberry::SetDAT(uint8_t dat)
{ {
// Write to port // Write to ports
#if SIGNAL_CONTROL_MODE == 0 #if SIGNAL_CONTROL_MODE == 0
uint32_t fsel = gpfsel[0]; uint32_t fsel = gpfsel[0];
fsel &= tblDatMsk[0][dat]; fsel &= tblDatMsk[0][dat];
fsel |= tblDatSet[0][dat]; fsel |= tblDatSet[0][dat];
if (fsel != gpfsel[0]) { gpfsel[0] = fsel;
gpfsel[0] = fsel; gpio[GPIO_FSEL_0] = fsel;
gpio[GPIO_FSEL_0] = fsel;
}
fsel = gpfsel[1]; fsel = gpfsel[1];
fsel &= tblDatMsk[1][dat]; fsel &= tblDatMsk[1][dat];
fsel |= tblDatSet[1][dat]; fsel |= tblDatSet[1][dat];
if (fsel != gpfsel[1]) { gpfsel[1] = fsel;
gpfsel[1] = fsel; gpio[GPIO_FSEL_1] = fsel;
gpio[GPIO_FSEL_1] = fsel;
}
fsel = gpfsel[2]; fsel = gpfsel[2];
fsel &= tblDatMsk[2][dat]; fsel &= tblDatMsk[2][dat];
fsel |= tblDatSet[2][dat]; fsel |= tblDatSet[2][dat];
if (fsel != gpfsel[2]) { gpfsel[2] = fsel;
gpfsel[2] = fsel; gpio[GPIO_FSEL_2] = fsel;
gpio[GPIO_FSEL_2] = fsel;
}
#else #else
gpio[GPIO_CLR_0] = tblDatMsk[dat]; gpio[GPIO_CLR_0] = tblDatMsk[dat];
gpio[GPIO_SET_0] = tblDatSet[dat]; gpio[GPIO_SET_0] = tblDatSet[dat];
#endif // SIGNAL_CONTROL_MODE #endif
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View File

@ -144,7 +144,7 @@ uint32_t SBC_Version::GetPeripheralAddress(void)
return address; return address;
} }
#elif defined __NetBSD__ #elif defined __NetBSD__ && (!defined(__x86_64__) || defined(__X86__))
uint32_t SBC_Version::GetPeripheralAddress(void) uint32_t SBC_Version::GetPeripheralAddress(void)
{ {
char buf[1024]; char buf[1024];