Merge pull request #9 from akuker/cdrom-debug

Cdrom debug
This commit is contained in:
akuker 2020-07-09 15:35:50 -05:00 committed by GitHub
commit 4954d20f98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 622 additions and 167 deletions

62
doc/rascsi.1 Normal file
View File

@ -0,0 +1,62 @@
.TH rascsi 1
.SH NAME
rascsi \- Emulates SCSI devices using the Raspberry Pi GPIO pins
.SH SYNOPSIS
.B rascsi
[\fB\-IDn\fR \fIfile\fR]
[\fB\-HDn\fR \fIfile\fR]...
.SH DESCRIPTION
.B rascsi
Emulates SCSI devices using the Raspberry Pi GPIO pins.
.PP
In the arguments to RaSCSI, one or more SCSI (-IDn) or SASI (-HDn) devices can be specified.
The number (n) after the ID or HD idnetifier specifies the ID number for that device.
For SCSI: The ID is limited from 0-7. However, typically SCSI ID 7 is reserved for the "initiator" (the host computer).Note that SASI is considered rare and only used on very early Sharp X68000 computers.
.PP
RaSCSI will determin the type of device based upon the file extension of the FILE argument.
hdf: SASI Hard Disk image (XM6 SASI HD image - typically only used with X68000)
hds: SCSI Hard Disk image (XM6 SCSI HD image - typically only used with X68000)
hdn: SCSI Hard Disk image (NEC GENUINE)
hdi: SCSI Hard Disk image (Anex86 HD image)
nhd: SCSI Hard Disk image (T98Next HD image)
hda: SCSI Hard Disk image (APPLE GENUINE - typically used with Mac SCSI emulation)
mos: SCSI Magneto-optical image (XM6 SCSI MO image - typically only used with X68000)
iso: SCSI CD-ROM image (ISO 9660 image)
For example, if you want to specify an Apple-compatible HD image on ID 0, you can use the following command:
sudo rascsi -ID0 /path/to/drive/hdimage.hda
Once RaSCSI starts, it will open a socket (port 6868) to allow external management commands.
If another process is using port 6868, RaSCSI will terminate, since it is likely another instance of RaSCSI.
Once RaSCSI has initialized, the rasctl utility can be used to send commands.
To quit RaSCSI, press Control + C. If it is running in the background, you can kill it using an INT signal.
.SH OPTIONS
.TP
.BR \-ID\fIn " " \fIFILE
n is the SCSI ID number (0-7)
.IP
FILE is the name of the image file to attach to that ID.
.TP
.BR \-HD\fIn " " \fIFILE
n is the SASI ID number (0-15)
.IP
FILE is the name of the image file to attach to that ID.
.IP
Note: SASI usage is rare, and is typically limited to early Sharp X68000 systems.
.SH EXAMPLES
Launch RaSCSI with no emulated drives attached:
rascsi
Launch RaSCSI with an Apple hard drive image as ID0 and a CD-ROM as ID 2
rascsi -ID0 /path/to/harddrive.hda -ID2 /path/to/cdimage.iso
To create an empty, 100MB HD image, use the following command:
dd if=/dev/zero of=/path/to/newimage.hda bs=512 count=204800
.SH SEE ALSO
rasctl(1), scsidump(1)
Full documentation is available at: <https://www.github.com/akuker/RASCSI/wiki/>

68
doc/rascsi_man_page.txt Normal file
View File

