Disabled SEL interrupt functionality so we can receive IP packets without delays. Some updates for receiving messages. Appears that the HD functionality still works, but others are untested

This commit is contained in:
akuker
2020-09-22 20:57:28 -05:00
parent 661ce30067
commit 3e4f23d53d
9 changed files with 101 additions and 25 deletions

View File

@@ -8,13 +8,14 @@
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/bin/rascsi",
"program": "${workspaceFolder}/bin/fullspec/rascsi",
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "${workspaceFolder}/launch_sudo.sh",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",

View File

@@ -147,7 +147,7 @@ BUS::phase_t FASTCALL SCSIDEV::Process()
//---------------------------------------------------------------------------
//
// Phaes
// Phases
//
//---------------------------------------------------------------------------
@@ -2083,3 +2083,32 @@ BOOL FASTCALL SCSIDEV::XferMsg(DWORD msg)
return TRUE;
}
//---------------------------------------------------------------------------
//
// Transfer IP packet to the host via SCSI
//
//---------------------------------------------------------------------------
BOOL FASTCALL SCSIDEV::TransferPacketToHost(int packet_len){
// Aquire the bus
// Reselection
// Message OUT (expect a "NO OPERATION")
// IF we get a DISCONNECT message, abort sending the message
// Transition to MESSAGE IN and send a DISCONNECT
// then go to BUS FREE
// DATA IN
// ... send the packet
// MESSAGE OUT (expect a "NO OPERATION")
// If more packets, go back to DATA IN
// Else
// MESSAGE IN (sends DISCONNECT)
// BUS FREE
}

View File

@@ -102,6 +102,8 @@ public:
BOOL FASTCALL IsSCSI() const {return TRUE;}
// SCSI check
BOOL FASTCALL TransferPacketToHost(int packet_len);
private:
// Phase
void FASTCALL BusFree();

View File

@@ -5,6 +5,7 @@
//
// Powered by XM6 TypeG Technology.
// Copyright (C) 2016-2020 GIMONS
// Copyright akuker
//
// Imported NetBSD support and some optimisation patch by Rin Okuyama.
//

View File

@@ -460,22 +460,27 @@ void FASTCALL SCSINuvolink::SetMacAddr(BYTE *mac)
// Receive Packet
//
//---------------------------------------------------------------------------
void FASTCALL SCSINuvolink::ReceivePacket()
int FASTCALL SCSINuvolink::ReceivePacket()
{
static const BYTE bcast_addr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
ASSERT(this);
ASSERT(tap);
LOGTRACE("SCSINuvolink::ReceivePacket");
//LOGTRACE("SCSINuvolink::ReceivePacket");
// previous packet has not been received
if (packet_enable) {
return;
}
// // previous packet has not been received
// if (packet_enable) {
// LOGDEBUG("packet not enabled");
// return;
// }
// Receive packet
packet_len = tap->Rx(packet_buf);
if(packet_len){
LOGINFO("Received a packet of size %d",packet_len);
}
// Check if received packet
if (memcmp(packet_buf, mac_addr, 6) != 0) {
if (memcmp(packet_buf, bcast_addr, 6) != 0) {
@@ -486,16 +491,23 @@ void FASTCALL SCSINuvolink::ReceivePacket()
// Discard if it exceeds the buffer size
if (packet_len > 2048) {
LOGDEBUG("Packet size was too big. Dropping it");
packet_len = 0;
return;
}
// Store in receive buffer
if (packet_len > 0) {
packet_enable = TRUE;
}
// TransferPacket(packet_len, packet_buff);
return packet_len;
// // Store in receive buffer
// if (packet_len > 0) {
// packet_enable = TRUE;
// }
}
//---------------------------------------------------------------------------
//
// Get Packet

View File

@@ -44,16 +44,18 @@ public:
// Destructor
// commands
int FASTCALL Inquiry(const DWORD *cdb, BYTE *buf, DWORD major, DWORD minor);
int FASTCALL Inquiry(const DWORD *cdb, BYTE *buffer, DWORD major, DWORD minor);
// INQUIRY command
BOOL FASTCALL TestUnitReady(const DWORD *cdb);
// TEST UNIT READY command
int FASTCALL GetMessage6(const DWORD *cdb, BYTE *buf);
int FASTCALL GetMessage6(const DWORD *cdb, BYTE *buffer);
// GET MESSAGE10 command
BOOL FASTCALL SendMessage6(const DWORD *cdb, BYTE *buf);
BOOL FASTCALL SendMessage6(const DWORD *cdb, BYTE *buffer);
// SEND MESSAGE10 command
BOOL SendPacket(BYTE *buf, int len);
BOOL SendPacket(BYTE *buffer, int len);
// Send a packet
int FASTCALL ReceivePacket();
// Receive a packet
private:
@@ -77,17 +79,16 @@ private:
static const char* m_revision;
#if defined(RASCSI) && !defined(BAREMETAL)
int FASTCALL GetMacAddr(BYTE *buf);
int FASTCALL GetMacAddr(BYTE *buffer);
// Get MAC address
void FASTCALL SetMacAddr(BYTE *buf);
void FASTCALL SetMacAddr(BYTE *buffer);
// Set MAC address
void FASTCALL ReceivePacket();
// Receive a packet
void FASTCALL GetPacketBuf(BYTE *buf);
void FASTCALL GetPacketBuf(BYTE *buffer);
// Get a packet
void FASTCALL SetMulticastRegisters(BYTE *buf, int len);
void FASTCALL SetMulticastRegisters(BYTE *buffer, int len);
// Change the multicast registers
void FASTCALL TransferPacketToHost(BYTE *buffer, int len);
// Transfer the received packet to the host
CTapDriver *tap;
// TAP driver
BOOL m_bTapEnable;

3
src/raspberrypi/launch_sudo.sh Executable file
View File

@@ -0,0 +1,3 @@
# This is used for debugging. VisualStudio code will call this file when launching
# the debugger, instead of directly calling GDB. That way we can add the pkexec
sudo /usr/bin/gdb "$@"

View File

@@ -1136,6 +1136,31 @@ LOGCRITICAL("LOGCRITICAL");
actid = -1;
phase = BUS::busfree;
// If any of the controllers are an Ethernet
// device, check to see if there is new data
// received.
for (int x = 0; x < CtrlMax; x++) {
if (!ctrl[x]){
continue;
}
for (int y = 0; y < UnitNum; y++) {
int unitno = x * UnitNum + y;
// branch by unit type
if (disk[unitno]) {
if (disk[unitno]->GetID() == MAKEID('S','C','N','L')) {
// Receive the data....
int packet_len = ((SCSINuvolink*)disk[unitno])->ReceivePacket();
if(packet_len > 0){
((SCSIDEV*)ctrl[x])->TransferPacketToHost(packet_len);
}
}
}
}
}
#ifdef USE_SEL_EVENT_ENABLE
// SEL signal polling
if (bus->PollSelectEvent() < 0) {

View File

@@ -39,7 +39,9 @@
// Various Operation Settings
//
//---------------------------------------------------------------------------
#define USE_SEL_EVENT_ENABLE // Check SEL signal by event
// For now, USE_SEL_EVENT_ENABLE is incompatible with the Nuvolink functionality.
// See https://github.com/akuker/RASCSI/issues/27 for more information
//#define USE_SEL_EVENT_ENABLE // Check SEL signal by event
#define REMOVE_FIXED_SASIHD_SIZE // remove the size limitation of SASIHD
#define USE_MZ1F23_1024_SUPPORT // MZ-1F23 (SASI 20M/sector size 1024)