Merge version 20.12.0 into the master branch (#75)

* Update README.md

Added reference to gitflow

* Updated to match new versioning structure (#73)

* Updated to match new versioning structure

* fix version number

Co-authored-by: Tony Kuker <akuker@gmail.com>

* Scsimon improvements (#74)

* Updated scsimon to save data on a nano-second time scale, instead of micro-second

* Cleanup error messages and data types

Co-authored-by: Tony Kuker <akuker@gmail.com>

* Updated for new version number

* Change reported version back to development build

Co-authored-by: Tony Kuker <akuker@gmail.com>
This commit is contained in:
akuker 2021-01-25 13:27:57 -06:00 committed by GitHub
parent 43a601a977
commit 23cfeb7322
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 214 additions and 72 deletions

View File

@ -9,4 +9,14 @@ RaSCSI is a virtual SCSI device emulator that runs on a Raspberry Pi. It runs in
Please check out the full story with much more detail on the [wiki](https://github.com/akuker/RASCSI/wiki)!
# How do I contribute?
RaSCSI is using the <a href="https://datasift.github.io/gitflow/IntroducingGitFlow.html">Gitflow Workflow</a>. A quick overview:
- The *master* branch should always reflect the contents of the last stable release
- The *develop* branch should contain the latest tested & approved updates. Pull requests should be used to merge changes into develop.
- The rest of the feature branches are for developing new features
- A tag will be created for each "release". The releases will be named <year>.<month> (for the first release of the month). Hot fixes, if necessary, will be released as <year>.<month>.<release number>. For example, the first release in January 2021 will be release "21.01". If a hot-fix is needed for this release, the first hotfix will be "21.01.1".
Typically, releases will only be planned every few months.
<a href="https://www.tindie.com/stores/landogriffin/?ref=offsite_badges&utm_source=sellers_akuker&utm_medium=badges&utm_campaign=badge_large"><img src="https://d2ss6ovg47m0r5.cloudfront.net/badges/tindie-larges.png" alt="I sell on Tindie" width="200" height="104"></a>

View File

@ -75,6 +75,7 @@ SRC_RASCSI = \
gpiobus.cpp \
filepath.cpp \
fileio.cpp\
rascsi_version.cpp
# os.cpp
# rasctl_command.cpp
# rascsi_mgr.cpp
@ -87,13 +88,15 @@ SRC_SCSIMON = \
scsi.cpp \
gpiobus.cpp \
filepath.cpp \
fileio.cpp
fileio.cpp\
rascsi_version.cpp
SRC_SCSIMON += $(shell find ./controllers -name '*.cpp')
SRC_SCSIMON += $(shell find ./devices -name '*.cpp')
SRC_RASCTL = \
rasctl.cpp
rasctl.cpp\
rascsi_version.cpp
# rasctl_command.cpp
SRC_RASDUMP = \
@ -101,14 +104,16 @@ SRC_RASDUMP = \
scsi.cpp \
gpiobus.cpp \
filepath.cpp \
fileio.cpp
fileio.cpp\
rascsi_version.cpp
SRC_SASIDUMP = \
sasidump.cpp \
scsi.cpp \
gpiobus.cpp \
filepath.cpp \
fileio.cpp
fileio.cpp\
rascsi_version.cpp
vpath %.h ./ ./controllers ./devices
vpath %.cpp ./ ./controllers ./devices

View File

@ -16,6 +16,7 @@
#include "controllers/scsidev_ctrl.h"
#include "gpiobus.h"
#include "devices/scsi_host_bridge.h"
#include "rascsi_version.h"
//===========================================================================
//
@ -553,12 +554,8 @@ void FASTCALL SCSIDEV::CmdInquiry()
// Processed on the disk side (it is originally processed by the controller)
if (disk) {
#ifdef RASCSI
major = (DWORD)(RASCSI >> 8);
minor = (DWORD)(RASCSI & 0xff);
#else
host->GetVM()->GetVersion(major, minor);
#endif // RASCSI
major = (DWORD)rascsi_major_version;
minor = (DWORD)rascsi_minor_version;
ctrl.length =
ctrl.unit[lun]->Inquiry(ctrl.cmd, ctrl.buffer, major, minor);
} else {

View File

@ -124,6 +124,7 @@
typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef unsigned long DWORD;
typedef unsigned long long QWORD;
typedef int BOOL;
typedef char TCHAR;
typedef char *LPTSTR;

View File

@ -24,6 +24,7 @@
#include "controllers/scsidev_ctrl.h"
#include "controllers/sasidev_ctrl.h"
#include "gpiobus.h"
#include "rascsi_version.h"
#include "spdlog/spdlog.h"
//---------------------------------------------------------------------------
@ -78,10 +79,8 @@ void KillHandler(int sig)
void Banner(int argc, char* argv[])
{
FPRT(stdout,"SCSI Target Emulator RaSCSI(*^..^*) ");
FPRT(stdout,"version %01d.%01d%01d(%s, %s)\n",
(int)((VERSION >> 8) & 0xf),
(int)((VERSION >> 4) & 0xf),
(int)((VERSION ) & 0xf),
FPRT(stdout,"version %s (%s, %s)\n",
rascsi_get_version_string(),
__DATE__,
__TIME__);
FPRT(stdout,"Powered by XM6 TypeG Technology / ");

View File

@ -0,0 +1,44 @@
//---------------------------------------------------------------------------
//
// SCSI Target Emulator RaSCSI (*^..^*)
// for Raspberry Pi
//
// Copyright (C) 2020 akuker
// [ Define the version string]
//
//---------------------------------------------------------------------------
#include "rascsi_version.h"
#include <stdio.h>
#include <string.h>
// The following should be updated for each release
const int rascsi_major_version = 20; // Last two digits of year
const int rascsi_minor_version = 12; // Month
const int rascsi_patch_version = -1; // Patch number - increment for each update
static char rascsi_version_string[30]; // Allow for string up to "XX.XX.XXX" + null character + "development build"
//---------------------------------------------------------------------------
//
// Get the RaSCSI version string
//
//---------------------------------------------------------------------------
char* rascsi_get_version_string()
{
if(rascsi_patch_version < 0)
{
snprintf(rascsi_version_string, sizeof(rascsi_version_string),
"%02d.%02d --DEVELOPMENT BUILD--",
rascsi_major_version,
rascsi_minor_version);
}
else
{
snprintf(rascsi_version_string, sizeof(rascsi_version_string), "%02d.%02d.%d",
rascsi_major_version,
rascsi_minor_version,
rascsi_patch_version);
}
return rascsi_version_string;
}

View File

@ -0,0 +1,21 @@
//---------------------------------------------------------------------------
//
// SCSI Target Emulator RaSCSI (*^..^*)
// for Raspberry Pi
//
// Copyright (C) 2020 akuker
// [ Define the version string]
//
//---------------------------------------------------------------------------
#pragma once
extern const int rascsi_major_version; // Last two digits of year
extern const int rascsi_minor_version; // Month
extern const int rascsi_patch_version; // Patch number
//---------------------------------------------------------------------------
//
// Fetch the version string
//
//---------------------------------------------------------------------------
extern char* rascsi_get_version_string();

View File

@ -10,6 +10,7 @@
//---------------------------------------------------------------------------
#include "os.h"
#include "rascsi_version.h"
//---------------------------------------------------------------------------
//
@ -84,6 +85,10 @@ int main(int argc, char* argv[])
// Display help
if (argc < 2) {
fprintf(stderr, "SCSI Target Emulator RaSCSI Controller\n");
fprintf(stderr, "version %s (%s, %s)\n",
rascsi_get_version_string(),
__DATE__,
__TIME__);
fprintf(stderr,
"Usage: %s -i ID [-u UNIT] [-c CMD] [-t TYPE] [-f FILE]\n",
argv[0]);

View File

@ -14,6 +14,7 @@
#include "fileio.h"
#include "filepath.h"
#include "gpiobus.h"
#include "rascsi_version.h"
//---------------------------------------------------------------------------
//
@ -62,10 +63,10 @@ void KillHandler(int sig)
BOOL Banner(int argc, char* argv[])
{
printf("RaSCSI hard disk dump utility ");
printf("version %01d.%01d%01d\n",
(int)((VERSION >> 8) & 0xf),
(int)((VERSION >> 4) & 0xf),
(int)((VERSION ) & 0xf));
printf("version %s (%s, %s)\n",
rascsi_get_version_string(),
__DATE__,
__TIME__);
if (argc < 2 || strcmp(argv[1], "-h") == 0) {
printf("Usage: %s -i ID [-b BID] -f FILE [-r]\n", argv[0]);

View File

@ -23,6 +23,7 @@
#include "fileio.h"
#include "filepath.h"
#include "gpiobus.h"
#include "rascsi_version.h"
//---------------------------------------------------------------------------
//
@ -73,10 +74,10 @@ void KillHandler(int sig)
BOOL Banner(int argc, char* argv[])
{
printf("RaSCSI hard disk dump utility(SASI HDD) ");
printf("version %01d.%01d%01d\n",
(int)((VERSION >> 8) & 0xf),
(int)((VERSION >> 4) & 0xf),
(int)((VERSION ) & 0xf));
printf("version %s (%s, %s)\n",
rascsi_get_version_string(),
__DATE__,
__TIME__);
if (argc < 2 || strcmp(argv[1], "-h") == 0) {
printf("Usage: %s -i ID [-u UT] [-b BSIZE] -c COUNT -f FILE [-r]\n", argv[0]);

View File

@ -16,6 +16,7 @@
#include "devices/disk.h"
#include "log.h"
#include "gpiobus.h"
#include "rascsi_version.h"
#include "spdlog/spdlog.h"
#include <sys/time.h>
@ -55,11 +56,18 @@ static volatile BOOL active; // Processing flag
GPIOBUS *bus; // GPIO Bus
typedef struct data_capture{
DWORD data;
timeval timestamp;
QWORD timestamp;
} data_capture_t;
data_capture data_buffer[MAX_BUFF_SIZE];
int data_idx = 0;
DWORD data_idx = 0;
double ns_per_loop;
// We don't really need to support 256 character file names - this causes
// all kinds of compiler warnings when the log filename can be up to 256
// characters. _MAX_FNAME/2 is just an arbitrary value.
char log_file_name[_MAX_FNAME/2] = "log.vcd";
//---------------------------------------------------------------------------
//
@ -80,27 +88,25 @@ void KillHandler(int sig)
void Banner(int argc, char* argv[])
{
LOGINFO("SCSI Monitor Capture Tool - part of RaSCSI(*^..^*) ");
LOGINFO("version %01d.%01d%01d(%s, %s)",
(int)((VERSION >> 8) & 0xf),
(int)((VERSION >> 4) & 0xf),
(int)((VERSION ) & 0xf),
LOGINFO("version %s (%s, %s)\n",
rascsi_get_version_string(),
__DATE__,
__TIME__);
LOGINFO("Powered by XM6 TypeG Technology ");
LOGINFO("Copyright (C) 2016-2020 GIMONS");
LOGINFO("Copyright (C) 2020 akuker");
LOGINFO("Connect type : %s", CONNECT_DESC);
LOGINFO(" log.vcd - Value Change Dump file that can be opened with GTKWave");
LOGINFO(" %s - Value Change Dump file that can be opened with GTKWave", log_file_name);
if ((argc > 1 && strcmp(argv[1], "-h") == 0) ||
(argc > 1 && strcmp(argv[1], "--help") == 0)){
LOGINFO("Usage: %s ...", argv[0]);
LOGINFO("Usage: %s [log filename]...", argv[0]);
exit(0);
}
else
{
LOGINFO(" ");
LOGINFO("Current running & collecting data. Press CTRL-C to stop.")
LOGINFO("Now collecting data.... Press CTRL-C to stop.")
LOGINFO(" ");
}
}
@ -151,14 +157,14 @@ BYTE get_data_field(DWORD data)
{
DWORD data_out;
data_out =
((data >> (PIN_DT0 - 0)) & (1 << 0)) |
((data >> (PIN_DT1 - 1)) & (1 << 1)) |
((data >> (PIN_DT2 - 2)) & (1 << 2)) |
((data >> (PIN_DT3 - 3)) & (1 << 3)) |
((data >> (PIN_DT4 - 4)) & (1 << 4)) |
((data >> (PIN_DT5 - 5)) & (1 << 5)) |
((data >> (PIN_DT6 - 6)) & (1 << 6)) |
((data >> (PIN_DT7 - 7)) & (1 << 7));
((data >> (PIN_DT0 - 0)) & (1 << 7)) |
((data >> (PIN_DT1 - 1)) & (1 << 6)) |
((data >> (PIN_DT2 - 2)) & (1 << 5)) |
((data >> (PIN_DT3 - 3)) & (1 << 4)) |
((data >> (PIN_DT4 - 4)) & (1 << 3)) |
((data >> (PIN_DT5 - 5)) & (1 << 2)) |
((data >> (PIN_DT6 - 6)) & (1 << 1)) |
((data >> (PIN_DT7 - 7)) & (1 << 0));
return (BYTE)data_out;
}
@ -190,14 +196,14 @@ void vcd_output_if_changed_byte(FILE *fp, DWORD data, int pin, char symbol)
{
prev_value[pin] = new_value;
fprintf(fp, "b%d%d%d%d%d%d%d%d %c\n",
get_pin_value(data,PIN_DT0),
get_pin_value(data,PIN_DT1),
get_pin_value(data,PIN_DT2),
get_pin_value(data,PIN_DT3),
get_pin_value(data,PIN_DT4),
get_pin_value(data,PIN_DT5),
get_pin_value(data,PIN_DT7),
get_pin_value(data,PIN_DT6),
get_pin_value(data,PIN_DT7), symbol);
get_pin_value(data,PIN_DT5),
get_pin_value(data,PIN_DT4),
get_pin_value(data,PIN_DT3),
get_pin_value(data,PIN_DT2),
get_pin_value(data,PIN_DT1),
get_pin_value(data,PIN_DT0), symbol);
}
}
@ -207,13 +213,11 @@ void create_value_change_dump()
{
time_t rawtime;
struct tm * timeinfo;
int i = 0;
timeval time_diff;
DWORD i = 0;
char timestamp[256];
FILE *fp;
timeval start_time = data_buffer[0].timestamp;
LOGINFO("Creating Value Change Dump file (log.vcd)\n");
fp = fopen("log.vcd","w");
LOGINFO("Creating Value Change Dump file (%s)", log_file_name);
fp = fopen(log_file_name,"w");
// Get the current time
time (&rawtime);
@ -227,9 +231,9 @@ void create_value_change_dump()
fprintf(fp, " VCD generator tool version info text.\n");
fprintf(fp, "$end\n");
fprintf(fp, "$comment\n");
fprintf(fp, " Any comment text.\n");
fprintf(fp, " Tool build date:%s\n", __TIMESTAMP__);
fprintf(fp, "$end\n");
fprintf(fp, "$timescale 1 us $end\n");
fprintf(fp, "$timescale 1 ns $end\n");
fprintf(fp, "$scope module logic $end\n");
fprintf(fp, "$var wire 1 %c BSY $end\n", SYMBOL_PIN_BSY);
fprintf(fp, "$var wire 1 %c SEL $end\n", SYMBOL_PIN_SEL);
@ -261,8 +265,7 @@ void create_value_change_dump()
while(i < data_idx)
{
timersub(&(data_buffer[i].timestamp), &start_time, &time_diff);
fprintf(fp, "#%ld\n",((time_diff.tv_sec*1000000) + time_diff.tv_usec));
fprintf(fp, "#%llu\n",(QWORD)(data_buffer[i].timestamp*ns_per_loop));
vcd_output_if_changed_bool(fp, data_buffer[i].data, PIN_BSY, SYMBOL_PIN_BSY);
vcd_output_if_changed_bool(fp, data_buffer[i].data, PIN_SEL, SYMBOL_PIN_SEL);
vcd_output_if_changed_bool(fp, data_buffer[i].data, PIN_CD, SYMBOL_PIN_CD);
@ -289,7 +292,7 @@ void create_value_change_dump()
void Cleanup()
{
LOGINFO("Stoping data collection....\n");
LOGINFO("Stopping data collection....");
create_value_change_dump();
// Cleanup the Bus
@ -354,8 +357,34 @@ int main(int argc, char* argv[])
DWORD this_sample = 0;
int ret;
struct sched_param schparam;
timeval start_time, stop_time;
QWORD loop_count = 0;
timeval time_diff;
QWORD elapsed_us;
int str_len;
// If there is an argument specified and it is NOT -h or --help
if((argc > 1) && (strcmp(argv[1], "-h")) && (strcmp(argv[1], "--help"))){
str_len = strlen(argv[1]);
if ((str_len >= 1) && (str_len < _MAX_FNAME))
{
strncpy(log_file_name, argv[1], sizeof(log_file_name));
// Append .vcd if its not already there
if((str_len < 4) || strcasecmp(log_file_name + (str_len - 4), ".vcd")) {
strcat(log_file_name, ".vcd");
}
}
else
{
printf("Invalid log name specified. Using log.vcd");
}
}
#ifdef DEBUG
spdlog::set_level(spdlog::level::trace);
#else
spdlog::set_level(spdlog::level::info);
#endif
spdlog::set_pattern("%^[%l]%$ %v");
// Output the Banner
Banner(argc, argv);
@ -382,11 +411,24 @@ int main(int argc, char* argv[])
running = TRUE;
bus->SetACT(FALSE);
(void)gettimeofday(&start_time, NULL);
LOGDEBUG("ALL_SCSI_PINS %08X\n",ALL_SCSI_PINS);
// Main Loop
while (running) {
// Work initialization
this_sample = (bus->Aquire() & ALL_SCSI_PINS);
loop_count++;
if(loop_count > LLONG_MAX -1)
{
LOGINFO("Maximum amount of time has elapsed. SCSIMON is terminating.");
running=false;
}
if(data_idx >= (MAX_BUFF_SIZE-2))
{
LOGINFO("Internal data buffer is full. SCSIMON is terminating.");
running=false;
}
if(this_sample != prev_sample)
{
@ -402,16 +444,39 @@ int main(int argc, char* argv[])
}
prev_high = high_bits;
prev_low = low_bits;
if((data_idx % 1000) == 0){
LOGDEBUG("Collected %lu samples...", data_idx);
}
#endif
data_buffer[data_idx].data = this_sample;
(void)gettimeofday(&(data_buffer[data_idx].timestamp), NULL);
data_idx = (data_idx + 1) % MAX_BUFF_SIZE;
data_buffer[data_idx].timestamp = loop_count;
data_idx++;
prev_sample = this_sample;
}
continue;
}
// Collect one last sample, otherwise it looks like the end of the data was cut off
if(data_idx < MAX_BUFF_SIZE)
{
data_buffer[data_idx].data = this_sample;
data_buffer[data_idx].timestamp = loop_count;
data_idx++;
}
(void)gettimeofday(&stop_time, NULL);
timersub(&stop_time, &start_time, &time_diff);
elapsed_us = ((time_diff.tv_sec*1000000) + time_diff.tv_usec);
LOGINFO("Elapsed time: %llu microseconds (%lf seconds)",elapsed_us, ((double)elapsed_us)/1000000);
LOGINFO("Collected %lu changes", data_idx);
// Note: ns_per_loop is a global variable that is used by Cleanup() to printout the timestamps.
ns_per_loop = (elapsed_us * 1000) / (double)loop_count;
LOGINFO("Read the SCSI bus %llu times with an average of %lu ns for each read", loop_count, (DWORD)ns_per_loop);
// Cleanup
Cleanup();

View File

@ -13,19 +13,12 @@
#if !defined(xm6_h)
#define xm6_h
//---------------------------------------------------------------------------
//
// VERSION
//
//---------------------------------------------------------------------------
#define VERSION 0x0147
//---------------------------------------------------------------------------
//
// RaSCSI
//
//---------------------------------------------------------------------------
#define RASCSI VERSION
#define RASCSI 1
//---------------------------------------------------------------------------
//

View File

@ -27,7 +27,7 @@ Apple Hard Drive reports the correct device information
Then Rasctl reports SCSI ID 0 of type HD
And SCSI ID 0 is detected by Linux
And SCSI ID 0 reports vendor ${SPACE}SEAGATE
And SCSI ID 0 reports revision 0147
And SCSI ID 0 reports revision 0200
And SCSI ID 0 reports model ${SPACE*10}ST225N
And SCSI ID 0 reports type ${Scsi_device_type_hard_drive}
@ -40,7 +40,7 @@ XM6 Hard Drive reports the correct device information
Then Rasctl reports SCSI ID 1 of type HD
And SCSI ID 1 is detected by Linux
And SCSI ID 1 reports vendor RaSCSI${SPACE*2}
And SCSI ID 1 reports revision 0147
And SCSI ID 1 reports revision 0200
And SCSI ID 1 reports model PRODRIVE LPS10S${SPACE}
And SCSI ID 1 reports type ${Scsi_device_type_hard_drive}
@ -53,7 +53,7 @@ NEC Hard Drive reports the correct device information
Then Rasctl reports SCSI ID 2 of type HD
And SCSI ID 2 is detected by Linux
And SCSI ID 2 reports vendor NECCSI${SPACE*2}
And SCSI ID 2 reports revision 0147
And SCSI ID 2 reports revision 0200
And SCSI ID 2 reports model PRODRIVE LPS10S${SPACE}
And SCSI ID 2 reports type ${Scsi_device_type_hard_drive}
@ -66,7 +66,7 @@ Anex86 Hard Drive reports the correct device information
Then Rasctl reports SCSI ID 3 of type HD
And SCSI ID 3 is detected by Linux
And SCSI ID 3 reports vendor RaSCSI${SPACE*2}
And SCSI ID 3 reports revision 0147
And SCSI ID 3 reports revision 0200
And SCSI ID 3 reports model CD-ROM CDU-55S${SPACE*2}
And SCSI ID 3 reports type ${Scsi_device_type_hard_drive}
@ -77,7 +77,7 @@ CD-ROM drive reports the correct device information
Then Rasctl reports SCSI ID 4 of type CD
And SCSI ID 4 is detected by Linux
And SCSI ID 4 reports vendor RaSCSI${SPACE*2}
And SCSI ID 4 reports revision 0147
And SCSI ID 4 reports revision 0200
And SCSI ID 4 reports model CD-ROM CDU-55S${SPACE*2}
And SCSI ID 4 reports type ${Scsi_device_type_cd_rom}
@ -89,6 +89,6 @@ Magneto Optical drive reports the correct device information
Then Rasctl reports SCSI ID 5 of type MO
And SCSI ID 5 is detected by Linux
And SCSI ID 5 reports vendor RaSCSI${SPACE*2}
And SCSI ID 5 reports revision 0147
And SCSI ID 5 reports revision 0200
And SCSI ID 5 reports model M2513A${SPACE*10}
And SCSI ID 5 reports type ${Scsi_device_type_optical_memory}