@ -0,0 +1,68 @@
!! ------ THIS FILE IS AUTO_GENERATED! DO NOT MANUALLY UPDATE!!!
!! ------ The native file is rascsi.1. Re-run 'make docs' after updating
rascsi(1) General Commands Manual rascsi(1)
NAME
rascsi - Emulates SCSI devices using the Raspberry Pi GPIO pins
SYNOPSIS
rascsi [-IDn file] [-HDn file]...
DESCRIPTION
rascsi Emulates SCSI devices using the Raspberry Pi GPIO pins.
In the arguments to RaSCSI, one or more SCSI (-IDn) or SASI (-HDn) devices can be specified. The number (n)
after the ID or HD idnetifier specifies the ID number for that device. For SCSI: The ID is limited from 0-7.
However, typically SCSI ID 7 is reserved for the "initiator" (the host computer).Note that SASI is considered
rare and only used on very early Sharp X68000 computers.
RaSCSI will determin the type of device based upon the file extension of the FILE argument.
hdf: SASI Hard Disk image (XM6 SASI HD image - typically only used with X68000)
hds: SCSI Hard Disk image (XM6 SCSI HD image - typically only used with X68000)
hdn: SCSI Hard Disk image (NEC GENUINE)
hdi: SCSI Hard Disk image (Anex86 HD image)
nhd: SCSI Hard Disk image (T98Next HD image)
hda: SCSI Hard Disk image (APPLE GENUINE - typically used with Mac SCSI emulation)
mos: SCSI Magneto-optical image (XM6 SCSI MO image - typically only used with X68000)
iso: SCSI CD-ROM image (ISO 9660 image)
For example, if you want to specify an Apple-compatible HD image on ID 0, you can use the following command:
sudo rascsi -ID0 /path/to/drive/hdimage.hda
Once RaSCSI starts, it will open a socket (port 6868) to allow external management commands. If another
process is using port 6868, RaSCSI will terminate, since it is likely another instance of RaSCSI. Once
RaSCSI has initialized, the rasctl utility can be used to send commands.
To quit RaSCSI, press Control + C. If it is running in the background, you can kill it using an INT signal.
OPTIONS
-IDn FILE
n is the SCSI ID number (0-7)
FILE is the name of the image file to attach to that ID.
-HDn FILE
n is the SASI ID number (0-15)
FILE is the name of the image file to attach to that ID.
Note: SASI usage is rare, and is typically limited to early Sharp X68000 systems.
EXAMPLES
Launch RaSCSI with no emulated drives attached:
rascsi
Launch RaSCSI with an Apple hard drive image as ID0 and a CD-ROM as ID 2
rascsi -ID0 /path/to/harddrive.hda -ID2 /path/to/cdimage.iso
To create an empty, 100MB HD image, use the following command:
dd if=/dev/zero of=/path/to/newimage.hda bs=512 count=204800
SEE ALSO
rasctl(1), scsidump(1)
Full documentation is available at: <https://www.github.com/akuker/RASCSI/wiki/>
rascsi(1)

71
doc/rasctl.1 Normal file
View File

@ -0,0 +1,71 @@
.TH rascsi 1
.SH NAME
rasctl \- Sends management commands to the rascsi process
.SH SYNOPSIS
.B rasctl
\fB\-l\fR |
\fB\-i\fR \fIID\fR
[\fB\-u\fR \fIUNIT\fR]
[\fB\-c\fR \fICMD\fR]
[\fB\-t\fR \fITYPE\fR]
[\fB\-f\fR \fIFILE\fR]
.SH DESCRIPTION
.B rasctl
Sends commands to the rascsi process to make configuration adjustments at runtime or to check the status of the devices.
Either the -i or -l option should be specified at one time. Not both.
You do NOT need root privileges to use rasctl.
Note: The command and type arguments are case insensitive. Only the first letter of the command/type are evaluated by the tool.
.SH OPTIONS
.TP
.BR \-l\fI
List all of the devices that are currently being emulated by RaSCSI, as well as their current status.
.TP
.BR \-i\fI " " \fIID
ID is the SCSI ID that you want to control. (0-7)
.TP
.BR \-u\fI " " \fIUNIT
Unit number (0 or 1). This will default to 0. This option is only used when there are multiple SCSI devices on a shared SCSI controller. (This is not common)
.TP
.BR \-c\fI " " \fICMD
Command is the operation being requested. options are:
attach: attach disk
detach: detach disk
insert: insert media (Magneto-Optical and CD only)
eject: eject media (Magneto-Optical and CD only)
protect: Write protect the media (Magneto-Optical only)
.IP
When the command is omited, rasctl will default to the 'attach' command
.TP
.BR \-t\fI " " \fITYPE
Specifies the type of disk. If this disagrees with the file extension of the specified image, the TYPE argument is ignored. Available drive types are:
hd: Hard disk (SCSI or SASI)
mo: Magneto-Optical disk)
cd: CD-ROM
bridge: Bridge device (This is only applicable to the Sharp X68000)
.TP
.BR \-f\fI " " \fIFILE
Path to the disk image file. See the rascsi(1) man page for allowable file types.
.SH EXAMPLES
Show a listing of all of the SCSI devices and their current status
rasctl -l
Example output:
+----+----+------+-------------------------------------
| ID | UN | TYPE | DEVICE STATUS
+----+----+------+-------------------------------------
| 0 | 1 | SCHD | /home/pi/harddisk.hda
+----+----+------+-------------------------------------
Request the RaSCSI process to attach a disk (assumed) to SCSI ID 0 with the contents of the file system image "HDIIMAGE0.HDS".
rasctl -i 0 -f HDIIMAGE0.HDS
.SH SEE ALSO
rascsi(1)
Full documentation is available at: <https://www.github.com/akuker/RASCSI/wiki/>

