mirror of
https://github.com/akuker/RASCSI.git
synced 2024-11-26 13:49:21 +00:00
Merge branch 'develop' into daynaport3
This commit is contained in:
commit
61c7644250
3
.gitignore
vendored
3
.gitignore
vendored
@ -4,3 +4,6 @@ core
|
||||
.idea/
|
||||
.DS_Store
|
||||
*.swp
|
||||
__pycache__
|
||||
src/web/current
|
||||
src/oled_monitor/current
|
||||
|
@ -24,7 +24,7 @@ VIRTUAL_DRIVER_PATH=/home/pi/images
|
||||
HFS_FORMAT=/usr/bin/hformat
|
||||
HFDISK_BIN=/usr/bin/hfdisk
|
||||
LIDO_DRIVER=~/RASCSI/lido-driver.img
|
||||
|
||||
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||
|
||||
function initialChecks() {
|
||||
currentUser=$(whoami)
|
||||
@ -103,10 +103,11 @@ function installRaScsiWebInterface() {
|
||||
}
|
||||
|
||||
function updateRaScsiGit() {
|
||||
echo "Updating checked out branch $GIT_BRANCH"
|
||||
cd ~/RASCSI
|
||||
git fetch
|
||||
git fetch origin
|
||||
git stash
|
||||
git rebase origin/master
|
||||
git rebase origin/$GIT_BRANCH
|
||||
git stash apply
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# RaSCSI Updates:
|
||||
# Updates to output rascsi status to an OLED display
|
||||
@ -29,92 +29,57 @@
|
||||
# THE SOFTWARE.
|
||||
import time
|
||||
import os
|
||||
import sys
|
||||
import datetime
|
||||
|
||||
#import Adafruit_GPIO.SPI as SPI
|
||||
import Adafruit_SSD1306
|
||||
|
||||
from PIL import Image
|
||||
from PIL import ImageDraw
|
||||
from PIL import ImageFont
|
||||
|
||||
import board
|
||||
import busio
|
||||
import adafruit_ssd1306
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
import subprocess
|
||||
|
||||
WIDTH = 128
|
||||
HEIGHT = 32 # Change to 64 if needed
|
||||
BORDER = 5
|
||||
|
||||
# How long to delay between each update
|
||||
delay_time_ms = 250
|
||||
|
||||
# Raspberry Pi pin configuration:
|
||||
RST = None # on the PiOLED this pin isnt used
|
||||
# Note the following are only used with SPI:
|
||||
DC = 23
|
||||
SPI_PORT = 0
|
||||
SPI_DEVICE = 0
|
||||
# Define the Reset Pin
|
||||
oled_reset = None
|
||||
|
||||
# Beaglebone Black pin configuration:
|
||||
# RST = 'P9_12'
|
||||
# Note the following are only used with SPI:
|
||||
# DC = 'P9_15'
|
||||
# SPI_PORT = 1
|
||||
# SPI_DEVICE = 0
|
||||
# init i2c
|
||||
i2c = board.I2C()
|
||||
|
||||
# 128x32 display with hardware I2C:
|
||||
disp = Adafruit_SSD1306.SSD1306_128_32(rst=RST)
|
||||
oled = adafruit_ssd1306.SSD1306_I2C(WIDTH, HEIGHT, i2c, addr=0x3C, reset=oled_reset)
|
||||
|
||||
# 128x64 display with hardware I2C:
|
||||
# disp = Adafruit_SSD1306.SSD1306_128_64(rst=RST)
|
||||
|
||||
# Note you can change the I2C address by passing an i2c_address parameter like:
|
||||
# disp = Adafruit_SSD1306.SSD1306_128_64(rst=RST, i2c_address=0x3C)
|
||||
|
||||
# Alternatively you can specify an explicit I2C bus number, for example
|
||||
# with the 128x32 display you would use:
|
||||
# disp = Adafruit_SSD1306.SSD1306_128_32(rst=RST, i2c_bus=2)
|
||||
|
||||
# 128x32 display with hardware SPI:
|
||||
# disp = Adafruit_SSD1306.SSD1306_128_32(rst=RST, dc=DC, spi=SPI.SpiDev(SPI_PORT, SPI_DEVICE, max_speed_hz=8000000))
|
||||
|
||||
# 128x64 display with hardware SPI:
|
||||
# disp = Adafruit_SSD1306.SSD1306_128_64(rst=RST, dc=DC, spi=SPI.SpiDev(SPI_PORT, SPI_DEVICE, max_speed_hz=8000000))
|
||||
|
||||
# Alternatively you can specify a software SPI implementation by providing
|
||||
# digital GPIO pin numbers for all the required display pins. For example
|
||||
# on a Raspberry Pi with the 128x32 display you might use:
|
||||
# disp = Adafruit_SSD1306.SSD1306_128_32(rst=RST, dc=DC, sclk=18, din=25, cs=22)
|
||||
|
||||
print "Running with the following display:"
|
||||
print disp
|
||||
print
|
||||
print "Will update the OLED display every " + str(delay_time_ms) + "ms (approximately)"
|
||||
|
||||
|
||||
# Initialize library.
|
||||
disp.begin()
|
||||
print ("Running with the following display:")
|
||||
print (oled)
|
||||
print ()
|
||||
print ("Will update the OLED display every " + str(delay_time_ms) + "ms (approximately)")
|
||||
|
||||
# Clear display.
|
||||
disp.clear()
|
||||
disp.display()
|
||||
oled.fill(0)
|
||||
oled.show()
|
||||
|
||||
# Create blank image for drawing.
|
||||
# Make sure to create image with mode '1' for 1-bit color.
|
||||
width = disp.width
|
||||
height = disp.height
|
||||
image = Image.new('1', (width, height))
|
||||
image = Image.new("1", (oled.width, oled.height))
|
||||
|
||||
# Get drawing object to draw on image.
|
||||
draw = ImageDraw.Draw(image)
|
||||
|
||||
# Draw a black filled box to clear the image.
|
||||
draw.rectangle((0,0,width,height), outline=0, fill=0)
|
||||
draw.rectangle((0,0,WIDTH,HEIGHT), outline=0, fill=0)
|
||||
|
||||
# Draw some shapes.
|
||||
# First define some constants to allow easy resizing of shapes.
|
||||
padding = -2
|
||||
top = padding
|
||||
bottom = height-padding
|
||||
bottom = HEIGHT-padding
|
||||
# Move left to right keeping track of the current x position for drawing shapes.
|
||||
x = 0
|
||||
|
||||
|
||||
# Load default font.
|
||||
font = ImageFont.load_default()
|
||||
|
||||
@ -125,10 +90,10 @@ font = ImageFont.load_default()
|
||||
while True:
|
||||
|
||||
# Draw a black filled box to clear the image.
|
||||
draw.rectangle((0,0,width,height), outline=0, fill=0)
|
||||
draw.rectangle((0,0,WIDTH,HEIGHT), outline=0, fill=0)
|
||||
|
||||
cmd = "rasctl -l"
|
||||
rascsi_list = subprocess.check_output(cmd, shell=True)
|
||||
rascsi_list = subprocess.check_output(cmd, shell=True).decode(sys.stdout.encoding)
|
||||
|
||||
y_pos = top
|
||||
# Draw all of the meaningful data to the 'image'
|
||||
@ -146,19 +111,20 @@ while True:
|
||||
for line in rascsi_list.split('\n'):
|
||||
# Skip empty strings, divider lines and the header line...
|
||||
if (len(line) == 0) or line.startswith("+---") or line.startswith("| ID | UN"):
|
||||
continue
|
||||
else:
|
||||
if line.startswith("| "):
|
||||
fields = line.split('|')
|
||||
output = str.strip(fields[1]) + " " + str.strip(fields[3]) + " " + os.path.basename(str.strip(fields[4]))
|
||||
else:
|
||||
output = "No image mounted!"
|
||||
draw.text((x, y_pos), output, font=font, fill=255)
|
||||
y_pos = y_pos + 8
|
||||
continue
|
||||
else:
|
||||
if line.startswith("| "):
|
||||
fields = line.split('|')
|
||||
output = str.strip(fields[1]) + " " + str.strip(fields[3]) + " " + os.path.basename(str.strip(fields[4]))
|
||||
else:
|
||||
output = "No image mounted!"
|
||||
draw.text((x, y_pos), output, font=font, fill=255)
|
||||
y_pos += 8
|
||||
|
||||
# If there is still room on the screen, we'll display the time. If there's not room it will just be clipped
|
||||
draw.text((x, y_pos), datetime.datetime.now().strftime("%d/%m/%Y %H:%M:%S"), font=font, fill=255)
|
||||
|
||||
# Display image.
|
||||
disp.image(image)
|
||||
disp.display()
|
||||
oled.image(image)
|
||||
oled.show()
|
||||
time.sleep(1/delay_time_ms)
|
||||
|
14
src/oled_monitor/requirements.txt
Normal file
14
src/oled_monitor/requirements.txt
Normal file
@ -0,0 +1,14 @@
|
||||
Adafruit-Blinka==6.3.2
|
||||
adafruit-circuitpython-busdevice==5.0.6
|
||||
adafruit-circuitpython-framebuf==1.4.6
|
||||
adafruit-circuitpython-ssd1306==2.11.1
|
||||
Adafruit-PlatformDetect==3.2.0
|
||||
Adafruit-PureIO==1.1.8
|
||||
Pillow==8.1.2
|
||||
pkg-resources==0.0.0
|
||||
pyftdi==0.52.9
|
||||
pyserial==3.5
|
||||
pyusb==1.1.1
|
||||
rpi-ws281x==4.2.5
|
||||
RPi.GPIO==0.7.0
|
||||
sysv-ipc==1.1.0
|
76
src/oled_monitor/start.sh
Executable file
76
src/oled_monitor/start.sh
Executable file
@ -0,0 +1,76 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
# set -x # Uncomment to Debug
|
||||
|
||||
cd $(dirname $0)
|
||||
# verify packages installed
|
||||
ERROR=0
|
||||
if ! command -v dpkg -l i2c-tools &> /dev/null ; then
|
||||
echo "i2c-tools could not be found"
|
||||
echo "Run 'sudo apt install i2c-tools' to fix."
|
||||
ERROR=1
|
||||
fi
|
||||
if ! command -v python3 &> /dev/null ; then
|
||||
echo "python3 could not be found"
|
||||
echo "Run 'sudo apt install python3' to fix."
|
||||
ERROR=1
|
||||
fi
|
||||
# Dep to build Pillow
|
||||
if ! dpkg -l python3-dev &> /dev/null; then
|
||||
echo "python3-dev could not be found"
|
||||
echo "Run 'sudo apt install python3-dev' to fix."
|
||||
ERROR=1
|
||||
fi
|
||||
if ! dpkg -l libjpeg-dev &> /dev/null; then
|
||||
echo "libjpeg-dev could not be found"
|
||||
echo "Run 'sudo apt install libjpeg-dev' to fix."
|
||||
ERROR=1
|
||||
fi
|
||||
if ! dpkg -l libpng-dev &> /dev/null; then
|
||||
echo "libpng-dev could not be found"
|
||||
echo "Run 'sudo apt install libpng-dev' to fix."
|
||||
ERROR=1
|
||||
fi
|
||||
# Dep to build Pollow
|
||||
if ! python3 -m venv --help &> /dev/null ; then
|
||||
echo "venv could not be found"
|
||||
echo "Run 'sudo apt install python3-venv' to fix."
|
||||
ERROR=1
|
||||
fi
|
||||
if [ $ERROR = 1 ] ; then
|
||||
echo
|
||||
echo "Fix errors and re-run ./start.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! i2cdetect -y 1 &> /dev/null ; then
|
||||
echo "i2cdetect -y 1 did not find a screen."
|
||||
exit 2
|
||||
fi
|
||||
if ! test -e venv; then
|
||||
echo "Creating python venv for OLED Screen"
|
||||
python3 -m venv venv
|
||||
echo "Activating venv"
|
||||
source venv/bin/activate
|
||||
echo "Installing requirements.txt"
|
||||
pip install -r requirements.txt
|
||||
git rev-parse HEAD > current
|
||||
fi
|
||||
|
||||
source venv/bin/activate
|
||||
|
||||
# Detect if someone updates - we need to re-run pip install.
|
||||
if ! test -e current; then
|
||||
git rev-parse > current
|
||||
else
|
||||
if [ "$(cat current)" != "$(git rev-parse HEAD)" ]; then
|
||||
echo "New version detected, updating requirements.txt"
|
||||
echo " This may take some time..."
|
||||
pip install wheel
|
||||
pip install -r requirements.txt
|
||||
git rev-parse HEAD > current
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Starting OLED Screen..."
|
||||
python3 rascsi_oled_monitor.py
|
@ -5,12 +5,12 @@
|
||||
//
|
||||
// Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp)
|
||||
// Copyright (C) 2014-2020 GIMONS
|
||||
// Copyright (C) akuker
|
||||
// Copyright (C) akuker
|
||||
//
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
//
|
||||
// [ SASI device controller ]
|
||||
// [ SASI device controller ]
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
#include "controllers/sasidev_ctrl.h"
|
||||
@ -39,10 +39,10 @@ SASIDEV::SASIDEV(Device *dev)
|
||||
{
|
||||
int i;
|
||||
|
||||
#ifndef RASCSI
|
||||
#ifndef RASCSI
|
||||
// Remember host device
|
||||
host = dev;
|
||||
#endif // RASCSI
|
||||
#endif // RASCSI
|
||||
|
||||
// Work initialization
|
||||
ctrl.phase = BUS::busfree;
|
||||
@ -51,7 +51,7 @@ SASIDEV::SASIDEV(Device *dev)
|
||||
memset(ctrl.cmd, 0x00, sizeof(ctrl.cmd));
|
||||
ctrl.status = 0x00;
|
||||
ctrl.message = 0x00;
|
||||
#ifdef RASCSI
|
||||
#ifdef RASCSI
|
||||
ctrl.execstart = 0;
|
||||
#endif // RASCSI
|
||||
ctrl.bufsize = std::max(0x800, ETH_FRAME_LEN + 16 + ETH_FCS_LEN);
|
||||
@ -98,9 +98,9 @@ void FASTCALL SASIDEV::Reset()
|
||||
ctrl.phase = BUS::busfree;
|
||||
ctrl.status = 0x00;
|
||||
ctrl.message = 0x00;
|
||||
#ifdef RASCSI
|
||||
#ifdef RASCSI
|
||||
ctrl.execstart = 0;
|
||||
#endif // RASCSI
|
||||
#endif // RASCSI
|
||||
memset(ctrl.buffer, 0x00, ctrl.bufsize);
|
||||
ctrl.blocks = 0;
|
||||
ctrl.next = 0;
|
||||
@ -442,10 +442,10 @@ void FASTCALL SASIDEV::Selection()
|
||||
//---------------------------------------------------------------------------
|
||||
void FASTCALL SASIDEV::Command()
|
||||
{
|
||||
#ifdef RASCSI
|
||||
#ifdef RASCSI
|
||||
int count;
|
||||
int i;
|
||||
#endif // RASCSI
|
||||
#endif // RASCSI
|
||||
|
||||
ASSERT(this);
|
||||
|
||||
@ -467,7 +467,7 @@ void FASTCALL SASIDEV::Command()
|
||||
ctrl.length = 6;
|
||||
ctrl.blocks = 1;
|
||||
|
||||
#ifdef RASCSI
|
||||
#ifdef RASCSI
|
||||
// Command reception handshake (10 bytes are automatically received at the first command)
|
||||
count = ctrl.bus->CommandHandShake(ctrl.buffer);
|
||||
|
||||
@ -499,13 +499,13 @@ void FASTCALL SASIDEV::Command()
|
||||
|
||||
// Execution Phase
|
||||
Execute();
|
||||
#else
|
||||
#else
|
||||
// Request the command
|
||||
ctrl.bus->SetREQ(TRUE);
|
||||
return;
|
||||
#endif // RASCSI
|
||||
#endif // RASCSI
|
||||
}
|
||||
#ifndef RASCSI
|
||||
#ifndef RASCSI
|
||||
// Requesting
|
||||
if (ctrl.bus->GetREQ()) {
|
||||
// Sent by the initiator
|
||||
@ -518,7 +518,7 @@ void FASTCALL SASIDEV::Command()
|
||||
ReceiveNext();
|
||||
}
|
||||
}
|
||||
#endif // RASCSI
|
||||
#endif // RASCSI
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@ -538,9 +538,9 @@ void FASTCALL SASIDEV::Execute()
|
||||
// Initialization for data transfer
|
||||
ctrl.offset = 0;
|
||||
ctrl.blocks = 1;
|
||||
#ifdef RASCSI
|
||||
#ifdef RASCSI
|
||||
ctrl.execstart = SysTimer::GetTimerLow();
|
||||
#endif // RASCSI
|
||||
#endif // RASCSI
|
||||
|
||||
// Process by command
|
||||
switch ((SCSIDEV::scsi_command)ctrl.cmd[0]) {
|
||||
@ -593,6 +593,16 @@ void FASTCALL SASIDEV::Execute()
|
||||
CmdAssign();
|
||||
return;
|
||||
|
||||
// RESERVE UNIT(16)
|
||||
case 0x16:
|
||||
CmdReserveUnit();
|
||||
return;
|
||||
|
||||
// RELEASE UNIT(17)
|
||||
case 0x17:
|
||||
CmdReleaseUnit();
|
||||
return;
|
||||
|
||||
// SPECIFY(SASIのみ)
|
||||
// This doesn't exist in the SCSI Spec, but was in the original RaSCSI code.
|
||||
// leaving it here for now....
|
||||
@ -615,17 +625,17 @@ void FASTCALL SASIDEV::Execute()
|
||||
//---------------------------------------------------------------------------
|
||||
void FASTCALL SASIDEV::Status()
|
||||
{
|
||||
#ifdef RASCSI
|
||||
#ifdef RASCSI
|
||||
DWORD min_exec_time;
|
||||
DWORD time;
|
||||
#endif // RASCSI
|
||||
#endif // RASCSI
|
||||
|
||||
ASSERT(this);
|
||||
|
||||
// Phase change
|
||||
if (ctrl.phase != BUS::status) {
|
||||
|
||||
#ifdef RASCSI
|
||||
#ifdef RASCSI
|
||||
// Minimum execution time
|
||||
if (ctrl.execstart > 0) {
|
||||
min_exec_time = IsSASI() ? min_exec_time_sasi : min_exec_time_scsi;
|
||||
@ -637,7 +647,7 @@ void FASTCALL SASIDEV::Status()
|
||||
} else {
|
||||
SysTimer::SleepUsec(5);
|
||||
}
|
||||
#endif // RASCSI
|
||||
#endif // RASCSI
|
||||
|
||||
LOGTRACE("%s Status phase", __PRETTY_FUNCTION__);
|
||||
|
||||
@ -655,7 +665,7 @@ void FASTCALL SASIDEV::Status()
|
||||
ctrl.blocks = 1;
|
||||
ctrl.buffer[0] = (BYTE)ctrl.status;
|
||||
|
||||
#ifndef RASCSI
|
||||
#ifndef RASCSI
|
||||
// Request status
|
||||
ctrl.bus->SetDAT(ctrl.buffer[0]);
|
||||
ctrl.bus->SetREQ(TRUE);
|
||||
@ -665,10 +675,10 @@ void FASTCALL SASIDEV::Status()
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef RASCSI
|
||||
#ifdef RASCSI
|
||||
// Send
|
||||
Send();
|
||||
#else
|
||||
#else
|
||||
// Requesting
|
||||
if (ctrl.bus->GetREQ()) {
|
||||
// Initiator received
|
||||
@ -681,7 +691,7 @@ void FASTCALL SASIDEV::Status()
|
||||
Send();
|
||||
}
|
||||
}
|
||||
#endif // RASCSI
|
||||
#endif // RASCSI
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@ -724,10 +734,10 @@ void FASTCALL SASIDEV::MsgIn()
|
||||
//---------------------------------------------------------------------------
|
||||
void FASTCALL SASIDEV::DataIn()
|
||||
{
|
||||
#ifdef RASCSI
|
||||
#ifdef RASCSI
|
||||
DWORD min_exec_time;
|
||||
DWORD time;
|
||||
#endif // RASCSI
|
||||
#endif // RASCSI
|
||||
|
||||
ASSERT(this);
|
||||
ASSERT(ctrl.length >= 0);
|
||||
@ -735,7 +745,7 @@ void FASTCALL SASIDEV::DataIn()
|
||||
// Phase change
|
||||
if (ctrl.phase != BUS::datain) {
|
||||
|
||||
#ifdef RASCSI
|
||||
#ifdef RASCSI
|
||||
// Minimum execution time
|
||||
if (ctrl.execstart > 0) {
|
||||
min_exec_time = IsSASI() ? min_exec_time_sasi : min_exec_time_scsi;
|
||||
@ -745,7 +755,7 @@ void FASTCALL SASIDEV::DataIn()
|
||||
}
|
||||
ctrl.execstart = 0;
|
||||
}
|
||||
#endif // RASCSI
|
||||
#endif // RASCSI
|
||||
|
||||
// If the length is 0, go to the status phase
|
||||
if (ctrl.length == 0) {
|
||||
@ -781,10 +791,10 @@ void FASTCALL SASIDEV::DataIn()
|
||||
//---------------------------------------------------------------------------
|
||||
void FASTCALL SASIDEV::DataOut()
|
||||
{
|
||||
#ifdef RASCSI
|
||||
#ifdef RASCSI
|
||||
DWORD min_exec_time;
|
||||
DWORD time;
|
||||
#endif // RASCSI
|
||||
#endif // RASCSI
|
||||
|
||||
ASSERT(this);
|
||||
ASSERT(ctrl.length >= 0);
|
||||
@ -792,7 +802,7 @@ void FASTCALL SASIDEV::DataOut()
|
||||
// Phase change
|
||||
if (ctrl.phase != BUS::dataout) {
|
||||
|
||||
#ifdef RASCSI
|
||||
#ifdef RASCSI
|
||||
// Minimum execution time
|
||||
if (ctrl.execstart > 0) {
|
||||
min_exec_time = IsSASI() ? min_exec_time_sasi : min_exec_time_scsi;
|
||||
@ -802,7 +812,7 @@ void FASTCALL SASIDEV::DataOut()
|
||||
}
|
||||
ctrl.execstart = 0;
|
||||
}
|
||||
#endif // RASCSI
|
||||
#endif // RASCSI
|
||||
|
||||
// If the length is 0, go to the status phase
|
||||
if (ctrl.length == 0) {
|
||||
@ -825,17 +835,17 @@ void FASTCALL SASIDEV::DataOut()
|
||||
ASSERT(ctrl.blocks > 0);
|
||||
ctrl.offset = 0;
|
||||
|
||||
#ifndef RASCSI
|
||||
#ifndef RASCSI
|
||||
// Request data
|
||||
ctrl.bus->SetREQ(TRUE);
|
||||
#endif // RASCSI
|
||||
#endif // RASCSI
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef RASCSI
|
||||
#ifdef RASCSI
|
||||
// Receive
|
||||
Receive();
|
||||
#else
|
||||
#else
|
||||
// Requesting
|
||||
if (ctrl.bus->GetREQ()) {
|
||||
// Sent by the initiator
|
||||
@ -848,7 +858,7 @@ void FASTCALL SASIDEV::DataOut()
|
||||
ReceiveNext();
|
||||
}
|
||||
}
|
||||
#endif // RASCSI
|
||||
#endif // RASCSI
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@ -1057,6 +1067,44 @@ void FASTCALL SASIDEV::CmdReassign()
|
||||
Status();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// RESERVE UNIT(16)
|
||||
//
|
||||
// The reserve/release commands are only used in multi-initiator
|
||||
// environments. RaSCSI doesn't support this use case. However, some old
|
||||
// versions of Solaris will issue the reserve/release commands. We will
|
||||
// just respond with an OK status.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
void FASTCALL SASIDEV::CmdReserveUnit()
|
||||
{
|
||||
ASSERT(this);
|
||||
LOGTRACE( "%s Reserve(6) Command", __PRETTY_FUNCTION__);
|
||||
|
||||
// status phase
|
||||
Status();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// RELEASE UNIT(17)
|
||||
//
|
||||
// The reserve/release commands are only used in multi-initiator
|
||||
// environments. RaSCSI doesn't support this use case. However, some old
|
||||
// versions of Solaris will issue the reserve/release commands. We will
|
||||
// just respond with an OK status.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
void FASTCALL SASIDEV::CmdReleaseUnit()
|
||||
{
|
||||
ASSERT(this);
|
||||
LOGTRACE( "%s Release(6) Command", __PRETTY_FUNCTION__);
|
||||
|
||||
// status phase
|
||||
Status();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// READ(6)
|
||||
@ -1373,9 +1421,9 @@ void FASTCALL SASIDEV::CmdInvalid()
|
||||
//---------------------------------------------------------------------------
|
||||
void FASTCALL SASIDEV::Send()
|
||||
{
|
||||
#ifdef RASCSI
|
||||
#ifdef RASCSI
|
||||
int len;
|
||||
#endif // RASCSI
|
||||
#endif // RASCSI
|
||||
BOOL result;
|
||||
|
||||
ASSERT(this);
|
||||
@ -1416,7 +1464,7 @@ void FASTCALL SASIDEV::Send()
|
||||
LOGTRACE("%s processing after data collection", __PRETTY_FUNCTION__);
|
||||
#ifndef RASCSI
|
||||
ctrl.bus->SetDAT(ctrl.buffer[ctrl.offset]);
|
||||
#endif // RASCSI
|
||||
#endif // RASCSI
|
||||
}
|
||||
}
|
||||
|
||||
@ -1431,10 +1479,10 @@ void FASTCALL SASIDEV::Send()
|
||||
if (ctrl.blocks != 0){
|
||||
ASSERT(ctrl.length > 0);
|
||||
ASSERT(ctrl.offset == 0);
|
||||
#ifndef RASCSI
|
||||
#ifndef RASCSI
|
||||
// Signal line operated by the target
|
||||
ctrl.bus->SetREQ(TRUE);
|
||||
#endif // RASCSI
|
||||
#endif // RASCSI
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1558,9 +1606,9 @@ void FASTCALL SASIDEV::Receive()
|
||||
void FASTCALL SASIDEV::ReceiveNext()
|
||||
#endif // RASCSI
|
||||
{
|
||||
#ifdef RASCSI
|
||||
#ifdef RASCSI
|
||||
int len;
|
||||
#endif // RASCSI
|
||||
#endif // RASCSI
|
||||
BOOL result;
|
||||
|
||||
ASSERT(this);
|
||||
@ -1569,7 +1617,7 @@ void FASTCALL SASIDEV::ReceiveNext()
|
||||
ASSERT(!ctrl.bus->GetREQ());
|
||||
ASSERT(!ctrl.bus->GetIO());
|
||||
|
||||
#ifdef RASCSI
|
||||
#ifdef RASCSI
|
||||
// Length != 0 if received
|
||||
if (ctrl.length != 0) {
|
||||
// Receive
|
||||
@ -1604,7 +1652,7 @@ void FASTCALL SASIDEV::ReceiveNext()
|
||||
ctrl.bus->SetREQ(TRUE);
|
||||
return;
|
||||
}
|
||||
#endif // RASCSI
|
||||
#endif // RASCSI
|
||||
|
||||
// Remove the control block and initialize the result
|
||||
ctrl.blocks--;
|
||||
@ -1631,22 +1679,22 @@ void FASTCALL SASIDEV::ReceiveNext()
|
||||
if (ctrl.blocks != 0){
|
||||
ASSERT(ctrl.length > 0);
|
||||
ASSERT(ctrl.offset == 0);
|
||||
#ifndef RASCSI
|
||||
#ifndef RASCSI
|
||||
// Signal line operated by the target
|
||||
ctrl.bus->SetREQ(TRUE);
|
||||
#endif // RASCSI
|
||||
#endif // RASCSI
|
||||
return;
|
||||
}
|
||||
|
||||
// Move to the next phase
|
||||
switch (ctrl.phase) {
|
||||
#ifndef RASCSI
|
||||
#ifndef RASCSI
|
||||
// Command phase
|
||||
case BUS::command:
|
||||
// Execution Phase
|
||||
Execute();
|
||||
break;
|
||||
#endif // RASCSI
|
||||
#endif // RASCSI
|
||||
|
||||
// Data out phase
|
||||
case BUS::dataout:
|
||||
|
@ -5,12 +5,12 @@
|
||||
//
|
||||
// Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp)
|
||||
// Copyright (C) 2014-2020 GIMONS
|
||||
// Copyright (C) akuker
|
||||
// Copyright (C) akuker
|
||||
//
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
//
|
||||
// [ SASI device controller ]
|
||||
// [ SASI device controller ]
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma once
|
||||
@ -31,18 +31,17 @@
|
||||
class SASIDEV
|
||||
{
|
||||
public:
|
||||
// Maximum number of logical units
|
||||
enum {
|
||||
UnitMax = 8
|
||||
UnitMax = 8 // Maximum number of logical units
|
||||
};
|
||||
|
||||
#ifdef RASCSI
|
||||
#ifdef RASCSI
|
||||
// For timing adjustments
|
||||
enum {
|
||||
enum {
|
||||
min_exec_time_sasi = 100, // SASI BOOT/FORMAT 30:NG 35:OK
|
||||
min_exec_time_scsi = 50
|
||||
};
|
||||
#endif // RASCSI
|
||||
#endif // RASCSI
|
||||
|
||||
// Internal data definition
|
||||
typedef struct {
|
||||
@ -56,154 +55,113 @@ public:
|
||||
DWORD status; // Status data
|
||||
DWORD message; // Message data
|
||||
|
||||
#ifdef RASCSI
|
||||
#ifdef RASCSI
|
||||
// Run
|
||||
DWORD execstart; // Execution start time
|
||||
#endif // RASCSI
|
||||
#endif // RASCSI
|
||||
|
||||
// Transfer
|
||||
BYTE *buffer; // Transfer data buffer
|
||||
int bufsize; // Transfer data buffer size
|
||||
DWORD blocks; // Number of transfer block
|
||||
DWORD next; // Next record
|
||||
DWORD next; // Next record
|
||||
DWORD offset; // Transfer offset
|
||||
DWORD length; // Transfer remaining length
|
||||
|
||||
// Logical unit
|
||||
Disk *unit[UnitMax];
|
||||
// Logical Unit
|
||||
Disk *unit[UnitMax]; // Logical Unit
|
||||
} ctrl_t;
|
||||
|
||||
public:
|
||||
// Basic Functions
|
||||
#ifdef RASCSI
|
||||
#ifdef RASCSI
|
||||
SASIDEV();
|
||||
#else
|
||||
SASIDEV(Device *dev);
|
||||
#endif //RASCSI
|
||||
#else
|
||||
|
||||
// Constructor
|
||||
virtual ~SASIDEV();
|
||||
// Destructor
|
||||
virtual void FASTCALL Reset();
|
||||
// Device Reset
|
||||
#ifndef RASCSI
|
||||
virtual BOOL FASTCALL Save(Fileio *fio, int ver);
|
||||
// Save
|
||||
virtual BOOL FASTCALL Load(Fileio *fio, int ver);
|
||||
// Load
|
||||
#endif //RASCSI
|
||||
SASIDEV(Device *dev); // Constructor
|
||||
|
||||
#endif //RASCSI
|
||||
virtual ~SASIDEV(); // Destructor
|
||||
virtual void FASTCALL Reset(); // Device Reset
|
||||
|
||||
#ifndef RASCSI
|
||||
virtual BOOL FASTCALL Save(Fileio *fio, int ver); // Save
|
||||
virtual BOOL FASTCALL Load(Fileio *fio, int ver); // Load
|
||||
#endif //RASCSI
|
||||
|
||||
// External API
|
||||
virtual BUS::phase_t FASTCALL Process();
|
||||
// Run
|
||||
virtual BUS::phase_t FASTCALL Process(); // Run
|
||||
|
||||
// Connect
|
||||
void FASTCALL Connect(int id, BUS *sbus);
|
||||
// Controller connection
|
||||
Disk* FASTCALL GetUnit(int no);
|
||||
// Get logical unit
|
||||
void FASTCALL SetUnit(int no, Disk *dev);
|
||||
// Logical unit setting
|
||||
BOOL FASTCALL HasUnit();
|
||||
// Has a valid logical unit
|
||||
void FASTCALL Connect(int id, BUS *sbus); // Controller connection
|
||||
Disk* FASTCALL GetUnit(int no); // Get logical unit
|
||||
void FASTCALL SetUnit(int no, Disk *dev); // Logical unit setting
|
||||
BOOL FASTCALL HasUnit(); // Has a valid logical unit
|
||||
|
||||
// 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
|
||||
BUS::phase_t FASTCALL GetPhase() {return ctrl.phase;} // Get the phase
|
||||
#ifdef DISK_LOG
|
||||
|
||||
int FASTCALL GetSCSIID() {return ctrl.m_scsi_id;}
|
||||
// Get the ID
|
||||
void FASTCALL GetCTRL(ctrl_t *buffer);
|
||||
// Get the internal information
|
||||
ctrl_t* FASTCALL GetWorkAddr() { return &ctrl; }
|
||||
// Get the internal information address
|
||||
virtual BOOL FASTCALL IsSASI() const {return TRUE;}
|
||||
// SASI Check
|
||||
virtual BOOL FASTCALL IsSCSI() const {return FALSE;}
|
||||
// SCSI check
|
||||
Disk* FASTCALL GetBusyUnit();
|
||||
// Get the busy unit
|
||||
// Function to get the current phase as a String.
|
||||
void FASTCALL GetPhaseStr(char *str);
|
||||
#endif
|
||||
|
||||
int FASTCALL GetSCSIID() {return ctrl.m_scsi_id;} // Get the ID
|
||||
void FASTCALL GetCTRL(ctrl_t *buffer); // Get the internal information
|
||||
ctrl_t* FASTCALL GetWorkAddr() { return &ctrl; } // Get the internal information address
|
||||
virtual BOOL FASTCALL IsSASI() const {return TRUE;} // SASI Check
|
||||
virtual BOOL FASTCALL IsSCSI() const {return FALSE;} // SCSI check
|
||||
Disk* FASTCALL GetBusyUnit(); // Get the busy unit
|
||||
|
||||
protected:
|
||||
// Phase processing
|
||||
virtual void FASTCALL BusFree();
|
||||
// Bus free phase
|
||||
virtual void FASTCALL Selection();
|
||||
// Selection phase
|
||||
virtual void FASTCALL Command();
|
||||
// Command phase
|
||||
virtual void FASTCALL Execute();
|
||||
// Execution phase
|
||||
void FASTCALL Status();
|
||||
// Status phase
|
||||
void FASTCALL MsgIn();
|
||||
// Message in phase
|
||||
void FASTCALL DataIn();
|
||||
// Data in phase
|
||||
void FASTCALL DataOut();
|
||||
// Data out phase
|
||||
virtual void FASTCALL Error();
|
||||
// Common error handling
|
||||
virtual void FASTCALL BusFree(); // Bus free phase
|
||||
virtual void FASTCALL Selection(); // Selection phase
|
||||
virtual void FASTCALL Command(); // Command phase
|
||||
virtual void FASTCALL Execute(); // Execution phase
|
||||
void FASTCALL Status(); // Status phase
|
||||
void FASTCALL MsgIn(); // Message in phase
|
||||
void FASTCALL DataIn(); // Data in phase
|
||||
void FASTCALL DataOut(); // Data out phase
|
||||
virtual void FASTCALL Error(); // Common error handling
|
||||
|
||||
// commands
|
||||
void FASTCALL CmdTestUnitReady();
|
||||
// TEST UNIT READY command
|
||||
void FASTCALL CmdRezero();
|
||||
// REZERO UNIT command
|
||||
void FASTCALL CmdRequestSense();
|
||||
// REQUEST SENSE command
|
||||
void FASTCALL CmdFormat();
|
||||
// FORMAT command
|
||||
void FASTCALL CmdReassign();
|
||||
// REASSIGN BLOCKS command
|
||||
virtual void FASTCALL CmdRead6();
|
||||
// READ(6) command
|
||||
virtual void FASTCALL CmdWrite6();
|
||||
// WRITE(6) command
|
||||
void FASTCALL CmdSeek6();
|
||||
// SEEK(6) command
|
||||
void FASTCALL CmdAssign();
|
||||
// ASSIGN command
|
||||
void FASTCALL CmdSpecify();
|
||||
// SPECIFY command
|
||||
void FASTCALL CmdInvalid();
|
||||
// Unsupported command
|
||||
void FASTCALL DaynaPortWrite();
|
||||
// DaynaPort specific 'write' operation
|
||||
|
||||
void FASTCALL CmdTestUnitReady(); // TEST UNIT READY command
|
||||
void FASTCALL CmdRezero(); // REZERO UNIT command
|
||||
void FASTCALL CmdRequestSense(); // REQUEST SENSE command
|
||||
void FASTCALL CmdFormat(); // FORMAT command
|
||||
void FASTCALL CmdReassign(); // REASSIGN BLOCKS command
|
||||
void FASTCALL CmdReserveUnit(); // RESERVE UNIT command
|
||||
void FASTCALL CmdReleaseUnit(); // RELEASE UNIT command
|
||||
void FASTCALL CmdRead6(); // READ(6) command
|
||||
void FASTCALL CmdWrite6(); // WRITE(6) command
|
||||
void FASTCALL CmdSeek6(); // SEEK(6) command
|
||||
void FASTCALL CmdAssign(); // ASSIGN command
|
||||
void FASTCALL CmdSpecify(); // SPECIFY command
|
||||
void FASTCALL CmdInvalid(); // Unsupported command
|
||||
void FASTCALL DaynaPortWrite(); // DaynaPort specific 'write' operation
|
||||
// データ転送
|
||||
virtual void FASTCALL Send();
|
||||
// Send data
|
||||
#ifndef RASCSI
|
||||
virtual void FASTCALL SendNext();
|
||||
// Continue sending data
|
||||
#endif // RASCSI
|
||||
virtual void FASTCALL Receive();
|
||||
// Receive data
|
||||
#ifndef RASCSI
|
||||
virtual void FASTCALL ReceiveNext();
|
||||
// Continue receiving data
|
||||
#endif // RASCSI
|
||||
BOOL FASTCALL XferIn(BYTE* buf);
|
||||
// Data transfer IN
|
||||
BOOL FASTCALL XferOut(BOOL cont);
|
||||
// Data transfer OUT
|
||||
virtual void FASTCALL Send(); // Send data
|
||||
|
||||
#ifndef RASCSI
|
||||
virtual void FASTCALL SendNext(); // Continue sending data
|
||||
#endif // RASCSI
|
||||
|
||||
virtual void FASTCALL Receive(); // Receive data
|
||||
|
||||
#ifndef RASCSI
|
||||
virtual void FASTCALL ReceiveNext(); // Continue receiving data
|
||||
#endif // RASCSI
|
||||
|
||||
BOOL FASTCALL XferIn(BYTE* buf); // Data transfer IN
|
||||
BOOL FASTCALL XferOut(BOOL cont); // Data transfer OUT
|
||||
|
||||
// Special operations
|
||||
void FASTCALL FlushUnit();
|
||||
// Flush the logical unit
|
||||
void FASTCALL FlushUnit(); // Flush the logical unit
|
||||
|
||||
protected:
|
||||
#ifndef RASCSI
|
||||
Device *host;
|
||||
// Host device
|
||||
#endif // RASCSI
|
||||
|
||||
ctrl_t ctrl;
|
||||
// Internal data
|
||||
#ifndef RASCSI
|
||||
Device *host; // Host device
|
||||
#endif // RASCSI
|
||||
ctrl_t ctrl; // Internal data
|
||||
};
|
||||
|
@ -5,12 +5,12 @@
|
||||
//
|
||||
// Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp)
|
||||
// Copyright (C) 2014-2020 GIMONS
|
||||
// Copyright (C) akuker
|
||||
// Copyright (C) akuker
|
||||
//
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
//
|
||||
// [ SCSI device controller ]
|
||||
// [ SCSI device controller ]
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
#include "log.h"
|
||||
@ -250,9 +250,9 @@ void FASTCALL SCSIDEV::Execute()
|
||||
// Initialization for data transfer
|
||||
ctrl.offset = 0;
|
||||
ctrl.blocks = 1;
|
||||
#ifdef RASCSI
|
||||
#ifdef RASCSI
|
||||
ctrl.execstart = SysTimer::GetTimerLow();
|
||||
#endif // RASCSI
|
||||
#endif // RASCSI
|
||||
|
||||
// Process by command
|
||||
switch ((scsi_command)ctrl.cmd[0]) {
|
||||
@ -333,6 +333,30 @@ void FASTCALL SCSIDEV::Execute()
|
||||
CmdModeSelect();
|
||||
return;
|
||||
|
||||
// RESERVE(6)
|
||||
case eCmdReserve6:
|
||||
LOGDEBUG("++++ CMD ++++ %s Received eCmdReserve6", __PRETTY_FUNCTION__);
|
||||
CmdReserve6();
|
||||
return;
|
||||
|
||||
// RESERVE(10)
|
||||
case eCmdReserve10:
|
||||
LOGDEBUG("++++ CMD ++++ %s Received eCmdReserve10", __PRETTY_FUNCTION__);
|
||||
CmdReserve10();
|
||||
return;
|
||||
|
||||
// RELEASE(6)
|
||||
case eCmdRelease6:
|
||||
LOGDEBUG("++++ CMD ++++ %s Received eCmdRelease6", __PRETTY_FUNCTION__);
|
||||
CmdRelease6();
|
||||
return;
|
||||
|
||||
// RELEASE(10)
|
||||
case eCmdRelease10:
|
||||
LOGDEBUG("++++ CMD ++++ %s Received eCmdRelease10", __PRETTY_FUNCTION__);
|
||||
CmdRelease10();
|
||||
return;
|
||||
|
||||
// MODE SENSE
|
||||
case eCmdModeSense:
|
||||
LOGDEBUG("++++ CMD ++++ %s Received eCmdModeSense", __PRETTY_FUNCTION__);
|
||||
@ -454,8 +478,7 @@ void FASTCALL SCSIDEV::MsgOut()
|
||||
|
||||
LOGTRACE("Message Out Phase");
|
||||
|
||||
// Message out phase after selection
|
||||
// process the IDENTIFY message
|
||||
// process the IDENTIFY message
|
||||
if (ctrl.phase == BUS::selection) {
|
||||
scsi.atnmsg = TRUE;
|
||||
scsi.msc = 0;
|
||||
@ -475,10 +498,10 @@ void FASTCALL SCSIDEV::MsgOut()
|
||||
ctrl.length = 1;
|
||||
ctrl.blocks = 1;
|
||||
|
||||
#ifndef RASCSI
|
||||
#ifndef RASCSI
|
||||
// Request message
|
||||
ctrl.bus->SetREQ(TRUE);
|
||||
#endif // RASCSI
|
||||
#endif // RASCSI
|
||||
return;
|
||||
}
|
||||
|
||||
@ -613,6 +636,83 @@ void FASTCALL SCSIDEV::CmdModeSelect()
|
||||
DataOut();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// RESERVE(6)
|
||||
//
|
||||
// The reserve/release commands are only used in multi-initiator
|
||||
// environments. RaSCSI doesn't support this use case. However, some old
|
||||
// versions of Solaris will issue the reserve/release commands. We will
|
||||
// just respond with an OK status.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
void FASTCALL SCSIDEV::CmdReserve6()
|
||||
{
|
||||
ASSERT(this);
|
||||
|
||||
LOGTRACE( "%s Reserve(6) Command", __PRETTY_FUNCTION__);
|
||||
|
||||
// status phase
|
||||
Status();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// RESERVE(10)
|
||||
//
|
||||
// The reserve/release commands are only used in multi-initiator
|
||||
// environments. RaSCSI doesn't support this use case. However, some old
|
||||
// versions of Solaris will issue the reserve/release commands. We will
|
||||
// just respond with an OK status.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
void FASTCALL SCSIDEV::CmdReserve10()
|
||||
{
|
||||
ASSERT(this);
|
||||
LOGTRACE( "%s Reserve(10) Command", __PRETTY_FUNCTION__);
|
||||
|
||||
// status phase
|
||||
Status();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// RELEASE(6)
|
||||
//
|
||||
// The reserve/release commands are only used in multi-initiator
|
||||
// environments. RaSCSI doesn't support this use case. However, some old
|
||||
// versions of Solaris will issue the reserve/release commands. We will
|
||||
// just respond with an OK status.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
void FASTCALL SCSIDEV::CmdRelease6()
|
||||
{
|
||||
ASSERT(this);
|
||||
LOGTRACE( "%s Release(6) Command", __PRETTY_FUNCTION__);
|
||||
|
||||
// status phase
|
||||
Status();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// RELEASE(10)
|
||||
//
|
||||
// The reserve/release commands are only used in multi-initiator
|
||||
// environments. RaSCSI doesn't support this use case. However, some old
|
||||
// versions of Solaris will issue the reserve/release commands. We will
|
||||
// just respond with an OK status.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
void FASTCALL SCSIDEV::CmdRelease10()
|
||||
{
|
||||
ASSERT(this);
|
||||
LOGTRACE( "%s Release(10) Command", __PRETTY_FUNCTION__);
|
||||
|
||||
// status phase
|
||||
Status();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// MODE SENSE
|
||||
@ -1038,7 +1138,6 @@ void FASTCALL SCSIDEV::CmdSynchronizeCache()
|
||||
void FASTCALL SCSIDEV::CmdReadDefectData10()
|
||||
{
|
||||
DWORD lun;
|
||||
|
||||
ASSERT(this);
|
||||
|
||||
LOGTRACE( "%s READ DEFECT DATA(10) Command ", __PRETTY_FUNCTION__);
|
||||
@ -1071,7 +1170,6 @@ void FASTCALL SCSIDEV::CmdReadDefectData10()
|
||||
void FASTCALL SCSIDEV::CmdReadToc()
|
||||
{
|
||||
DWORD lun;
|
||||
|
||||
ASSERT(this);
|
||||
|
||||
// Logical Unit
|
||||
@ -1553,16 +1651,16 @@ void FASTCALL SCSIDEV::CmdEnableInterface()
|
||||
//---------------------------------------------------------------------------
|
||||
void FASTCALL SCSIDEV::Send()
|
||||
{
|
||||
#ifdef RASCSI
|
||||
#ifdef RASCSI
|
||||
int len;
|
||||
#endif // RASCSI
|
||||
#endif // RASCSI
|
||||
BOOL result;
|
||||
|
||||
ASSERT(this);
|
||||
ASSERT(!ctrl.bus->GetREQ());
|
||||
ASSERT(ctrl.bus->GetIO());
|
||||
|
||||
#ifdef RASCSI
|
||||
#ifdef RASCSI
|
||||
//if Length! = 0, send
|
||||
if (ctrl.length != 0) {
|
||||
LOGTRACE("%s sending handhake with offset %lu, length %lu", __PRETTY_FUNCTION__, ctrl.offset, ctrl.length);
|
||||
@ -1591,20 +1689,20 @@ void FASTCALL SCSIDEV::Send()
|
||||
ctrl.length = 0;
|
||||
return;
|
||||
}
|
||||
#else
|
||||
#else
|
||||
// offset and length
|
||||
ASSERT(ctrl.length >= 1);
|
||||
ctrl.offset++;
|
||||
ctrl.length--;
|
||||
|
||||
// Immediately after ACK is asserted, if the data has been
|
||||
// set by SendNext, raise the request
|
||||
if (ctrl.length != 0) {
|
||||
// set by SendNext, raise the request
|
||||
if (ctrl.length != 0) {
|
||||
// Signal line operated by the target
|
||||
ctrl.bus->SetREQ(TRUE);
|
||||
return;
|
||||
}
|
||||
#endif // RASCSI
|
||||
#endif // RASCSI
|
||||
|
||||
// Block subtraction, result initialization
|
||||
ctrl.blocks--;
|
||||
@ -1613,12 +1711,12 @@ void FASTCALL SCSIDEV::Send()
|
||||
// Processing after data collection (read/data-in only)
|
||||
if (ctrl.phase == BUS::datain) {
|
||||
if (ctrl.blocks != 0) {
|
||||
// // set next buffer (set offset, length)
|
||||
// set next buffer (set offset, length)
|
||||
result = XferIn(ctrl.buffer);
|
||||
LOGTRACE("%s processing after data collection. Blocks: %lu", __PRETTY_FUNCTION__, ctrl.blocks);
|
||||
#ifndef RASCSI
|
||||
ctrl.bus->SetDAT(ctrl.buffer[ctrl.offset]);
|
||||
#endif // RASCSI
|
||||
#endif // RASCSI
|
||||
}
|
||||
}
|
||||
|
||||
@ -1633,10 +1731,10 @@ void FASTCALL SCSIDEV::Send()
|
||||
LOGTRACE("%s Continuing to send. blocks = %lu", __PRETTY_FUNCTION__, ctrl.blocks);
|
||||
ASSERT(ctrl.length > 0);
|
||||
ASSERT(ctrl.offset == 0);
|
||||
#ifndef RASCSI
|
||||
#ifndef RASCSI
|
||||
// Signal line operated by the target
|
||||
ctrl.bus->SetREQ(TRUE);
|
||||
#endif // RASCSI
|
||||
#endif // RASCSI
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1820,7 +1918,6 @@ void FASTCALL SCSIDEV::Receive()
|
||||
ctrl.offset = 0;
|
||||
ctrl.length = 1;
|
||||
ctrl.blocks = 1;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -5,12 +5,12 @@
|
||||
//
|
||||
// Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp)
|
||||
// Copyright (C) 2014-2020 GIMONS
|
||||
// Copyright (C) akuker
|
||||
// Copyright (C) akuker
|
||||
//
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
//
|
||||
// [ SCSI device controller ]
|
||||
// [ SCSI device controller ]
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma once
|
||||
@ -80,6 +80,8 @@ public:
|
||||
eCmdEnableInterface = 0x0E, // DaynaPort specific command
|
||||
eCmdInquiry = 0x12,
|
||||
eCmdModeSelect = 0x15,
|
||||
eCmdReserve6 = 0x16,
|
||||
eCmdRelease6 = 0x17,
|
||||
eCmdModeSense = 0x1A,
|
||||
eCmdStartStop = 0x1B,
|
||||
eCmdRcvDiag = 0x1C,
|
||||
@ -98,6 +100,8 @@ public:
|
||||
eCmdPlayAudioMSF = 0x47,
|
||||
eCmdPlayAudioTrack = 0x48,
|
||||
eCmdModeSelect10 = 0x55,
|
||||
eCmdReserve10 = 0x56,
|
||||
eCmdRelease10 = 0x57,
|
||||
eCmdModeSense10 = 0x5A,
|
||||
eCmdInvalid = 0xC2, // (SASI only/Suppress warning when using SxSI)
|
||||
eCmdSasiCmdAssign = 0x0e, // This isn't used by SCSI, and can probably be removed.
|
||||
@ -108,104 +112,66 @@ public:
|
||||
SCSIDEV();
|
||||
// Constructor
|
||||
|
||||
void FASTCALL Reset();
|
||||
// Device Reset
|
||||
void FASTCALL Reset(); // Device Reset
|
||||
|
||||
// 外部API
|
||||
BUS::phase_t FASTCALL Process();
|
||||
// Run
|
||||
BUS::phase_t FASTCALL Process(); // Run
|
||||
|
||||
void FASTCALL SyncTransfer(BOOL enable) { scsi.syncenable = enable; }
|
||||
// Synchronouse transfer enable setting
|
||||
void FASTCALL SyncTransfer(BOOL enable) { scsi.syncenable = enable; } // Synchronouse transfer enable setting
|
||||
|
||||
// Other
|
||||
BOOL FASTCALL IsSASI() const {return FALSE;}
|
||||
// SASI Check
|
||||
BOOL FASTCALL IsSCSI() const {return TRUE;}
|
||||
// SCSI check
|
||||
BOOL FASTCALL IsSASI() const {return FALSE;} // SASI Check
|
||||
BOOL FASTCALL IsSCSI() const {return TRUE;} // SCSI check
|
||||
|
||||
private:
|
||||
// Phase
|
||||
void FASTCALL BusFree();
|
||||
// Bus free phase
|
||||
void FASTCALL Selection();
|
||||
// Selection phase
|
||||
void FASTCALL Execute();
|
||||
// Execution phase
|
||||
void FASTCALL MsgOut();
|
||||
// Message out phase
|
||||
void FASTCALL Error();
|
||||
// Common erorr handling
|
||||
void FASTCALL BusFree(); // Bus free phase
|
||||
void FASTCALL Selection(); // Selection phase
|
||||
void FASTCALL Execute(); // Execution phase
|
||||
void FASTCALL MsgOut(); // Message out phase
|
||||
void FASTCALL Error(); // Common erorr handling
|
||||
|
||||
// commands
|
||||
void FASTCALL CmdInquiry();
|
||||
// INQUIRY command
|
||||
void FASTCALL CmdModeSelect();
|
||||
// MODE SELECT command
|
||||
void FASTCALL CmdModeSense();
|
||||
// MODE SENSE command
|
||||
void FASTCALL CmdStartStop();
|
||||
// START STOP UNIT command
|
||||
void FASTCALL CmdSendDiag();
|
||||
// SEND DIAGNOSTIC command
|
||||
void FASTCALL CmdRemoval();
|
||||
// PREVENT/ALLOW MEDIUM REMOVAL command
|
||||
void FASTCALL CmdReadCapacity();
|
||||
// READ CAPACITY command
|
||||
void FASTCALL CmdRead10();
|
||||
// READ(10) command
|
||||
void FASTCALL CmdWrite10();
|
||||
// WRITE(10) command
|
||||
void FASTCALL CmdSeek10();
|
||||
// SEEK(10) command
|
||||
void FASTCALL CmdVerify();
|
||||
// VERIFY command
|
||||
void FASTCALL CmdSynchronizeCache();
|
||||
// SYNCHRONIZE CACHE command
|
||||
void FASTCALL CmdReadDefectData10();
|
||||
// READ DEFECT DATA(10) command
|
||||
void FASTCALL CmdReadToc();
|
||||
// READ TOC command
|
||||
void FASTCALL CmdPlayAudio10();
|
||||
// PLAY AUDIO(10) command
|
||||
void FASTCALL CmdPlayAudioMSF();
|
||||
// PLAY AUDIO MSF command
|
||||
void FASTCALL CmdPlayAudioTrack();
|
||||
// PLAY AUDIO TRACK INDEX command
|
||||
void FASTCALL CmdModeSelect10();
|
||||
// MODE SELECT(10) command
|
||||
void FASTCALL CmdModeSense10();
|
||||
// MODE SENSE(10) command
|
||||
void FASTCALL CmdGetMessage10();
|
||||
// GET MESSAGE(10) command
|
||||
void FASTCALL CmdSendMessage10();
|
||||
// SEND MESSAGE(10) command
|
||||
void FASTCALL CmdRetrieveStats();
|
||||
// DaynaPort specific command
|
||||
void FASTCALL CmdSetIfaceMode();
|
||||
// DaynaPort specific command
|
||||
void FASTCALL CmdSetMcastAddr();
|
||||
// DaynaPort specific command
|
||||
void FASTCALL CmdEnableInterface();
|
||||
// DaynaPort specific command
|
||||
void FASTCALL CmdInquiry(); // INQUIRY command
|
||||
void FASTCALL CmdModeSelect(); // MODE SELECT command
|
||||
void FASTCALL CmdReserve6(); // RESERVE(6) command
|
||||
void FASTCALL CmdReserve10(); // RESERVE(10) command
|
||||
void FASTCALL CmdRelease6(); // RELEASE(6) command
|
||||
void FASTCALL CmdRelease10(); // RELEASE(10) command
|
||||
void FASTCALL CmdModeSense(); // MODE SENSE command
|
||||
void FASTCALL CmdStartStop(); // START STOP UNIT command
|
||||
void FASTCALL CmdSendDiag(); // SEND DIAGNOSTIC command
|
||||
void FASTCALL CmdRemoval(); // PREVENT/ALLOW MEDIUM REMOVAL command
|
||||
void FASTCALL CmdReadCapacity(); // READ CAPACITY command
|
||||
void FASTCALL CmdRead10(); // READ(10) command
|
||||
void FASTCALL CmdWrite10(); // WRITE(10) command
|
||||
void FASTCALL CmdSeek10(); // SEEK(10) command
|
||||
void FASTCALL CmdVerify(); // VERIFY command
|
||||
void FASTCALL CmdSynchronizeCache(); // SYNCHRONIZE CACHE command
|
||||
void FASTCALL CmdReadDefectData10(); // READ DEFECT DATA(10) command
|
||||
void FASTCALL CmdReadToc(); // READ TOC command
|
||||
void FASTCALL CmdPlayAudio10(); // PLAY AUDIO(10) command
|
||||
void FASTCALL CmdPlayAudioMSF(); // PLAY AUDIO MSF command
|
||||
void FASTCALL CmdPlayAudioTrack(); // PLAY AUDIO TRACK INDEX command
|
||||
void FASTCALL CmdModeSelect10(); // MODE SELECT(10) command
|
||||
void FASTCALL CmdModeSense10(); // MODE SENSE(10) command
|
||||
void FASTCALL CmdGetMessage10(); // GET MESSAGE(10) command
|
||||
void FASTCALL CmdSendMessage10(); // SEND MESSAGE(10) command
|
||||
void FASTCALL CmdRetrieveStats(); // DaynaPort specific command
|
||||
void FASTCALL CmdSetIfaceMode(); // DaynaPort specific command
|
||||
void FASTCALL CmdSetMcastAddr(); // DaynaPort specific command
|
||||
void FASTCALL CmdEnableInterface(); // DaynaPort specific command
|
||||
// データ転送
|
||||
void FASTCALL Send(); // Send data
|
||||
#ifndef RASCSI
|
||||
void FASTCALL SendNext(); // Continue sending data
|
||||
#endif // RASCSI
|
||||
void FASTCALL Receive(); // Receive data
|
||||
#ifndef RASCSI
|
||||
void FASTCALL ReceiveNext(); // Continue receiving data
|
||||
#endif // RASCSI
|
||||
BOOL FASTCALL XferMsg(DWORD msg); // Data transfer message
|
||||
|
||||
// Data transfer
|
||||
void FASTCALL Send();
|
||||
// Send data
|
||||
#ifndef RASCSI
|
||||
void FASTCALL SendNext();
|
||||
// Continue sending data
|
||||
#endif // RASCSI
|
||||
void FASTCALL Receive();
|
||||
// Receive data
|
||||
#ifndef RASCSI
|
||||
void FASTCALL ReceiveNext();
|
||||
// Continue receiving data
|
||||
#endif // RASCSI
|
||||
BOOL FASTCALL XferMsg(DWORD msg);
|
||||
// Data transfer message
|
||||
|
||||
scsi_t scsi;
|
||||
// Internal data
|
||||
scsi_t scsi; // Internal data
|
||||
};
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -32,40 +32,29 @@ class CTapDriver
|
||||
{
|
||||
public:
|
||||
// Basic Functionality
|
||||
CTapDriver();
|
||||
// Constructor
|
||||
BOOL FASTCALL Init();
|
||||
// Initialization
|
||||
CTapDriver(); // Constructor
|
||||
BOOL FASTCALL Init(); // Initilization
|
||||
BOOL FASTCALL OpenDump(const Filepath& path);
|
||||
// Capture packets
|
||||
void FASTCALL Cleanup();
|
||||
// Cleanup
|
||||
void FASTCALL GetMacAddr(BYTE *mac);
|
||||
// Get Mac Address
|
||||
int FASTCALL Rx(BYTE *buf);
|
||||
// Receive
|
||||
int FASTCALL Tx(const BYTE *buf, int len);
|
||||
// Send
|
||||
BOOL FASTCALL PendingPackets();
|
||||
// Check if there are IP packets available
|
||||
BOOL FASTCALL Enable();
|
||||
// Enable the ras0 interface
|
||||
BOOL FASTCALL Disable();
|
||||
// Disable the ras0 interface
|
||||
BOOL FASTCALL Flush();
|
||||
// Purge all of the packets that are waiting to be processed
|
||||
void FASTCALL Cleanup(); // Cleanup
|
||||
void FASTCALL GetMacAddr(BYTE *mac); // Get Mac Address
|
||||
int FASTCALL Rx(BYTE *buf); // Receive
|
||||
int FASTCALL Tx(const BYTE *buf, int len); // Send
|
||||
BOOL FASTCALL PendingPackets(); // Check if there are IP packets available
|
||||
BOOL FASTCALL Enable(); // Enable the ras0 interface
|
||||
BOOL FASTCALL Disable(); // Disable the ras0 interface
|
||||
BOOL FASTCALL Flush(); // Purge all of the packets that are waiting to be processed
|
||||
|
||||
private:
|
||||
BYTE m_MacAddr[6];
|
||||
// MAC Address
|
||||
BOOL m_bTxValid;
|
||||
// Send Valid Flag
|
||||
int m_hTAP;
|
||||
// File handle
|
||||
BYTE m_MacAddr[6]; // MAC Address
|
||||
BOOL m_bTxValid; // Send Valid Flag
|
||||
int m_hTAP; // File handle
|
||||
|
||||
BYTE m_garbage_buffer[ETH_FRAME_LEN];
|
||||
|
||||
pcap_t *m_pcap;
|
||||
pcap_dumper_t *m_pcap_dumper;
|
||||
|
||||
};
|
||||
|
||||
#endif // ctapdriver_h
|
||||
|
@ -11,7 +11,7 @@
|
||||
//
|
||||
// Imported sava's Anex86/T98Next image and MO format support patch.
|
||||
// Imported NetBSD support and some optimisation patch by Rin Okuyama.
|
||||
// Comments translated to english by akuker.
|
||||
// Comments translated to english by akuker.
|
||||
//
|
||||
// [ Disk ]
|
||||
//
|
||||
@ -161,11 +161,11 @@ BOOL FASTCALL DiskTrack::Load(const Filepath& path)
|
||||
ASSERT((dt.sectors > 0) && (dt.sectors <= 0x100));
|
||||
|
||||
if (dt.buffer == NULL) {
|
||||
#if defined(RASCSI) && !defined(BAREMETAL)
|
||||
#if defined(RASCSI) && !defined(BAREMETAL)
|
||||
posix_memalign((void **)&dt.buffer, 512, ((length + 511) / 512) * 512);
|
||||
#else
|
||||
#else
|
||||
dt.buffer = (BYTE *)malloc(length * sizeof(BYTE));
|
||||
#endif // RASCSI && !BAREMETAL
|
||||
#endif // RASCSI && !BAREMETAL
|
||||
dt.length = length;
|
||||
}
|
||||
|
||||
@ -176,11 +176,11 @@ BOOL FASTCALL DiskTrack::Load(const Filepath& path)
|
||||
// Reallocate if the buffer length is different
|
||||
if (dt.length != (DWORD)length) {
|
||||
free(dt.buffer);
|
||||
#if defined(RASCSI) && !defined(BAREMETAL)
|
||||
#if defined(RASCSI) && !defined(BAREMETAL)
|
||||
posix_memalign((void **)&dt.buffer, 512, ((length + 511) / 512) * 512);
|
||||
#else
|
||||
#else
|
||||
dt.buffer = (BYTE *)malloc(length * sizeof(BYTE));
|
||||
#endif // RASCSI && !BAREMETAL
|
||||
#endif // RASCSI && !BAREMETAL
|
||||
dt.length = length;
|
||||
}
|
||||
|
||||
@ -205,11 +205,11 @@ BOOL FASTCALL DiskTrack::Load(const Filepath& path)
|
||||
memset(dt.changemap, 0x00, dt.sectors * sizeof(BOOL));
|
||||
|
||||
// Read from File
|
||||
#if defined(RASCSI) && !defined(BAREMETAL)
|
||||
#if defined(RASCSI) && !defined(BAREMETAL)
|
||||
if (!fio.OpenDIO(path, Fileio::ReadOnly)) {
|
||||
#else
|
||||
#else
|
||||
if (!fio.Open(path, Fileio::ReadOnly)) {
|
||||
#endif // RASCSI && !BAREMETAL
|
||||
#endif // RASCSI && !BAREMETAL
|
||||
return FALSE;
|
||||
}
|
||||
if (dt.raw) {
|
||||
@ -1701,7 +1701,7 @@ int FASTCALL Disk::AddFormat(BOOL change, BYTE *buf)
|
||||
buf[1] = 0x16;
|
||||
|
||||
// Show the number of bytes in the physical sector as changeable
|
||||
// (though it cannot be changed in practice)
|
||||
// (though it cannot be changed in practice)
|
||||
if (change) {
|
||||
buf[0xc] = 0xff;
|
||||
buf[0xd] = 0xff;
|
||||
@ -1863,7 +1863,7 @@ int FASTCALL Disk::AddCDDA(BOOL change, BYTE *buf)
|
||||
}
|
||||
|
||||
// Audio waits for operation completion and allows
|
||||
// PLAY across multiple tracks
|
||||
// PLAY across multiple tracks
|
||||
return 16;
|
||||
}
|
||||
|
||||
|
@ -8,8 +8,8 @@
|
||||
// XM6i
|
||||
// Copyright (C) 2010-2015 isaki@NetBSD.org
|
||||
//
|
||||
// Imported sava's Anex86/T98Next image and MO format support patch.
|
||||
// Comments translated to english by akuker.
|
||||
// Imported sava's Anex86/T98Next image and MO format support patch.
|
||||
// Comments translated to english by akuker.
|
||||
//
|
||||
// [ Disk ]
|
||||
//
|
||||
@ -62,11 +62,11 @@
|
||||
|
||||
|
||||
#ifdef RASCSI
|
||||
#define BENDER_SIGNATURE "RaSCSI"
|
||||
#define BENDER_SIGNATURE "RaSCSI"
|
||||
// The following line was to mimic Apple's CDROM ID
|
||||
// #define BENDER_SIGNATURE "SONY "
|
||||
#else
|
||||
#define BENDER_SIGNATURE "XM6"
|
||||
#define BENDER_SIGNATURE "XM6"
|
||||
#endif
|
||||
|
||||
//===========================================================================
|
||||
@ -79,49 +79,38 @@ class DiskTrack
|
||||
public:
|
||||
// Internal data definition
|
||||
typedef struct {
|
||||
int track; // Track Number
|
||||
int size; // Sector Size(8 or 9)
|
||||
int sectors; // Number of sectors(<=0x100)
|
||||
DWORD length; // Data buffer length
|
||||
BYTE *buffer; // Data buffer
|
||||
BOOL init; // Is it initilized?
|
||||
BOOL changed; // Changed flag
|
||||
DWORD maplen; // Changed map length
|
||||
BOOL *changemap; // Changed map
|
||||
BOOL raw; // RAW mode flag
|
||||
off64_t imgoffset; // Offset to actual data
|
||||
int track; // Track Number
|
||||
int size; // Sector Size(8 or 9)
|
||||
int sectors; // Number of sectors(<=0x100)
|
||||
DWORD length; // Data buffer length
|
||||
BYTE *buffer; // Data buffer
|
||||
BOOL init; // Is it initilized?
|
||||
BOOL changed; // Changed flag
|
||||
DWORD maplen; // Changed map length
|
||||
BOOL *changemap; // Changed map
|
||||
BOOL raw; // RAW mode flag
|
||||
off64_t imgoffset; // Offset to actual data
|
||||
} disktrk_t;
|
||||
|
||||
public:
|
||||
// Basic Functions
|
||||
DiskTrack();
|
||||
// Constructor
|
||||
virtual ~DiskTrack();
|
||||
// Destructor
|
||||
void FASTCALL Init(int track, int size, int sectors, BOOL raw = FALSE,
|
||||
off64_t imgoff = 0);
|
||||
// Initialization
|
||||
BOOL FASTCALL Load(const Filepath& path);
|
||||
// Load
|
||||
BOOL FASTCALL Save(const Filepath& path);
|
||||
// Save
|
||||
DiskTrack(); // Constructor
|
||||
virtual ~DiskTrack(); // Destructor
|
||||
void FASTCALL Init(int track, int size, int sectors, BOOL raw = FALSE, off64_t imgoff = 0);// Initialization
|
||||
BOOL FASTCALL Load(const Filepath& path); // Load
|
||||
BOOL FASTCALL Save(const Filepath& path); // Save
|
||||
|
||||
// Read / Write
|
||||
BOOL FASTCALL Read(BYTE *buf, int sec) const;
|
||||
// Sector Read
|
||||
BOOL FASTCALL Write(const BYTE *buf, int sec);
|
||||
// Sector Write
|
||||
BOOL FASTCALL Read(BYTE *buf, int sec) const; // Sector Read
|
||||
BOOL FASTCALL Write(const BYTE *buf, int sec); // Sector Write
|
||||
|
||||
// Other
|
||||
int FASTCALL GetTrack() const { return dt.track; }
|
||||
// Get track
|
||||
BOOL FASTCALL IsChanged() const { return dt.changed; }
|
||||
// Changed flag check
|
||||
int FASTCALL GetTrack() const { return dt.track; } // Get track
|
||||
BOOL FASTCALL IsChanged() const { return dt.changed; } // Changed flag check
|
||||
|
||||
private:
|
||||
// Internal data
|
||||
disktrk_t dt;
|
||||
// Internal data
|
||||
disktrk_t dt; // Internal data
|
||||
};
|
||||
|
||||
//===========================================================================
|
||||
@ -134,61 +123,42 @@ class DiskCache
|
||||
public:
|
||||
// Internal data definition
|
||||
typedef struct {
|
||||
DiskTrack *disktrk; // Disk Track
|
||||
DWORD serial; // Serial
|
||||
DiskTrack *disktrk; // Disk Track
|
||||
DWORD serial; // Serial
|
||||
} cache_t;
|
||||
|
||||
// Number of caches
|
||||
enum {
|
||||
CacheMax = 16 // Number of tracks to cache
|
||||
CacheMax = 16 // Number of tracks to cache
|
||||
};
|
||||
|
||||
public:
|
||||
// Basic Functions
|
||||
DiskCache(const Filepath& path, int size, int blocks,
|
||||
off64_t imgoff = 0);
|
||||
// Constructor
|
||||
virtual ~DiskCache();
|
||||
// Destructor
|
||||
void FASTCALL SetRawMode(BOOL raw);
|
||||
// CD-ROM raw mode setting
|
||||
DiskCache(const Filepath& path, int size, int blocks,off64_t imgoff = 0);// Constructor
|
||||
virtual ~DiskCache(); // Destructor
|
||||
void FASTCALL SetRawMode(BOOL raw); // CD-ROM raw mode setting
|
||||
|
||||
// Access
|
||||
BOOL FASTCALL Save();
|
||||
// Save and release all
|
||||
BOOL FASTCALL Read(BYTE *buf, int block);
|
||||
// Sector Read
|
||||
BOOL FASTCALL Write(const BYTE *buf, int block);
|
||||
// Sector Write
|
||||
BOOL FASTCALL GetCache(int index, int& track, DWORD& serial) const;
|
||||
// Get cache information
|
||||
BOOL FASTCALL Save(); // Save and release all
|
||||
BOOL FASTCALL Read(BYTE *buf, int block); // Sector Read
|
||||
BOOL FASTCALL Write(const BYTE *buf, int block); // Sector Write
|
||||
BOOL FASTCALL GetCache(int index, int& track, DWORD& serial) const; // Get cache information
|
||||
|
||||
private:
|
||||
// Internal Management
|
||||
void FASTCALL Clear();
|
||||
// Clear all tracks
|
||||
DiskTrack* FASTCALL Assign(int track);
|
||||
// Load track
|
||||
BOOL FASTCALL Load(int index, int track, DiskTrack *disktrk = NULL);
|
||||
// Load track
|
||||
void FASTCALL Update();
|
||||
// Update serial number
|
||||
void FASTCALL Clear(); // Clear all tracks
|
||||
DiskTrack* FASTCALL Assign(int track); // Load track
|
||||
BOOL FASTCALL Load(int index, int track, DiskTrack *disktrk = NULL); // Load track
|
||||
void FASTCALL Update(); // Update serial number
|
||||
|
||||
// Internal data
|
||||
cache_t cache[CacheMax];
|
||||
// Cache management
|
||||
DWORD serial;
|
||||
// Last serial number
|
||||
Filepath sec_path;
|
||||
// Path
|
||||
int sec_size;
|
||||
// Sector size (8 or 9 or 11)
|
||||
int sec_blocks;
|
||||
// Blocks per sector
|
||||
BOOL cd_raw;
|
||||
// CD-ROM RAW mode
|
||||
off64_t imgoffset;
|
||||
// Offset to actual data
|
||||
cache_t cache[CacheMax]; // Cache management
|
||||
DWORD serial; // Last serial number
|
||||
Filepath sec_path; // Path
|
||||
int sec_size; // Sector size (8 or 9 or 11)
|
||||
int sec_blocks; // Blocks per sector
|
||||
BOOL cd_raw; // CD-ROM RAW mode
|
||||
off64_t imgoffset; // Offset to actual data
|
||||
};
|
||||
|
||||
//===========================================================================
|
||||
@ -201,168 +171,104 @@ class Disk
|
||||
public:
|
||||
// Internal data structure
|
||||
typedef struct {
|
||||
DWORD id; // Media ID
|
||||
BOOL ready; // Valid Disk
|
||||
BOOL writep; // Write protected
|
||||
BOOL readonly; // Read only
|
||||
BOOL removable; // Removable
|
||||
BOOL lock; // Locked
|
||||
BOOL attn; // Attention
|
||||
BOOL reset; // Reset
|
||||
int size; // Sector Size
|
||||
DWORD blocks; // Total number of sectors
|
||||
DWORD lun; // LUN
|
||||
DWORD code; // Status code
|
||||
DiskCache *dcache; // Disk cache
|
||||
off64_t imgoffset; // Offset to actual data
|
||||
DWORD id; // Media ID
|
||||
BOOL ready; // Valid Disk
|
||||
BOOL writep; // Write protected
|
||||
BOOL readonly; // Read only
|
||||
BOOL removable; // Removable
|
||||
BOOL lock; // Locked
|
||||
BOOL attn; // Attention
|
||||
BOOL reset; // Reset
|
||||
int size; // Sector Size
|
||||
DWORD blocks; // Total number of sectors
|
||||
DWORD lun; // LUN
|
||||
DWORD code; // Status code
|
||||
DiskCache *dcache; // Disk cache
|
||||
off64_t imgoffset; // Offset to actual data
|
||||
} disk_t;
|
||||
|
||||
public:
|
||||
// Basic Functions
|
||||
Disk();
|
||||
// Constructor
|
||||
virtual ~Disk();
|
||||
// Destructor
|
||||
virtual void FASTCALL Reset();
|
||||
// Device Reset
|
||||
#ifndef RASCSI
|
||||
virtual BOOL FASTCALL Save(Fileio *fio, int ver);
|
||||
// Save
|
||||
virtual BOOL FASTCALL Load(Fileio *fio, int ver);
|
||||
// Load
|
||||
#endif // RASCSI
|
||||
Disk(); // Constructor
|
||||
virtual ~Disk(); // Destructor
|
||||
virtual void FASTCALL Reset(); // Device Reset
|
||||
#ifndef RASCSI
|
||||
virtual BOOL FASTCALL Save(Fileio *fio, int ver); // Save
|
||||
virtual BOOL FASTCALL Load(Fileio *fio, int ver); // Load
|
||||
#endif // RASCSI
|
||||
|
||||
// ID
|
||||
DWORD FASTCALL GetID() const;
|
||||
// Get media ID
|
||||
BOOL FASTCALL IsNULL() const;
|
||||
// NULL check
|
||||
BOOL FASTCALL IsSASI() const;
|
||||
// SASI Check
|
||||
BOOL FASTCALL IsSCSI() const;
|
||||
// SASI Check
|
||||
DWORD FASTCALL GetID() const; // Get media ID
|
||||
BOOL FASTCALL IsNULL() const; // NULL check
|
||||
BOOL FASTCALL IsSASI() const; // SASI Check
|
||||
BOOL FASTCALL IsSCSI() const; // SASI Check
|
||||
|
||||
// Media Operations
|
||||
virtual BOOL FASTCALL Open(const Filepath& path, BOOL attn = TRUE);
|
||||
// Open
|
||||
void FASTCALL GetPath(Filepath& path) const;
|
||||
// Get the path
|
||||
void FASTCALL Eject(BOOL force);
|
||||
// Eject
|
||||
BOOL FASTCALL IsReady() const { return disk.ready; }
|
||||
// Ready check
|
||||
void FASTCALL WriteP(BOOL flag);
|
||||
// Set Write Protect flag
|
||||
BOOL FASTCALL IsWriteP() const { return disk.writep; }
|
||||
// Get write protect flag
|
||||
BOOL FASTCALL IsReadOnly() const { return disk.readonly; }
|
||||
// Get read only flag
|
||||
BOOL FASTCALL IsRemovable() const { return disk.removable; }
|
||||
// Get is removable flag
|
||||
BOOL FASTCALL IsLocked() const { return disk.lock; }
|
||||
// Get locked status
|
||||
BOOL FASTCALL IsAttn() const { return disk.attn; }
|
||||
// Get attention flag
|
||||
BOOL FASTCALL Flush();
|
||||
// Flush the cache
|
||||
void FASTCALL GetDisk(disk_t *buffer) const;
|
||||
// Get the internal data struct
|
||||
virtual BOOL FASTCALL Open(const Filepath& path, BOOL attn = TRUE); // Open
|
||||
void FASTCALL GetPath(Filepath& path) const; // Get the path
|
||||
void FASTCALL Eject(BOOL force); // Eject
|
||||
BOOL FASTCALL IsReady() const { return disk.ready; } // Ready check
|
||||
void FASTCALL WriteP(BOOL flag); // Set Write Protect flag
|
||||
BOOL FASTCALL IsWriteP() const { return disk.writep; } // Get write protect flag
|
||||
BOOL FASTCALL IsReadOnly() const { return disk.readonly; } // Get read only flag
|
||||
BOOL FASTCALL IsRemovable() const { return disk.removable; } // Get is removable flag
|
||||
BOOL FASTCALL IsLocked() const { return disk.lock; } // Get locked status
|
||||
BOOL FASTCALL IsAttn() const { return disk.attn; } // Get attention flag
|
||||
BOOL FASTCALL Flush(); // Flush the cache
|
||||
void FASTCALL GetDisk(disk_t *buffer) const; // Get the internal data struct
|
||||
|
||||
// Properties
|
||||
void FASTCALL SetLUN(DWORD lun) { disk.lun = lun; }
|
||||
// LUN set
|
||||
DWORD FASTCALL GetLUN() { return disk.lun; }
|
||||
// LUN get
|
||||
void FASTCALL SetLUN(DWORD lun) { disk.lun = lun; } // LUN set
|
||||
DWORD FASTCALL GetLUN() { return disk.lun; } // LUN get
|
||||
|
||||
// commands
|
||||
virtual int FASTCALL Inquiry(const DWORD *cdb, BYTE *buf, DWORD major, DWORD minor);
|
||||
// INQUIRY command
|
||||
virtual int FASTCALL RequestSense(const DWORD *cdb, BYTE *buf);
|
||||
// REQUEST SENSE command
|
||||
int FASTCALL SelectCheck(const DWORD *cdb);
|
||||
// SELECT check
|
||||
int FASTCALL SelectCheck10(const DWORD *cdb);
|
||||
// SELECT(10) check
|
||||
virtual BOOL FASTCALL ModeSelect(const DWORD *cdb, const BYTE *buf, int length);
|
||||
// MODE SELECT command
|
||||
virtual int FASTCALL ModeSense(const DWORD *cdb, BYTE *buf);
|
||||
// MODE SENSE command
|
||||
virtual int FASTCALL ModeSense10(const DWORD *cdb, BYTE *buf);
|
||||
// MODE SENSE(10) command
|
||||
int FASTCALL ReadDefectData10(const DWORD *cdb, BYTE *buf);
|
||||
// READ DEFECT DATA(10) command
|
||||
virtual BOOL FASTCALL TestUnitReady(const DWORD *cdb);
|
||||
// TEST UNIT READY command
|
||||
BOOL FASTCALL Rezero(const DWORD *cdb);
|
||||
// REZERO command
|
||||
BOOL FASTCALL Format(const DWORD *cdb);
|
||||
// FORMAT UNIT command
|
||||
BOOL FASTCALL Reassign(const DWORD *cdb);
|
||||
// REASSIGN UNIT command
|
||||
virtual int FASTCALL Read(const DWORD *cdb, BYTE *buf, DWORD block);
|
||||
// READ command
|
||||
virtual int FASTCALL WriteCheck(DWORD block);
|
||||
// WRITE check
|
||||
virtual BOOL FASTCALL Write(const DWORD *cdb, const BYTE *buf, DWORD block);
|
||||
// WRITE command
|
||||
BOOL FASTCALL Seek(const DWORD *cdb);
|
||||
// SEEK command
|
||||
BOOL FASTCALL Assign(const DWORD *cdb);
|
||||
// ASSIGN command
|
||||
BOOL FASTCALL Specify(const DWORD *cdb);
|
||||
// SPECIFY command
|
||||
BOOL FASTCALL StartStop(const DWORD *cdb);
|
||||
// START STOP UNIT command
|
||||
BOOL FASTCALL SendDiag(const DWORD *cdb);
|
||||
// SEND DIAGNOSTIC command
|
||||
BOOL FASTCALL Removal(const DWORD *cdb);
|
||||
// PREVENT/ALLOW MEDIUM REMOVAL command
|
||||
int FASTCALL ReadCapacity(const DWORD *cdb, BYTE *buf);
|
||||
// READ CAPACITY command
|
||||
BOOL FASTCALL Verify(const DWORD *cdb);
|
||||
// VERIFY command
|
||||
virtual int FASTCALL ReadToc(const DWORD *cdb, BYTE *buf);
|
||||
// READ TOC command
|
||||
virtual BOOL FASTCALL PlayAudio(const DWORD *cdb);
|
||||
// PLAY AUDIO command
|
||||
virtual BOOL FASTCALL PlayAudioMSF(const DWORD *cdb);
|
||||
// PLAY AUDIO MSF command
|
||||
virtual BOOL FASTCALL PlayAudioTrack(const DWORD *cdb);
|
||||
// PLAY AUDIO TRACK command
|
||||
void FASTCALL InvalidCmd();
|
||||
// Unsupported command
|
||||
virtual int FASTCALL Inquiry(const DWORD *cdb, BYTE *buf, DWORD major, DWORD minor);// INQUIRY command
|
||||
virtual int FASTCALL RequestSense(const DWORD *cdb, BYTE *buf); // REQUEST SENSE command
|
||||
int FASTCALL SelectCheck(const DWORD *cdb); // SELECT check
|
||||
int FASTCALL SelectCheck10(const DWORD *cdb); // SELECT(10) check
|
||||
virtual BOOL FASTCALL ModeSelect(const DWORD *cdb, const BYTE *buf, int length);// MODE SELECT command
|
||||
virtual int FASTCALL ModeSense(const DWORD *cdb, BYTE *buf); // MODE SENSE command
|
||||
virtual int FASTCALL ModeSense10(const DWORD *cdb, BYTE *buf); // MODE SENSE(10) command
|
||||
int FASTCALL ReadDefectData10(const DWORD *cdb, BYTE *buf); // READ DEFECT DATA(10) command
|
||||
virtual BOOL FASTCALL TestUnitReady(const DWORD *cdb); // TEST UNIT READY command
|
||||
BOOL FASTCALL Rezero(const DWORD *cdb); // REZERO command
|
||||
BOOL FASTCALL Format(const DWORD *cdb); // FORMAT UNIT command
|
||||
BOOL FASTCALL Reassign(const DWORD *cdb); // REASSIGN UNIT command
|
||||
virtual int FASTCALL Read(const DWORD *cdb, BYTE *buf, DWORD block); // READ command
|
||||
virtual int FASTCALL WriteCheck(DWORD block); // WRITE check
|
||||
virtual BOOL FASTCALL Write(const DWORD *cdb, const BYTE *buf, DWORD block); // WRITE command
|
||||
BOOL FASTCALL Seek(const DWORD *cdb); // SEEK command
|
||||
BOOL FASTCALL Assign(const DWORD *cdb); // ASSIGN command
|
||||
BOOL FASTCALL Specify(const DWORD *cdb); // SPECIFY command
|
||||
BOOL FASTCALL StartStop(const DWORD *cdb); // START STOP UNIT command
|
||||
BOOL FASTCALL SendDiag(const DWORD *cdb); // SEND DIAGNOSTIC command
|
||||
BOOL FASTCALL Removal(const DWORD *cdb); // PREVENT/ALLOW MEDIUM REMOVAL command
|
||||
int FASTCALL ReadCapacity(const DWORD *cdb, BYTE *buf); // READ CAPACITY command
|
||||
BOOL FASTCALL Verify(const DWORD *cdb); // VERIFY command
|
||||
virtual int FASTCALL ReadToc(const DWORD *cdb, BYTE *buf); // READ TOC command
|
||||
virtual BOOL FASTCALL PlayAudio(const DWORD *cdb); // PLAY AUDIO command
|
||||
virtual BOOL FASTCALL PlayAudioMSF(const DWORD *cdb); // PLAY AUDIO MSF command
|
||||
virtual BOOL FASTCALL PlayAudioTrack(const DWORD *cdb); // PLAY AUDIO TRACK command
|
||||
void FASTCALL InvalidCmd(); // Unsupported command
|
||||
|
||||
// Other
|
||||
BOOL FASTCALL IsCacheWB();
|
||||
// Get cache writeback mode
|
||||
void FASTCALL SetCacheWB(BOOL enable);
|
||||
// Set cache writeback mode
|
||||
BOOL FASTCALL IsCacheWB(); // Get cache writeback mode
|
||||
void FASTCALL SetCacheWB(BOOL enable); // Set cache writeback mode
|
||||
|
||||
protected:
|
||||
// Internal processing
|
||||
virtual int FASTCALL AddError(BOOL change, BYTE *buf);
|
||||
// Add error
|
||||
virtual int FASTCALL AddFormat(BOOL change, BYTE *buf);
|
||||
// Add format
|
||||
virtual int FASTCALL AddDrive(BOOL change, BYTE *buf);
|
||||
// Add drive
|
||||
int FASTCALL AddOpt(BOOL change, BYTE *buf);
|
||||
// Add optical
|
||||
int FASTCALL AddCache(BOOL change, BYTE *buf);
|
||||
// Add cache
|
||||
int FASTCALL AddCDROM(BOOL change, BYTE *buf);
|
||||
// Add CD-ROM
|
||||
int FASTCALL AddCDDA(BOOL change, BYTE *buf);
|
||||
// Add CD_DA
|
||||
virtual int FASTCALL AddVendor(int page, BOOL change, BYTE *buf);
|
||||
// Add vendor special info
|
||||
BOOL FASTCALL CheckReady();
|
||||
// Check if ready
|
||||
virtual int FASTCALL AddError(BOOL change, BYTE *buf); // Add error
|
||||
virtual int FASTCALL AddFormat(BOOL change, BYTE *buf); // Add format
|
||||
virtual int FASTCALL AddDrive(BOOL change, BYTE *buf); // Add drive
|
||||
int FASTCALL AddOpt(BOOL change, BYTE *buf); // Add optical
|
||||
int FASTCALL AddCache(BOOL change, BYTE *buf); // Add cache
|
||||
int FASTCALL AddCDROM(BOOL change, BYTE *buf); // Add CD-ROM
|
||||
int FASTCALL AddCDDA(BOOL change, BYTE *buf); // Add CD_DA
|
||||
virtual int FASTCALL AddVendor(int page, BOOL change, BYTE *buf); // Add vendor special info
|
||||
BOOL FASTCALL CheckReady(); // Check if ready
|
||||
|
||||
// Internal data
|
||||
disk_t disk;
|
||||
// Internal disk data
|
||||
Filepath diskpath;
|
||||
// File path (for GetPath)
|
||||
BOOL cache_wb;
|
||||
// Cache mode
|
||||
disk_t disk; // Internal disk data
|
||||
Filepath diskpath; // File path (for GetPath)
|
||||
BOOL cache_wb; // Cache mode
|
||||
};
|
||||
|
@ -5,12 +5,12 @@
|
||||
//
|
||||
// Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp)
|
||||
// Copyright (C) 2014-2020 GIMONS
|
||||
// Copyright (C) akuker
|
||||
// Copyright (C) akuker
|
||||
//
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
//
|
||||
// [ SASI hard disk ]
|
||||
// [ SASI hard disk ]
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
#include "sasihd.h"
|
||||
@ -73,7 +73,7 @@ BOOL FASTCALL SASIHD::Open(const Filepath& path, BOOL /*attn*/)
|
||||
size = fio.GetFileSize();
|
||||
fio.Close();
|
||||
|
||||
#if defined(USE_MZ1F23_1024_SUPPORT)
|
||||
#if defined(USE_MZ1F23_1024_SUPPORT)
|
||||
// MZ-2500/MZ-2800用 MZ-1F23(SASI 20M/セクタサイズ1024)専用
|
||||
// 20M(22437888 BS=1024 C=21912)
|
||||
if (size == 0x1566000) {
|
||||
@ -84,9 +84,9 @@ BOOL FASTCALL SASIHD::Open(const Filepath& path, BOOL /*attn*/)
|
||||
// Call the base class
|
||||
return Disk::Open(path);
|
||||
}
|
||||
#endif // USE_MZ1F23_1024_SUPPORT
|
||||
#endif // USE_MZ1F23_1024_SUPPORT
|
||||
|
||||
#if defined(REMOVE_FIXED_SASIHD_SIZE)
|
||||
#if defined(REMOVE_FIXED_SASIHD_SIZE)
|
||||
// 256バイト単位であること
|
||||
if (size & 0xff) {
|
||||
return FALSE;
|
||||
@ -101,7 +101,7 @@ BOOL FASTCALL SASIHD::Open(const Filepath& path, BOOL /*attn*/)
|
||||
if (size > 512 * 1024 * 1024) {
|
||||
return FALSE;
|
||||
}
|
||||
#else
|
||||
#else
|
||||
// 10MB, 20MB, 40MBのみ
|
||||
switch (size) {
|
||||
// 10MB(10441728 BS=256 C=40788)
|
||||
@ -120,7 +120,7 @@ BOOL FASTCALL SASIHD::Open(const Filepath& path, BOOL /*attn*/)
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
#endif // REMOVE_FIXED_SASIHD_SIZE
|
||||
#endif // REMOVE_FIXED_SASIHD_SIZE
|
||||
|
||||
// セクタサイズとブロック数
|
||||
disk.size = 8;
|
||||
|
@ -5,10 +5,10 @@
|
||||
//
|
||||
// Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp)
|
||||
// Copyright (C) 2014-2020 GIMONS
|
||||
// Copyright (C) akuker
|
||||
// Copyright (C) akuker
|
||||
//
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
//
|
||||
// [ SASI hard disk ]
|
||||
//
|
||||
@ -28,13 +28,10 @@ class SASIHD : public Disk
|
||||
{
|
||||
public:
|
||||
// Basic Functions
|
||||
SASIHD();
|
||||
// Constructor
|
||||
void FASTCALL Reset();
|
||||
// Reset
|
||||
BOOL FASTCALL Open(const Filepath& path, BOOL attn = TRUE);
|
||||
// Open
|
||||
SASIHD(); // Constructor
|
||||
void FASTCALL Reset(); // Reset
|
||||
BOOL FASTCALL Open(const Filepath& path, BOOL attn = TRUE); // Open
|
||||
|
||||
// commands
|
||||
int FASTCALL RequestSense(const DWORD *cdb, BYTE *buf);
|
||||
// REQUEST SENSE command
|
||||
int FASTCALL RequestSense(const DWORD *cdb, BYTE *buf); // REQUEST SENSE command
|
||||
};
|
@ -5,12 +5,12 @@
|
||||
//
|
||||
// Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp)
|
||||
// Copyright (C) 2014-2020 GIMONS
|
||||
// Copyright (C) akuker
|
||||
// Copyright (C) akuker
|
||||
//
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
//
|
||||
// [ SCSI Host Bridge for the Sharp X68000 ]
|
||||
// [ SCSI Host Bridge for the Sharp X68000 ]
|
||||
//
|
||||
// Note: This requires a special driver on the host system and will only
|
||||
// work with the Sharp X68000 operating system.
|
||||
@ -37,7 +37,7 @@ SCSIBR::SCSIBR() : Disk()
|
||||
// Host Bridge
|
||||
disk.id = MAKEID('S', 'C', 'B', 'R');
|
||||
|
||||
#if defined(RASCSI) && defined(__linux__) && !defined(BAREMETAL)
|
||||
#if defined(RASCSI) && defined(__linux__) && !defined(BAREMETAL)
|
||||
// TAP Driver Generation
|
||||
tap = new CTapDriver();
|
||||
m_bTapEnable = tap->Init();
|
||||
@ -51,7 +51,7 @@ SCSIBR::SCSIBR() : Disk()
|
||||
|
||||
// Packet reception flag OFF
|
||||
packet_enable = FALSE;
|
||||
#endif // RASCSI && !BAREMETAL
|
||||
#endif // RASCSI && !BAREMETAL
|
||||
|
||||
// Create host file system
|
||||
fs = new CFileSys();
|
||||
@ -65,13 +65,13 @@ SCSIBR::SCSIBR() : Disk()
|
||||
//---------------------------------------------------------------------------
|
||||
SCSIBR::~SCSIBR()
|
||||
{
|
||||
#if defined(RASCSI) && !defined(BAREMETAL)
|
||||
#if defined(RASCSI) && !defined(BAREMETAL)
|
||||
// TAP driver release
|
||||
if (tap) {
|
||||
tap->Cleanup();
|
||||
delete tap;
|
||||
}
|
||||
#endif // RASCSI && !BAREMETAL
|
||||
#endif // RASCSI && !BAREMETAL
|
||||
|
||||
// Release host file system
|
||||
if (fs) {
|
||||
@ -136,12 +136,12 @@ int FASTCALL SCSIBR::Inquiry(
|
||||
// Optional function valid flag
|
||||
buf[36] = '0';
|
||||
|
||||
#if defined(RASCSI) && !defined(BAREMETAL)
|
||||
#if defined(RASCSI) && !defined(BAREMETAL)
|
||||
// TAP Enable
|
||||
if (m_bTapEnable) {
|
||||
buf[37] = '1';
|
||||
}
|
||||
#endif // RASCSI && !BAREMETAL
|
||||
#endif // RASCSI && !BAREMETAL
|
||||
|
||||
// CFileSys Enable
|
||||
buf[38] = '1';
|
||||
@ -182,27 +182,27 @@ int FASTCALL SCSIBR::GetMessage10(const DWORD *cdb, BYTE *buf)
|
||||
{
|
||||
int type;
|
||||
int phase;
|
||||
#if defined(RASCSI) && !defined(BAREMETAL)
|
||||
#if defined(RASCSI) && !defined(BAREMETAL)
|
||||
int func;
|
||||
int total_len;
|
||||
int i;
|
||||
#endif // RASCSI && !BAREMETAL
|
||||
#endif // RASCSI && !BAREMETAL
|
||||
|
||||
ASSERT(this);
|
||||
|
||||
// Type
|
||||
type = cdb[2];
|
||||
|
||||
#if defined(RASCSI) && !defined(BAREMETAL)
|
||||
#if defined(RASCSI) && !defined(BAREMETAL)
|
||||
// Function number
|
||||
func = cdb[3];
|
||||
#endif // RASCSI && !BAREMETAL
|
||||
#endif // RASCSI && !BAREMETAL
|
||||
|
||||
// Phase
|
||||
phase = cdb[9];
|
||||
|
||||
switch (type) {
|
||||
#if defined(RASCSI) && !defined(BAREMETAL)
|
||||
#if defined(RASCSI) && !defined(BAREMETAL)
|
||||
case 1: // Ethernet
|
||||
// Do not process if TAP is invalid
|
||||
if (!m_bTapEnable) {
|
||||
@ -251,7 +251,7 @@ int FASTCALL SCSIBR::GetMessage10(const DWORD *cdb, BYTE *buf)
|
||||
return total_len;
|
||||
}
|
||||
break;
|
||||
#endif // RASCSI && !BAREMETAL
|
||||
#endif // RASCSI && !BAREMETAL
|
||||
|
||||
case 2: // Host Drive
|
||||
switch (phase) {
|
||||
@ -305,7 +305,7 @@ BOOL FASTCALL SCSIBR::SendMessage10(const DWORD *cdb, BYTE *buf)
|
||||
len |= cdb[8];
|
||||
|
||||
switch (type) {
|
||||
#if defined(RASCSI) && !defined(BAREMETAL)
|
||||
#if defined(RASCSI) && !defined(BAREMETAL)
|
||||
case 1: // Ethernet
|
||||
// Do not process if TAP is invalid
|
||||
if (!m_bTapEnable) {
|
||||
@ -322,7 +322,7 @@ BOOL FASTCALL SCSIBR::SendMessage10(const DWORD *cdb, BYTE *buf)
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
#endif // RASCSI && !BAREMETAL
|
||||
#endif // RASCSI && !BAREMETAL
|
||||
|
||||
case 2: // Host drive
|
||||
switch (phase) {
|
||||
@ -1462,30 +1462,30 @@ void FASTCALL SCSIBR::WriteFs(int func, BYTE *buf)
|
||||
func &= 0x1f;
|
||||
switch (func) {
|
||||
case 0x00: return FS_InitDevice(buf); // $40 - start device
|
||||
case 0x01: return FS_CheckDir(buf); // $41 - directory check
|
||||
case 0x02: return FS_MakeDir(buf); // $42 - create directory
|
||||
case 0x01: return FS_CheckDir(buf); // $41 - directory check
|
||||
case 0x02: return FS_MakeDir(buf); // $42 - create directory
|
||||
case 0x03: return FS_RemoveDir(buf); // $43 - remove directory
|
||||
case 0x04: return FS_Rename(buf); // $44 - change file name
|
||||
case 0x05: return FS_Delete(buf); // $45 - delete file
|
||||
case 0x04: return FS_Rename(buf); // $44 - change file name
|
||||
case 0x05: return FS_Delete(buf); // $45 - delete file
|
||||
case 0x06: return FS_Attribute(buf); // $46 - Get/set file attribute
|
||||
case 0x07: return FS_Files(buf); // $47 - file search
|
||||
case 0x08: return FS_NFiles(buf); // $48 - next file search
|
||||
case 0x09: return FS_Create(buf); // $49 - create file
|
||||
case 0x0A: return FS_Open(buf); // $4A - File open
|
||||
case 0x0B: return FS_Close(buf); // $4B - File close
|
||||
case 0x0C: return FS_Read(buf); // $4C - read file
|
||||
case 0x0D: return FS_Write(buf); // $4D - write file
|
||||
case 0x0E: return FS_Seek(buf); // $4E - File seek
|
||||
case 0x07: return FS_Files(buf); // $47 - file search
|
||||
case 0x08: return FS_NFiles(buf); // $48 - next file search
|
||||
case 0x09: return FS_Create(buf); // $49 - create file
|
||||
case 0x0A: return FS_Open(buf); // $4A - File open
|
||||
case 0x0B: return FS_Close(buf); // $4B - File close
|
||||
case 0x0C: return FS_Read(buf); // $4C - read file
|
||||
case 0x0D: return FS_Write(buf); // $4D - write file
|
||||
case 0x0E: return FS_Seek(buf); // $4E - File seek
|
||||
case 0x0F: return FS_TimeStamp(buf); // $4F - Get/set file modification time
|
||||
case 0x10: return FS_GetCapacity(buf); // $50 - get capacity
|
||||
case 0x11: return FS_CtrlDrive(buf); // $51 - Drive control/state check
|
||||
case 0x12: return FS_GetDPB(buf); // $52 - Get DPB
|
||||
case 0x13: return FS_DiskRead(buf); // $53 - read sector
|
||||
case 0x12: return FS_GetDPB(buf); // $52 - Get DPB
|
||||
case 0x13: return FS_DiskRead(buf); // $53 - read sector
|
||||
case 0x14: return FS_DiskWrite(buf); // $54 - write sector
|
||||
case 0x15: return FS_Ioctrl(buf); // $55 - IOCTRL
|
||||
case 0x16: return FS_Flush(buf); // $56 - flush
|
||||
case 0x15: return FS_Ioctrl(buf); // $55 - IOCTRL
|
||||
case 0x16: return FS_Flush(buf); // $56 - flush
|
||||
case 0x17: return FS_CheckMedia(buf); // $57 - check media exchange
|
||||
case 0x18: return FS_Lock(buf); // $58 - exclusive control
|
||||
case 0x18: return FS_Lock(buf); // $58 - exclusive control
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,12 +5,12 @@
|
||||
//
|
||||
// Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp)
|
||||
// Copyright (C) 2014-2020 GIMONS
|
||||
// Copyright (C) akuker
|
||||
// Copyright (C) akuker
|
||||
//
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
//
|
||||
// [ SCSI Host Bridge for the Sharp X68000 ]
|
||||
// [ SCSI Host Bridge for the Sharp X68000 ]
|
||||
//
|
||||
// Note: This requires a special driver on the host system and will only
|
||||
// work with the Sharp X68000 operating system.
|
||||
@ -34,120 +34,68 @@ class SCSIBR : public Disk
|
||||
{
|
||||
public:
|
||||
// Basic Functions
|
||||
SCSIBR();
|
||||
// Constructor
|
||||
virtual ~SCSIBR();
|
||||
// Destructor
|
||||
SCSIBR(); // Constructor
|
||||
virtual ~SCSIBR(); // Destructor
|
||||
|
||||
// commands
|
||||
int FASTCALL Inquiry(const DWORD *cdb, BYTE *buf, DWORD major, DWORD minor);
|
||||
// INQUIRY command
|
||||
BOOL FASTCALL TestUnitReady(const DWORD *cdb);
|
||||
// TEST UNIT READY command
|
||||
int FASTCALL GetMessage10(const DWORD *cdb, BYTE *buf);
|
||||
// GET MESSAGE10 command
|
||||
BOOL FASTCALL SendMessage10(const DWORD *cdb, BYTE *buf);
|
||||
// SEND MESSAGE10 command
|
||||
int FASTCALL Inquiry(const DWORD *cdb, BYTE *buf, DWORD major, DWORD minor); // INQUIRY command
|
||||
BOOL FASTCALL TestUnitReady(const DWORD *cdb); // TEST UNIT READY command
|
||||
int FASTCALL GetMessage10(const DWORD *cdb, BYTE *buf); // GET MESSAGE10 command
|
||||
BOOL FASTCALL SendMessage10(const DWORD *cdb, BYTE *buf); // SEND MESSAGE10 command
|
||||
|
||||
private:
|
||||
#if defined(RASCSI) && !defined(BAREMETAL)
|
||||
int FASTCALL GetMacAddr(BYTE *buf);
|
||||
// Get MAC address
|
||||
void FASTCALL SetMacAddr(BYTE *buf);
|
||||
// Set MAC address
|
||||
void FASTCALL ReceivePacket();
|
||||
// Receive a packet
|
||||
void FASTCALL GetPacketBuf(BYTE *buf);
|
||||
// Get a packet
|
||||
void FASTCALL SendPacket(BYTE *buf, int len);
|
||||
// Send a packet
|
||||
#if defined(RASCSI) && !defined(BAREMETAL)
|
||||
int FASTCALL GetMacAddr(BYTE *buf); // Get MAC address
|
||||
void FASTCALL SetMacAddr(BYTE *buf); // Set MAC address
|
||||
void FASTCALL ReceivePacket(); // Receive a packet
|
||||
void FASTCALL GetPacketBuf(BYTE *buf); // Get a packet
|
||||
void FASTCALL SendPacket(BYTE *buf, int len); // Send a packet
|
||||
|
||||
CTapDriver *tap;
|
||||
// TAP driver
|
||||
BOOL m_bTapEnable;
|
||||
// TAP valid flag
|
||||
BYTE mac_addr[6];
|
||||
// MAC Addres
|
||||
int packet_len;
|
||||
// Receive packet size
|
||||
BYTE packet_buf[0x1000];
|
||||
// Receive packet buffer
|
||||
BOOL packet_enable;
|
||||
// Received packet valid
|
||||
#endif // RASCSI && !BAREMETAL
|
||||
CTapDriver *tap; // TAP driver
|
||||
BOOL m_bTapEnable; // TAP valid flag
|
||||
BYTE mac_addr[6]; // MAC Addres
|
||||
int packet_len; // Receive packet size
|
||||
BYTE packet_buf[0x1000]; // Receive packet buffer
|
||||
BOOL packet_enable; // Received packet valid
|
||||
#endif // RASCSI && !BAREMETAL
|
||||
|
||||
int FASTCALL ReadFsResult(BYTE *buf); // Read filesystem (result code)
|
||||
int FASTCALL ReadFsOut(BYTE *buf); // Read filesystem (return data)
|
||||
int FASTCALL ReadFsOpt(BYTE *buf); // Read file system (optional data)
|
||||
void FASTCALL WriteFs(int func, BYTE *buf); // File system write (execute)
|
||||
void FASTCALL WriteFsOpt(BYTE *buf, int len); // File system write (optional data)
|
||||
|
||||
int FASTCALL ReadFsResult(BYTE *buf);
|
||||
// Read filesystem (result code)
|
||||
int FASTCALL ReadFsOut(BYTE *buf);
|
||||
// Read filesystem (return data)
|
||||
int FASTCALL ReadFsOpt(BYTE *buf);
|
||||
// Read file system (optional data)
|
||||
void FASTCALL WriteFs(int func, BYTE *buf);
|
||||
// File system write (execute)
|
||||
void FASTCALL WriteFsOpt(BYTE *buf, int len);
|
||||
// File system write (optional data)
|
||||
// Command handlers
|
||||
void FASTCALL FS_InitDevice(BYTE *buf);
|
||||
// $40 - boot
|
||||
void FASTCALL FS_CheckDir(BYTE *buf);
|
||||
// $41 - directory check
|
||||
void FASTCALL FS_MakeDir(BYTE *buf);
|
||||
// $42 - create directory
|
||||
void FASTCALL FS_RemoveDir(BYTE *buf);
|
||||
// $43 - delete directory
|
||||
void FASTCALL FS_Rename(BYTE *buf);
|
||||
// $44 - change filename
|
||||
void FASTCALL FS_Delete(BYTE *buf);
|
||||
// $45 - delete file
|
||||
void FASTCALL FS_Attribute(BYTE *buf);
|
||||
// $46 - get/set file attributes
|
||||
void FASTCALL FS_Files(BYTE *buf);
|
||||
// $47 - file search
|
||||
void FASTCALL FS_NFiles(BYTE *buf);
|
||||
// $48 - find next file
|
||||
void FASTCALL FS_Create(BYTE *buf);
|
||||
// $49 - create file
|
||||
void FASTCALL FS_Open(BYTE *buf);
|
||||
// $4A - open file
|
||||
void FASTCALL FS_Close(BYTE *buf);
|
||||
// $4B - close file
|
||||
void FASTCALL FS_Read(BYTE *buf);
|
||||
// $4C - read file
|
||||
void FASTCALL FS_Write(BYTE *buf);
|
||||
// $4D - write file
|
||||
void FASTCALL FS_Seek(BYTE *buf);
|
||||
// $4E - seek file
|
||||
void FASTCALL FS_TimeStamp(BYTE *buf);
|
||||
// $4F - get/set file time
|
||||
void FASTCALL FS_GetCapacity(BYTE *buf);
|
||||
// $50 - get capacity
|
||||
void FASTCALL FS_CtrlDrive(BYTE *buf);
|
||||
// $51 - drive status check/control
|
||||
void FASTCALL FS_GetDPB(BYTE *buf);
|
||||
// $52 - get DPB
|
||||
void FASTCALL FS_DiskRead(BYTE *buf);
|
||||
// $53 - read sector
|
||||
void FASTCALL FS_DiskWrite(BYTE *buf);
|
||||
// $54 - write sector
|
||||
void FASTCALL FS_Ioctrl(BYTE *buf);
|
||||
// $55 - IOCTRL
|
||||
void FASTCALL FS_Flush(BYTE *buf);
|
||||
// $56 - flush cache
|
||||
void FASTCALL FS_CheckMedia(BYTE *buf);
|
||||
// $57 - check media
|
||||
void FASTCALL FS_Lock(BYTE *buf);
|
||||
// $58 - get exclusive control
|
||||
void FASTCALL FS_InitDevice(BYTE *buf); // $40 - boot
|
||||
void FASTCALL FS_CheckDir(BYTE *buf); // $41 - directory check
|
||||
void FASTCALL FS_MakeDir(BYTE *buf); // $42 - create directory
|
||||
void FASTCALL FS_RemoveDir(BYTE *buf); // $43 - delete directory
|
||||
void FASTCALL FS_Rename(BYTE *buf); // $44 - change filename
|
||||
void FASTCALL FS_Delete(BYTE *buf); // $45 - delete file
|
||||
void FASTCALL FS_Attribute(BYTE *buf); // $46 - get/set file attributes
|
||||
void FASTCALL FS_Files(BYTE *buf); // $47 - file search
|
||||
void FASTCALL FS_NFiles(BYTE *buf); // $48 - find next file
|
||||
void FASTCALL FS_Create(BYTE *buf); // $49 - create file
|
||||
void FASTCALL FS_Open(BYTE *buf); // $4A - open file
|
||||
void FASTCALL FS_Close(BYTE *buf); // $4B - close file
|
||||
void FASTCALL FS_Read(BYTE *buf); // $4C - read file
|
||||
void FASTCALL FS_Write(BYTE *buf); // $4D - write file
|
||||
void FASTCALL FS_Seek(BYTE *buf); // $4E - seek file
|
||||
void FASTCALL FS_TimeStamp(BYTE *buf); // $4F - get/set file time
|
||||
void FASTCALL FS_GetCapacity(BYTE *buf); // $50 - get capacity
|
||||
void FASTCALL FS_CtrlDrive(BYTE *buf); // $51 - drive status check/control
|
||||
void FASTCALL FS_GetDPB(BYTE *buf); // $52 - get DPB
|
||||
void FASTCALL FS_DiskRead(BYTE *buf); // $53 - read sector
|
||||
void FASTCALL FS_DiskWrite(BYTE *buf); // $54 - write sector
|
||||
void FASTCALL FS_Ioctrl(BYTE *buf); // $55 - IOCTRL
|
||||
void FASTCALL FS_Flush(BYTE *buf); // $56 - flush cache
|
||||
void FASTCALL FS_CheckMedia(BYTE *buf); // $57 - check media
|
||||
void FASTCALL FS_Lock(BYTE *buf); // $58 - get exclusive control
|
||||
|
||||
CFileSys *fs;
|
||||
// File system accessor
|
||||
DWORD fsresult;
|
||||
// File system access result code
|
||||
BYTE fsout[0x800];
|
||||
// File system access result buffer
|
||||
DWORD fsoutlen;
|
||||
// File system access result buffer size
|
||||
BYTE fsopt[0x1000000];
|
||||
// File system access buffer
|
||||
DWORD fsoptlen;
|
||||
// File system access buffer size
|
||||
CFileSys *fs; // File system accessor
|
||||
DWORD fsresult; // File system access result code
|
||||
BYTE fsout[0x800]; // File system access result buffer
|
||||
DWORD fsoutlen; // File system access result buffer size
|
||||
BYTE fsopt[0x1000000]; // File system access buffer
|
||||
DWORD fsoptlen; // File system access buffer size
|
||||
};
|
||||
|
@ -5,12 +5,12 @@
|
||||
//
|
||||
// Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp)
|
||||
// Copyright (C) 2014-2020 GIMONS
|
||||
// Copyright (C) akuker
|
||||
// Copyright (C) akuker
|
||||
//
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
//
|
||||
// [ SCSI Hard Disk for Apple Macintosh ]
|
||||
// [ SCSI Hard Disk for Apple Macintosh ]
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
@ -5,12 +5,12 @@
|
||||
//
|
||||
// Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp)
|
||||
// Copyright (C) 2014-2020 GIMONS
|
||||
// Copyright (C) akuker
|
||||
// Copyright (C) akuker
|
||||
//
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
//
|
||||
// [ SCSI Hard Disk for Apple Macintosh ]
|
||||
// [ SCSI Hard Disk for Apple Macintosh ]
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma once
|
||||
@ -36,50 +36,30 @@ class CDTrack
|
||||
{
|
||||
public:
|
||||
// Basic Functions
|
||||
CDTrack(SCSICD *scsicd);
|
||||
// Constructor
|
||||
virtual ~CDTrack();
|
||||
// Destructor
|
||||
BOOL FASTCALL Init(int track, DWORD first, DWORD last);
|
||||
// Initialization
|
||||
CDTrack(SCSICD *scsicd); // Constructor
|
||||
virtual ~CDTrack(); // Destructor
|
||||
BOOL FASTCALL Init(int track, DWORD first, DWORD last); // Initialization
|
||||
|
||||
// Properties
|
||||
void FASTCALL SetPath(BOOL cdda, const Filepath& path);
|
||||
// Set the path
|
||||
void FASTCALL GetPath(Filepath& path) const;
|
||||
// Get the path
|
||||
void FASTCALL AddIndex(int index, DWORD lba);
|
||||
// Add index
|
||||
DWORD FASTCALL GetFirst() const;
|
||||
// Get the start LBA
|
||||
DWORD FASTCALL GetLast() const;
|
||||
// Get the last LBA
|
||||
DWORD FASTCALL GetBlocks() const;
|
||||
// Get the number of blocks
|
||||
int FASTCALL GetTrackNo() const;
|
||||
// Get the track number
|
||||
BOOL FASTCALL IsValid(DWORD lba) const;
|
||||
// Is this a valid LBA?
|
||||
BOOL FASTCALL IsAudio() const;
|
||||
// Is this an audio track?
|
||||
void FASTCALL SetPath(BOOL cdda, const Filepath& path); // Set the path
|
||||
void FASTCALL GetPath(Filepath& path) const; // Get the path
|
||||
void FASTCALL AddIndex(int index, DWORD lba); // Add index
|
||||
DWORD FASTCALL GetFirst() const; // Get the start LBA
|
||||
DWORD FASTCALL GetLast() const; // Get the last LBA
|
||||
DWORD FASTCALL GetBlocks() const; // Get the number of blocks
|
||||
int FASTCALL GetTrackNo() const; // Get the track number
|
||||
BOOL FASTCALL IsValid(DWORD lba) const; // Is this a valid LBA?
|
||||
BOOL FASTCALL IsAudio() const; // Is this an audio track?
|
||||
|
||||
private:
|
||||
SCSICD *cdrom;
|
||||
// Parent device
|
||||
BOOL valid;
|
||||
// Valid track
|
||||
int track_no;
|
||||
// Track number
|
||||
DWORD first_lba;
|
||||
// First LBA
|
||||
DWORD last_lba;
|
||||
// Last LBA
|
||||
BOOL audio;
|
||||
// Audio track flag
|
||||
BOOL raw;
|
||||
// RAW data flag
|
||||
Filepath imgpath;
|
||||
// Image file path
|
||||
SCSICD *cdrom; // Parent device
|
||||
BOOL valid; // Valid track
|
||||
int track_no; // Track number
|
||||
DWORD first_lba; // First LBA
|
||||
DWORD last_lba; // Last LBA
|
||||
BOOL audio; // Audio track flag
|
||||
BOOL raw; // RAW data flag
|
||||
Filepath imgpath; // Image file path
|
||||
};
|
||||
|
||||
//===========================================================================
|
||||
@ -91,47 +71,29 @@ class CDDABuf
|
||||
{
|
||||
public:
|
||||
// Basic Functions
|
||||
CDDABuf();
|
||||
// Constructor
|
||||
virtual ~CDDABuf();
|
||||
// Destructor
|
||||
#if 0
|
||||
BOOL Init();
|
||||
// Initialization
|
||||
BOOL FASTCALL Load(const Filepath& path);
|
||||
// Load
|
||||
BOOL FASTCALL Save(const Filepath& path);
|
||||
// Save
|
||||
CDDABuf(); // Constructor
|
||||
virtual ~CDDABuf(); // Destructor
|
||||
#if 0
|
||||
BOOL Init(); // Initialization
|
||||
BOOL FASTCALL Load(const Filepath& path); // Load
|
||||
BOOL FASTCALL Save(const Filepath& path); // Save
|
||||
|
||||
// API
|
||||
void FASTCALL Clear();
|
||||
// Clear the buffer
|
||||
BOOL FASTCALL Open(Filepath& path);
|
||||
// File specification
|
||||
BOOL FASTCALL GetBuf(DWORD *buffer, int frames);
|
||||
// Get the buffer
|
||||
BOOL FASTCALL IsValid();
|
||||
// Check if Valid
|
||||
BOOL FASTCALL ReadReq();
|
||||
// Read Request
|
||||
BOOL FASTCALL IsEnd() const;
|
||||
// Finish check
|
||||
void FASTCALL Clear(); // Clear the buffer
|
||||
BOOL FASTCALL Open(Filepath& path); // File specification
|
||||
BOOL FASTCALL GetBuf(DWORD *buffer, int frames); // Get the buffer
|
||||
BOOL FASTCALL IsValid(); // Check if Valid
|
||||
BOOL FASTCALL ReadReq(); // Read Request
|
||||
BOOL FASTCALL IsEnd() const; // Finish check
|
||||
|
||||
private:
|
||||
Filepath wavepath;
|
||||
// Wave path
|
||||
BOOL valid;
|
||||
// Open result (is it valid?)
|
||||
DWORD *m_buf;
|
||||
// Data buffer
|
||||
DWORD read;
|
||||
// Read pointer
|
||||
DWORD write;
|
||||
// Write pointer
|
||||
DWORD num;
|
||||
// Valid number of data
|
||||
DWORD rest;
|
||||
// Remaining file size
|
||||
Filepath wavepath; // Wave path
|
||||
BOOL valid; // Open result (is it valid?)
|
||||
DWORD *buf; // Data buffer
|
||||
DWORD read; // Read pointer
|
||||
DWORD write; // Write pointer
|
||||
DWORD num; // Valid number of data
|
||||
DWORD rest; // Remaining file size
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -145,86 +107,56 @@ class SCSICD : public Disk
|
||||
public:
|
||||
// Number of tracks
|
||||
enum {
|
||||
TrackMax = 96 // Maximum number of tracks
|
||||
TrackMax = 96 // Maximum number of tracks
|
||||
};
|
||||
|
||||
public:
|
||||
// Basic Functions
|
||||
SCSICD();
|
||||
// Constructor
|
||||
virtual ~SCSICD();
|
||||
// Destructor
|
||||
BOOL FASTCALL Open(const Filepath& path, BOOL attn = TRUE);
|
||||
// Open
|
||||
#ifndef RASCSI
|
||||
BOOL FASTCALL Load(Fileio *fio, int ver);
|
||||
// Load
|
||||
#endif // RASCSI
|
||||
SCSICD(); // Constructor
|
||||
virtual ~SCSICD(); // Destructor
|
||||
BOOL FASTCALL Open(const Filepath& path, BOOL attn = TRUE); // Open
|
||||
#ifndef RASCSI
|
||||
BOOL FASTCALL Load(Fileio *fio, int ver); // Load
|
||||
#endif // RASCSI
|
||||
|
||||
// commands
|
||||
int FASTCALL Inquiry(const DWORD *cdb, BYTE *buf, DWORD major, DWORD minor);
|
||||
// INQUIRY command
|
||||
int FASTCALL Read(const DWORD *cdb, BYTE *buf, DWORD block) override;
|
||||
// READ command
|
||||
int FASTCALL ReadToc(const DWORD *cdb, BYTE *buf);
|
||||
// READ TOC command
|
||||
BOOL FASTCALL PlayAudio(const DWORD *cdb);
|
||||
// PLAY AUDIO command
|
||||
BOOL FASTCALL PlayAudioMSF(const DWORD *cdb);
|
||||
// PLAY AUDIO MSF command
|
||||
BOOL FASTCALL PlayAudioTrack(const DWORD *cdb);
|
||||
// PLAY AUDIO TRACK command
|
||||
int FASTCALL Inquiry(const DWORD *cdb, BYTE *buf, DWORD major, DWORD minor); // INQUIRY command
|
||||
int FASTCALL Read(const DWORD *cdb, BYTE *buf, DWORD block) override; // READ command
|
||||
int FASTCALL ReadToc(const DWORD *cdb, BYTE *buf); // READ TOC command
|
||||
BOOL FASTCALL PlayAudio(const DWORD *cdb); // PLAY AUDIO command
|
||||
BOOL FASTCALL PlayAudioMSF(const DWORD *cdb); // PLAY AUDIO MSF command
|
||||
BOOL FASTCALL PlayAudioTrack(const DWORD *cdb); // PLAY AUDIO TRACK command
|
||||
|
||||
// CD-DA
|
||||
BOOL FASTCALL NextFrame();
|
||||
// Frame notification
|
||||
void FASTCALL GetBuf(DWORD *buffer, int samples, DWORD rate);
|
||||
// Get CD-DA buffer
|
||||
BOOL FASTCALL NextFrame(); // Frame notification
|
||||
void FASTCALL GetBuf(DWORD *buffer, int samples, DWORD rate); // Get CD-DA buffer
|
||||
|
||||
// LBA-MSF変換
|
||||
void FASTCALL LBAtoMSF(DWORD lba, BYTE *msf) const;
|
||||
// LBA→MSF conversion
|
||||
DWORD FASTCALL MSFtoLBA(const BYTE *msf) const;
|
||||
// MSF→LBA conversion
|
||||
void FASTCALL LBAtoMSF(DWORD lba, BYTE *msf) const; // LBA→MSF conversion
|
||||
DWORD FASTCALL MSFtoLBA(const BYTE *msf) const; // MSF→LBA conversion
|
||||
|
||||
private:
|
||||
// Open
|
||||
BOOL FASTCALL OpenCue(const Filepath& path);
|
||||
// Open(CUE)
|
||||
BOOL FASTCALL OpenIso(const Filepath& path);
|
||||
// Open(ISO)
|
||||
BOOL FASTCALL OpenPhysical(const Filepath& path);
|
||||
// Open(Physical)
|
||||
BOOL rawfile;
|
||||
// RAW flag
|
||||
BOOL FASTCALL OpenCue(const Filepath& path); // Open(CUE)
|
||||
BOOL FASTCALL OpenIso(const Filepath& path); // Open(ISO)
|
||||
BOOL FASTCALL OpenPhysical(const Filepath& path); // Open(Physical)
|
||||
BOOL rawfile; // RAW flag
|
||||
|
||||
// Track management
|
||||
void FASTCALL ClearTrack();
|
||||
// Clear the track
|
||||
int FASTCALL SearchTrack(DWORD lba) const;
|
||||
// Track search
|
||||
CDTrack* track[TrackMax];
|
||||
// Track opbject references
|
||||
int tracks;
|
||||
// Effective number of track objects
|
||||
int dataindex;
|
||||
// Current data track
|
||||
int audioindex;
|
||||
// Current audio track
|
||||
void FASTCALL ClearTrack(); // Clear the track
|
||||
int FASTCALL SearchTrack(DWORD lba) const; // Track search
|
||||
CDTrack* track[TrackMax]; // Track opbject references
|
||||
int tracks; // Effective number of track objects
|
||||
int dataindex; // Current data track
|
||||
int audioindex; // Current audio track
|
||||
|
||||
int frame;
|
||||
// Frame number
|
||||
int frame; // Frame number
|
||||
|
||||
#if 0
|
||||
CDDABuf da_buf;
|
||||
// CD-DA buffer
|
||||
int da_num;
|
||||
// Number of CD-DA tracks
|
||||
int da_cur;
|
||||
// CD-DA current track
|
||||
int da_next;
|
||||
// CD-DA next track
|
||||
BOOL da_req;
|
||||
// CD-DA data request
|
||||
#endif
|
||||
#if 0
|
||||
CDDABuf da_buf; // CD-DA buffer
|
||||
int da_num; // Number of CD-DA tracks
|
||||
int da_cur; // CD-DA current track
|
||||
int da_next; // CD-DA next track
|
||||
BOOL da_req; // CD-DA data request
|
||||
#endif
|
||||
};
|
||||
|
@ -5,12 +5,12 @@
|
||||
//
|
||||
// Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp)
|
||||
// Copyright (C) 2014-2020 GIMONS
|
||||
// Copyright (C) akuker
|
||||
// Copyright (C) akuker
|
||||
//
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
//
|
||||
// [ SCSI hard disk ]
|
||||
// [ SCSI hard disk ]
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
#include "scsihd.h"
|
||||
|
@ -5,10 +5,10 @@
|
||||
//
|
||||
// Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp)
|
||||
// Copyright (C) 2014-2020 GIMONS
|
||||
// Copyright (C) akuker
|
||||
// Copyright (C) akuker
|
||||
//
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
//
|
||||
// [ SCSI hard disk ]
|
||||
//
|
||||
@ -28,17 +28,11 @@ class SCSIHD : public Disk
|
||||
{
|
||||
public:
|
||||
// Basic Functions
|
||||
SCSIHD();
|
||||
// Constructor
|
||||
void FASTCALL Reset();
|
||||
// Reset
|
||||
BOOL FASTCALL Open(const Filepath& path, BOOL attn = TRUE);
|
||||
// Open
|
||||
SCSIHD(); // Constructor
|
||||
void FASTCALL Reset(); // Reset
|
||||
BOOL FASTCALL Open(const Filepath& path, BOOL attn = TRUE); // Open
|
||||
|
||||
// commands
|
||||
int FASTCALL Inquiry(
|
||||
const DWORD *cdb, BYTE *buf, DWORD major, DWORD minor);
|
||||
// INQUIRY command
|
||||
BOOL FASTCALL ModeSelect(const DWORD *cdb, const BYTE *buf, int length);
|
||||
// MODE SELECT(6) command
|
||||
int FASTCALL Inquiry(const DWORD *cdb, BYTE *buf, DWORD major, DWORD minor); // INQUIRY command
|
||||
BOOL FASTCALL ModeSelect(const DWORD *cdb, const BYTE *buf, int length); // MODE SELECT(6) command
|
||||
};
|
@ -5,12 +5,12 @@
|
||||
//
|
||||
// Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp)
|
||||
// Copyright (C) 2014-2020 GIMONS
|
||||
// Copyright (C) akuker
|
||||
// Copyright (C) akuker
|
||||
//
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
//
|
||||
// [ SCSI Hard Disk for Apple Macintosh ]
|
||||
// [ SCSI Hard Disk for Apple Macintosh ]
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
@ -5,12 +5,12 @@
|
||||
//
|
||||
// Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp)
|
||||
// Copyright (C) 2014-2020 GIMONS
|
||||
// Copyright (C) akuker
|
||||
// Copyright (C) akuker
|
||||
//
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
//
|
||||
// [ SCSI Hard Disk for Apple Macintosh ]
|
||||
// [ SCSI Hard Disk for Apple Macintosh ]
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma once
|
||||
@ -26,14 +26,10 @@ class SCSIHD_APPLE : public SCSIHD
|
||||
{
|
||||
public:
|
||||
// Basic Functions
|
||||
SCSIHD_APPLE();
|
||||
// Constructor
|
||||
SCSIHD_APPLE(); // Constructor
|
||||
// commands
|
||||
int FASTCALL Inquiry(
|
||||
const DWORD *cdb, BYTE *buf, DWORD major, DWORD minor);
|
||||
// INQUIRY command
|
||||
int FASTCALL Inquiry(const DWORD *cdb, BYTE *buf, DWORD major, DWORD minor); // INQUIRY command
|
||||
|
||||
// Internal processing
|
||||
int FASTCALL AddVendor(int page, BOOL change, BYTE *buf);
|
||||
// Add vendor special page
|
||||
int FASTCALL AddVendor(int page, BOOL change, BYTE *buf); // Add vendor special page
|
||||
};
|
@ -5,12 +5,12 @@
|
||||
//
|
||||
// Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp)
|
||||
// Copyright (C) 2014-2020 GIMONS
|
||||
// Copyright (C) akuker
|
||||
// Copyright (C) akuker
|
||||
//
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
//
|
||||
// [ SCSI NEC "Genuine" Hard Disk]
|
||||
// [ SCSI NEC "Genuine" Hard Disk]
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
@ -5,12 +5,12 @@
|
||||
//
|
||||
// Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp)
|
||||
// Copyright (C) 2014-2020 GIMONS
|
||||
// Copyright (C) akuker
|
||||
// Copyright (C) akuker
|
||||
//
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
//
|
||||
// [ SCSI NEC "Genuine" Hard Disk]
|
||||
// [ SCSI NEC "Genuine" Hard Disk]
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma once
|
||||
@ -26,36 +26,22 @@ class SCSIHD_NEC : public SCSIHD
|
||||
{
|
||||
public:
|
||||
// Basic Functions
|
||||
SCSIHD_NEC();
|
||||
// Constructor
|
||||
|
||||
BOOL FASTCALL Open(const Filepath& path, BOOL attn = TRUE);
|
||||
// Open
|
||||
SCSIHD_NEC(); // Constructor
|
||||
BOOL FASTCALL Open(const Filepath& path, BOOL attn = TRUE); // Open
|
||||
|
||||
// commands
|
||||
int FASTCALL Inquiry(
|
||||
const DWORD *cdb, BYTE *buf, DWORD major, DWORD minor);
|
||||
// INQUIRY command
|
||||
int FASTCALL Inquiry(const DWORD *cdb, BYTE *buf, DWORD major, DWORD minor); // INQUIRY command
|
||||
|
||||
// Internal processing
|
||||
int FASTCALL AddError(BOOL change, BYTE *buf);
|
||||
// Add error
|
||||
int FASTCALL AddFormat(BOOL change, BYTE *buf);
|
||||
// Add format
|
||||
int FASTCALL AddDrive(BOOL change, BYTE *buf);
|
||||
// Add drive
|
||||
int FASTCALL AddError(BOOL change, BYTE *buf); // Add error
|
||||
int FASTCALL AddFormat(BOOL change, BYTE *buf); // Add format
|
||||
int FASTCALL AddDrive(BOOL change, BYTE *buf); // Add drive
|
||||
|
||||
private:
|
||||
int cylinders;
|
||||
// Number of cylinders
|
||||
int heads;
|
||||
// Number of heads
|
||||
int sectors;
|
||||
// Number of sectors
|
||||
int sectorsize;
|
||||
// Sector size
|
||||
off64_t imgoffset;
|
||||
// Image offset
|
||||
off64_t imgsize;
|
||||
// Image size
|
||||
int cylinders; // Number of cylinders
|
||||
int heads; // Number of heads
|
||||
int sectors; // Number of sectors
|
||||
int sectorsize; // Sector size
|
||||
off64_t imgoffset; // Image offset
|
||||
off64_t imgsize; // Image size
|
||||
};
|
@ -5,12 +5,12 @@
|
||||
//
|
||||
// Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp)
|
||||
// Copyright (C) 2014-2020 GIMONS
|
||||
// Copyright (C) akuker
|
||||
// Copyright (C) akuker
|
||||
//
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
//
|
||||
// [ SCSI Magneto-Optical Disk]
|
||||
// [ SCSI Magneto-Optical Disk]
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
@ -5,12 +5,12 @@
|
||||
//
|
||||
// Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp)
|
||||
// Copyright (C) 2014-2020 GIMONS
|
||||
// Copyright (C) akuker
|
||||
// Copyright (C) akuker
|
||||
//
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
// Licensed under the BSD 3-Clause License.
|
||||
// See LICENSE file in the project root folder.
|
||||
//
|
||||
// [ SCSI Magneto-Optical Disk]
|
||||
// [ SCSI Magneto-Optical Disk]
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma once
|
||||
@ -28,22 +28,16 @@ class SCSIMO : public Disk
|
||||
{
|
||||
public:
|
||||
// Basic Functions
|
||||
SCSIMO();
|
||||
// Constructor
|
||||
BOOL FASTCALL Open(const Filepath& path, BOOL attn = TRUE);
|
||||
// Open
|
||||
#ifndef RASCSI
|
||||
BOOL FASTCALL Load(Fileio *fio, int ver);
|
||||
// Load
|
||||
#endif // RASCSI
|
||||
SCSIMO(); // Constructor
|
||||
BOOL FASTCALL Open(const Filepath& path, BOOL attn = TRUE); // Open
|
||||
#ifndef RASCSI
|
||||
BOOL FASTCALL Load(Fileio *fio, int ver); // Load
|
||||
#endif // RASCSI
|
||||
|
||||
// commands
|
||||
int FASTCALL Inquiry(const DWORD *cdb, BYTE *buf, DWORD major, DWORD minor);
|
||||
// INQUIRY command
|
||||
BOOL FASTCALL ModeSelect(const DWORD *cdb, const BYTE *buf, int length);
|
||||
// MODE SELECT(6) command
|
||||
int FASTCALL Inquiry(const DWORD *cdb, BYTE *buf, DWORD major, DWORD minor); // INQUIRY command
|
||||
BOOL FASTCALL ModeSelect(const DWORD *cdb, const BYTE *buf, int length); // MODE SELECT(6) command
|
||||
|
||||
// Internal processing
|
||||
int FASTCALL AddVendor(int page, BOOL change, BYTE *buf);
|
||||
// Add vendor special page
|
||||
int FASTCALL AddVendor(int page, BOOL change, BYTE *buf); // Add vendor special page
|
||||
};
|
Loading…
Reference in New Issue
Block a user