mirror of
https://github.com/akuker/RASCSI.git
synced 2024-12-21 08:29:59 +00:00
Merge branch 'failed-monitor-attempt'
This commit is contained in:
commit
419f887dae
2
src/raspberrypi/.gitignore
vendored
Normal file
2
src/raspberrypi/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
*.o
|
||||
*.bak
|
@ -1,8 +1,13 @@
|
||||
.DEFAULT_GOAL: all
|
||||
|
||||
CC = gcc
|
||||
CFLAGS = -DDISK_LOG -O0 -g -Wall
|
||||
CXX = g++
|
||||
|
||||
CFLAGS = -DDISK_LOG -O0 -g -Wall
|
||||
CXXFLAGS = -DDISK_LOG -O0 -g -Wall
|
||||
|
||||
|
||||
|
||||
# If its not specified, build for STANDARD configuration
|
||||
CONNECT_TYPE ?= STANDARD
|
||||
|
||||
@ -15,9 +20,13 @@ RASCSI = rascsi
|
||||
RASCTL = rasctl
|
||||
RASDUMP = rasdump
|
||||
SASIDUMP = sasidump
|
||||
SCSIMON = scsimon
|
||||
|
||||
#BIN_ALL = $(RASCSI) $(RASCTL) $(RASDUMP) $(SASIDUMP) $(SCSIMON)
|
||||
# Temporarily remove the RASDUMP and RASDUMP tools, since they're not needed
|
||||
# for my specific use case. If you need them - add them back in!
|
||||
BIN_ALL = $(RASCSI) $(RASCTL) $(SCSIMON)
|
||||
|
||||
BIN_ALL = $(RASCSI) $(RASCTL) $(RASDUMP) $(SASIDUMP)
|
||||
|
||||
SRC_RASCSI = \
|
||||
rascsi.cpp \
|
||||
@ -46,16 +55,29 @@ SRC_SASIDUMP = \
|
||||
filepath.cpp \
|
||||
fileio.cpp
|
||||
|
||||
SRC_SCSIMON = \
|
||||
scsimon.cpp \
|
||||
scsi.cpp \
|
||||
disk.cpp \
|
||||
gpiobus.cpp \
|
||||
ctapdriver.cpp \
|
||||
cfilesystem.cpp \
|
||||
filepath.cpp \
|
||||
fileio.cpp \
|
||||
scsimondev.cpp
|
||||
|
||||
OBJ_RASCSI := $(SRC_RASCSI:%.cpp=%.o)
|
||||
OBJ_RASCTL := $(SRC_RASCTL:%.cpp=%.o)
|
||||
OBJ_RASDUMP := $(SRC_RASDUMP:%.cpp=%.o)
|
||||
OBJ_SASIDUMP := $(SRC_SASIDUMP:%.cpp=%.o)
|
||||
OBJ_ALL := $(OBJ_RASCSI) $(OBJ_RASCTL) $(OBJ_RASDUMP) $(OBJ_SASIDUMP)
|
||||
OBJ_SCSIMON := $(SRC_SCSIMON:%.cpp=%.o)
|
||||
OBJ_ALL := $(OBJ_RASCSI) $(OBJ_RASCTL) $(OBJ_RASDUMP) $(OBJ_SASIDUMP) $(OBJ_SCSIMON)
|
||||
|
||||
%.o: %.cpp
|
||||
$(CXX) $(CXXFLAGS) -c $< -o $@
|
||||
|
||||
ALL: $(BIN_ALL)
|
||||
all: $(BIN_ALL)
|
||||
|
||||
$(RASCSI): $(OBJ_RASCSI)
|
||||
$(CXX) -o $@ $(OBJ_RASCSI) -lpthread
|
||||
@ -69,8 +91,14 @@ $(RASDUMP): $(OBJ_RASDUMP)
|
||||
$(SASIDUMP): $(OBJ_SASIDUMP)
|
||||
$(CXX) -o $@ $(OBJ_SASIDUMP)
|
||||
|
||||
$(SCSIMON): $(OBJ_SCSIMON)
|
||||
$(CXX) $(CXXFLAGS) -o $@ $(OBJ_SCSIMON) -lpthread
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ_ALL) $(BIN_ALL)
|
||||
|
||||
run:
|
||||
sudo ./$(RASCSI) -ID1 /home/pi/HARDDISK.HDA -ID6 /home/pi/marathon.iso
|
||||
|
||||
.PHONY: Debug
|
||||
Debug: scsimon
|
||||
|
@ -4534,6 +4534,7 @@ void FASTCALL SCSICD::GetBuf(
|
||||
ASSERT(this);
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// SCSI Host Bridge
|
||||
@ -6294,6 +6295,7 @@ BUS::phase_t FASTCALL SASIDEV::Process()
|
||||
// Get bus information
|
||||
ctrl.bus->Aquire();
|
||||
|
||||
// For the monitor tool, we shouldn't need to reset. We're just logging information
|
||||
// Reset
|
||||
if (ctrl.bus->GetRST()) {
|
||||
#if defined(DISK_LOG)
|
||||
@ -6373,7 +6375,7 @@ void FASTCALL SASIDEV::BusFree()
|
||||
// Phase Setting
|
||||
ctrl.phase = BUS::busfree;
|
||||
|
||||
// 信号線
|
||||
Set Signal lines
|
||||
ctrl.bus->SetREQ(FALSE);
|
||||
ctrl.bus->SetMSG(FALSE);
|
||||
ctrl.bus->SetCD(FALSE);
|
||||
@ -6666,8 +6668,8 @@ void FASTCALL SASIDEV::Status()
|
||||
|
||||
#ifndef RASCSI
|
||||
// Request status
|
||||
ctrl.bus->SetDAT(ctrl.buffer[0]);
|
||||
ctrl.bus->SetREQ(TRUE);
|
||||
// ctrl.bus->SetDAT(ctrl.buffer[0]);
|
||||
// ctrl.bus->SetREQ(TRUE);
|
||||
|
||||
#if defined(DISK_LOG)
|
||||
Log(Log::Normal, "Status Phase $%02X", ctrl.status);
|
||||
@ -8026,6 +8028,7 @@ void FASTCALL SCSIDEV::Reset()
|
||||
BUS::phase_t FASTCALL SCSIDEV::Process()
|
||||
{
|
||||
ASSERT(this);
|
||||
printf("SCSIDEV::Process() %d\n", ctrl.id);
|
||||
|
||||
// Do nothing if not connected
|
||||
if (ctrl.id < 0 || ctrl.bus == NULL) {
|
||||
|
@ -229,6 +229,8 @@ public:
|
||||
// NULL check
|
||||
BOOL FASTCALL IsSASI() const;
|
||||
// SASI Check
|
||||
virtual BOOL FASTCALL IsMonitor() const {return FALSE;}
|
||||
// Check if this is a monitor device
|
||||
|
||||
// Media Operations
|
||||
virtual BOOL FASTCALL Open(const Filepath& path, BOOL attn = TRUE);
|
||||
@ -933,6 +935,8 @@ public:
|
||||
// SASI Check
|
||||
virtual BOOL FASTCALL IsSCSI() const {return FALSE;}
|
||||
// SCSI check
|
||||
virtual BOOL FASTCALL IsMonitor() const {return FALSE;}
|
||||
// Check to see if this is a monitor device
|
||||
Disk* FASTCALL GetBusyUnit();
|
||||
// Get the busy unit
|
||||
|
||||
@ -1141,4 +1145,6 @@ private:
|
||||
// Internal data
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // disk_h
|
||||
|
@ -65,7 +65,7 @@ DWORD bcm_host_get_peripheral_address(void)
|
||||
char buf[1024];
|
||||
size_t len = sizeof(buf);
|
||||
DWORD address;
|
||||
|
||||
|
||||
if (sysctlbyname("hw.model", buf, &len, NULL, 0) ||
|
||||
strstr(buf, "ARM1176JZ-S") != buf) {
|
||||
// Failed to get CPU model || Not BCM2835
|
||||
@ -88,7 +88,7 @@ extern uint32_t RPi_IO_Base_Addr;
|
||||
// Core frequency
|
||||
extern uint32_t RPi_Core_Freq;
|
||||
|
||||
#ifdef USE_SEL_EVENT_ENABLE
|
||||
#ifdef USE_SEL_EVENT_ENABLE
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Interrupt control function
|
||||
@ -169,6 +169,7 @@ BOOL FASTCALL GPIOBUS::Init(mode_e mode)
|
||||
// Open /dev/mem
|
||||
fd = open("/dev/mem", O_RDWR | O_SYNC);
|
||||
if (fd == -1) {
|
||||
printf("Error: Unable to open /dev/mem. Are you running as root?\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -274,6 +275,7 @@ BOOL FASTCALL GPIOBUS::Init(mode_e mode)
|
||||
PinConfig(PIN_DTD, GPIO_OUTPUT);
|
||||
|
||||
// Set the ENABLE signal
|
||||
// This is used to show that the application is running
|
||||
PinSetSignal(PIN_ENB, ENB_OFF);
|
||||
PinConfig(PIN_ENB, GPIO_OUTPUT);
|
||||
|
||||
@ -373,6 +375,7 @@ BOOL FASTCALL GPIOBUS::Init(mode_e mode)
|
||||
MakeTable();
|
||||
|
||||
// Finally, enable ENABLE
|
||||
// Show the user that this app is running
|
||||
SetControl(PIN_ENB, ENB_ON);
|
||||
|
||||
return TRUE;
|
||||
@ -518,7 +521,7 @@ DWORD FASTCALL GPIOBUS::Aquire()
|
||||
// Invert if negative logic (internal processing is unified to positive logic)
|
||||
signals = ~signals;
|
||||
#endif // SIGNAL_CONTROL_MODE
|
||||
|
||||
|
||||
return signals;
|
||||
}
|
||||
|
||||
@ -549,9 +552,15 @@ BOOL FASTCALL GPIOBUS::GetBSY()
|
||||
//---------------------------------------------------------------------------
|
||||
void FASTCALL GPIOBUS::SetBSY(BOOL ast)
|
||||
{
|
||||
// Set BSY signal
|
||||
SetSignal(PIN_BSY, ast);
|
||||
|
||||
if(actmode == MONITOR)
|
||||
{
|
||||
printf("WARNING!!! SOMEONE TRIED TO SET BSY IN MONITOR MODE");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set BSY signal
|
||||
SetSignal(PIN_BSY, ast);
|
||||
}
|
||||
if (actmode == TARGET) {
|
||||
if (ast) {
|
||||
// Turn on ACTIVE signal
|
||||
@ -603,8 +612,14 @@ void FASTCALL GPIOBUS::SetSEL(BOOL ast)
|
||||
SetControl(PIN_ACT, ACT_ON);
|
||||
}
|
||||
|
||||
// Set SEL signal
|
||||
SetSignal(PIN_SEL, ast);
|
||||
if (actmode != MONITOR)
|
||||
{
|
||||
// Set SEL signal
|
||||
SetSignal(PIN_SEL, ast);
|
||||
}
|
||||
else{
|
||||
printf("WARNING!!! SOMEONE TRIED TO SET SEL IN MONITOR MODE");
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@ -624,7 +639,14 @@ BOOL FASTCALL GPIOBUS::GetATN()
|
||||
//---------------------------------------------------------------------------
|
||||
void FASTCALL GPIOBUS::SetATN(BOOL ast)
|
||||
{
|
||||
SetSignal(PIN_ATN, ast);
|
||||
if(actmode == MONITOR)
|
||||
{
|
||||
printf("WARNING!!! SOMEONE TRIED TO SET ATN IN MONITOR MODE");
|
||||
}
|
||||
else
|
||||
{
|
||||
SetSignal(PIN_ATN, ast);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@ -644,7 +666,14 @@ BOOL FASTCALL GPIOBUS::GetACK()
|
||||
//---------------------------------------------------------------------------
|
||||
void FASTCALL GPIOBUS::SetACK(BOOL ast)
|
||||
{
|
||||
if(actmode == MONITOR)
|
||||
{
|
||||
printf("WARNING!!! SOMEONE TRIED TO SET ACK IN MONITOR MODE");
|
||||
}
|
||||
else
|
||||
{
|
||||
SetSignal(PIN_ACK, ast);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@ -664,7 +693,14 @@ BOOL FASTCALL GPIOBUS::GetRST()
|
||||
//---------------------------------------------------------------------------
|
||||
void FASTCALL GPIOBUS::SetRST(BOOL ast)
|
||||
{
|
||||
if(actmode == MONITOR)
|
||||
{
|
||||
printf("WARNING!!! SOMEONE TRIED TO SET RST IN MONITOR MODE");
|
||||
}
|
||||
else
|
||||
{
|
||||
SetSignal(PIN_RST, ast);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@ -684,7 +720,13 @@ BOOL FASTCALL GPIOBUS::GetMSG()
|
||||
//---------------------------------------------------------------------------
|
||||
void FASTCALL GPIOBUS::SetMSG(BOOL ast)
|
||||
{
|
||||
SetSignal(PIN_MSG, ast);
|
||||
if(actmode == MONITOR)
|
||||
{
|
||||
printf("WARNING!!! SOMEONE TRIED TO SET MSG IN MONITOR MODE");
|
||||
}
|
||||
else{
|
||||
SetSignal(PIN_MSG, ast);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@ -704,7 +746,14 @@ BOOL FASTCALL GPIOBUS::GetCD()
|
||||
//---------------------------------------------------------------------------
|
||||
void FASTCALL GPIOBUS::SetCD(BOOL ast)
|
||||
{
|
||||
SetSignal(PIN_CD, ast);
|
||||
if(actmode == MONITOR)
|
||||
{
|
||||
printf("WARNING!!! SOMEONE TRIED TO SET CD IN MONITOR MODE");
|
||||
}
|
||||
else
|
||||
{
|
||||
SetSignal(PIN_CD, ast);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@ -754,6 +803,21 @@ BOOL FASTCALL GPIOBUS::GetIO()
|
||||
//---------------------------------------------------------------------------
|
||||
void FASTCALL GPIOBUS::SetIO(BOOL ast)
|
||||
{
|
||||
if(actmode == MONITOR)
|
||||
{
|
||||
printf("WARNING!!! SOMEONE TRIED TO SET IO IN MONITOR MODE");
|
||||
SetControl(PIN_DTD, DTD_IN);
|
||||
SetMode(PIN_DT0, IN);
|
||||
SetMode(PIN_DT1, IN);
|
||||
SetMode(PIN_DT2, IN);
|
||||
SetMode(PIN_DT3, IN);
|
||||
SetMode(PIN_DT4, IN);
|
||||
SetMode(PIN_DT5, IN);
|
||||
SetMode(PIN_DT6, IN);
|
||||
SetMode(PIN_DT7, IN);
|
||||
SetMode(PIN_DP, IN);
|
||||
}
|
||||
|
||||
SetSignal(PIN_IO, ast);
|
||||
|
||||
if (actmode == TARGET) {
|
||||
@ -802,6 +866,12 @@ BOOL FASTCALL GPIOBUS::GetREQ()
|
||||
//---------------------------------------------------------------------------
|
||||
void FASTCALL GPIOBUS::SetREQ(BOOL ast)
|
||||
{
|
||||
if(actmode == MONITOR)
|
||||
{
|
||||
printf("WARNING!!! SOMEONE TRIED TO SET REQ IN MONITOR MODE");
|
||||
return;
|
||||
}
|
||||
|
||||
SetSignal(PIN_REQ, ast);
|
||||
}
|
||||
|
||||
@ -835,6 +905,14 @@ BYTE FASTCALL GPIOBUS::GetDAT()
|
||||
//---------------------------------------------------------------------------
|
||||
void FASTCALL GPIOBUS::SetDAT(BYTE dat)
|
||||
{
|
||||
|
||||
|
||||
if(actmode == MONITOR)
|
||||
{
|
||||
printf("WARNING!!! SOMEONE TRIED TO SET Data IN MONITOR MODE");
|
||||
return;
|
||||
}
|
||||
|
||||
// Write to port
|
||||
#if SIGNAL_CONTROL_MODE == 0
|
||||
DWORD fsel;
|
||||
@ -1152,7 +1230,7 @@ int FASTCALL GPIOBUS::SendHandShake(BYTE *buf, int count)
|
||||
}
|
||||
|
||||
// Already waiting for REQ assertion
|
||||
|
||||
|
||||
// Assert the ACK signal
|
||||
SetSignal(PIN_ACK, ON);
|
||||
|
||||
@ -1396,7 +1474,7 @@ void FASTCALL GPIOBUS::SetMode(int pin, int mode)
|
||||
gpio[index] = data;
|
||||
gpfsel[index] = data;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Get input signal value
|
||||
@ -1406,7 +1484,7 @@ BOOL FASTCALL GPIOBUS::GetSignal(int pin)
|
||||
{
|
||||
return (signals >> pin) & 1;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Set output signal value
|
||||
|
@ -153,7 +153,7 @@ BOOL Init()
|
||||
|
||||
// GPIOBUS creation
|
||||
bus = new GPIOBUS();
|
||||
|
||||
|
||||
// GPIO Initialization
|
||||
if (!bus->Init()) {
|
||||
return FALSE;
|
||||
@ -206,7 +206,7 @@ void Cleanup()
|
||||
|
||||
// Cleanup the Bus
|
||||
bus->Cleanup();
|
||||
|
||||
|
||||
// Discard the GPIOBUS object
|
||||
delete bus;
|
||||
|
||||
@ -306,7 +306,7 @@ void ListDevice(FILE *fp)
|
||||
FPRT(fp, "No device is installed.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
FPRT(fp, "+----+----+------+-------------------------------------\n");
|
||||
}
|
||||
|
||||
@ -862,7 +862,7 @@ static void *MonThread(void *param)
|
||||
{
|
||||
struct sched_param schedparam;
|
||||
struct sockaddr_in client;
|
||||
socklen_t len;
|
||||
socklen_t len;
|
||||
int fd;
|
||||
FILE *fp;
|
||||
char buf[BUFSIZ];
|
||||
@ -892,8 +892,8 @@ static void *MonThread(void *param)
|
||||
|
||||
while (1) {
|
||||
// Wait for connection
|
||||
memset(&client, 0, sizeof(client));
|
||||
len = sizeof(client);
|
||||
memset(&client, 0, sizeof(client));
|
||||
len = sizeof(client);
|
||||
fd = accept(monsocket, (struct sockaddr*)&client, &len);
|
||||
if (fd < 0) {
|
||||
break;
|
||||
|
1174
src/raspberrypi/scsimon.cpp
Normal file
1174
src/raspberrypi/scsimon.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1902
src/raspberrypi/scsimondev.cpp
Normal file
1902
src/raspberrypi/scsimondev.cpp
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user