73
doc/rasctl_man_page.txt Normal file
View File

@ -0,0 +1,73 @@
!! ------ THIS FILE IS AUTO_GENERATED! DO NOT MANUALLY UPDATE!!!
!! ------ The native file is rasctl.1. Re-run 'make docs' after updating
rascsi(1) General Commands Manual rascsi(1)
NAME
rasctl - Sends management commands to the rascsi process
SYNOPSIS
rasctl -l | -i ID [-u UNIT] [-c CMD] [-t TYPE] [-f FILE]
DESCRIPTION
rasctl Sends commands to the rascsi process to make configuration adjustments at runtime or to check the sta
tus of the devices.
Either the -i or -l option should be specified at one time. Not both.
You do NOT need root privileges to use rasctl.
Note: The command and type arguments are case insensitive. Only the first letter of the command/type are
evaluated by the tool.
OPTIONS
-l List all of the devices that are currently being emulated by RaSCSI, as well as their current status.
-i ID ID is the SCSI ID that you want to control. (0-7)
-u UNIT
Unit number (0 or 1). This will default to 0. This option is only used when there are multiple SCSI
devices on a shared SCSI controller. (This is not common)
-c CMD Command is the operation being requested. options are:
attach: attach disk
detach: detach disk
insert: insert media (Magneto-Optical and CD only)
eject: eject media (Magneto-Optical and CD only)
protect: Write protect the media (Magneto-Optical only)
When the command is omited, rasctl will default to the 'attach' command
-t TYPE
Specifies the type of disk. If this disagrees with the file extension of the specified image, the TYPE
argument is ignored. Available drive types are:
hd: Hard disk (SCSI or SASI)
mo: Magneto-Optical disk)
cd: CD-ROM
bridge: Bridge device (This is only applicable to the Sharp X68000)
-f FILE
Path to the disk image file. See the rascsi(1) man page for allowable file types.
EXAMPLES
Show a listing of all of the SCSI devices and their current status
rasctl -l
Example output:
+----+----+------+-------------------------------------
| ID | UN | TYPE | DEVICE STATUS
+----+----+------+-------------------------------------
| 0 | 1 | SCHD | /home/pi/harddisk.hda
+----+----+------+-------------------------------------
Request the RaSCSI process to attach a disk (assumed) to SCSI ID 0 with the contents of the file system image
"HDIIMAGE0.HDS".
rasctl -i 0 -f HDIIMAGE0.HDS
SEE ALSO
rascsi(1)
Full documentation is available at: <https://www.github.com/akuker/RASCSI/wiki/>
rascsi(1)

12
src/raspberrypi/.gitignore vendored Normal file
View File

@ -0,0 +1,12 @@
*.o
*.bak
*.HDA
*.save
*.cbp
*.layout
*.log
rascsi
scsimon
rasctl
sasidump
rasdump

View File

@ -1,7 +1,19 @@
.DEFAULT_GOAL: all
CC = gcc
CFLAGS = -DNDEBUG -O3 -Wall
CXX = g++
CXXFLAGS = -DNDEBUG -O3 -Wall
# Debug CFLAGS
#CFLAGS = -DDISK_LOG -O0 -g -Wall
#CFLAGS = -DDISK_LOG -O0 -g -Wall
# Release CFLAGS
CXXFLAGS = -O3 -Wall
CXXFLAGS = -O3 -Wall
# If its not specified, build for STANDARD configuration
CONNECT_TYPE ?= STANDARD
ifdef CONNECT_TYPE
CFLAGS += -DCONNECT_TYPE_$(CONNECT_TYPE)
@ -12,8 +24,17 @@ RASCSI = rascsi
RASCTL = rasctl
RASDUMP = rasdump
SASIDUMP = sasidump
SCSIMON = scsimon
USR_LOCAL_BIN = /usr/local/bin
MAN_PAGE_DIR = /usr/share/man/man1
DOC_DIR = ../../doc
#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)
BIN_ALL = $(RASCSI) $(RASCTL) $(RASDUMP) $(SASIDUMP)
SRC_RASCSI = \
rascsi.cpp \
@ -46,12 +67,17 @@ 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_SCSIMON := $(SRC_SCSIMON:%.cpp=%.o)
#OBJ_ALL := $(OBJ_RASCSI) $(OBJ_RASCTL) $(OBJ_RASDUMP) $(OBJ_SASIDUMP) $(OBJ_SCSIMON)
OBJ_ALL := $(OBJ_RASCSI) $(OBJ_RASCTL) $(OBJ_RASDUMP) $(OBJ_SASIDUMP)
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
ALL: $(BIN_ALL)
docs: $(DOC_DIR)/rascsi_man_page.txt $(DOC_DIR)/rasctl_man_page.txt
ALL: $(BIN_ALL) docs
all: $(BIN_ALL) docs
$(RASCSI): $(OBJ_RASCSI)
$(CXX) -o $@ $(OBJ_RASCSI) -lpthread
@ -65,5 +91,26 @@ $(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/HARDDISK2.hda -ID6 /home/pi/marathon.iso
install: $(MAN_PAGE_DIR)/rascsi.1 $(MAN_PAGE_DIR)/rasctl.1
sudo cp $(RASCTL) $(USR_LOCAL_BIN)
sudo cp $(RASCSI) $(USR_LOCAL_BIN)
$(MAN_PAGE_DIR)/%.1 : $(DOC_DIR)/%.1
sudo cp $< $@
$(DOC_DIR)/%_man_page.txt : $(DOC_DIR)/%.1
@echo "!! ------ THIS FILE IS AUTO_GENERATED! DO NOT MANUALLY UPDATE!!!" > $@
@echo "!! ------ The native file is $(notdir $<). Re-run 'make docs' after updating\n\n" >> $@
man -l $< | col -bx >> $@
.PHONY: Debug
Debug: scsimon

File diff suppressed because it is too large Load Diff

View File

@ -920,6 +920,11 @@ public:
// Other
BUS::phase_t FASTCALL GetPhase() {return ctrl.phase;}
// Get the phase
#ifdef DISK_LOG
// Function to get the current phase as a String.
void FASTCALL GetPhaseStr(char *str);
#endif
int FASTCALL GetID() {return ctrl.id;}
// Get the ID
void FASTCALL GetCTRL(ctrl_t *buffer);
@ -1138,4 +1143,6 @@ private:
// Internal data
};
#endif // disk_h

View File

@ -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;

View File

@ -78,7 +78,8 @@ void Banner(int argc, char* argv[])
FPRT(stdout,"Copyright (C) 2016-2020 GIMONS\n");
FPRT(stdout,"Connect type : %s\n", CONNECT_DESC);
if (argc > 1 && strcmp(argv[1], "-h") == 0) {
if ((argc > 1 && strcmp(argv[1], "-h") == 0) ||
(argc > 1 && strcmp(argv[1], "--help") == 0)){
FPRT(stdout,"\n");
FPRT(stdout,"Usage: %s [-IDn FILE] ...\n\n", argv[0]);
FPRT(stdout," n is SCSI identification number(0-7).\n");