This commit is contained in:
Tony Kuker
2020-07-30 14:23:35 -05:00
67 changed files with 69016 additions and 226 deletions

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

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

View File

@@ -1,7 +1,23 @@
.DEFAULT_GOAL: all
CC = gcc
CFLAGS = -DNDEBUG -O3 -Wall
CXX = g++
CXXFLAGS = -DNDEBUG -O3 -Wall
DEBUG ?= 0
ifeq ($(DEBUG), 1)
# Debug CFLAGS
CFLAGS = -DDISK_LOG -O0 -g -Wall -DDEBUG
CXXFLAGS = -DDISK_LOG -O0 -g -Wall -DDEBUG
BUILD_TYPE = Debug
else
# Release CFLAGS
CFLAGS ?= -O3 -Wall -Werror
CXXFLAGS ?= -O3 -Wall -Werror
BUILD_TYPE = Release
endif
# If its not specified, build for STANDARD configuration
CONNECT_TYPE ?= STANDARD
ifdef CONNECT_TYPE
CFLAGS += -DCONNECT_TYPE_$(CONNECT_TYPE)
@@ -12,8 +28,17 @@ RASCSI = rascsi
RASCTL = rasctl
RASDUMP = rasdump
SASIDUMP = sasidump
SCSIMON = scsimon
USR_LOCAL_BIN = /usr/local/bin
MAN_PAGE_DIR = /usr/share/man/man1
DOC_DIR = ../../doc
#BIN_ALL = $(RASCSI) $(RASCTL) $(RASDUMP) $(SASIDUMP) $(SCSIMON)
# Temporarily remove the RASDUMP and RASDUMP tools, since they're not needed
# for my specific use case. If you need them - add them back in!
BIN_ALL = $(RASCSI) $(RASCTL)
BIN_ALL = $(RASCSI) $(RASCTL) $(RASDUMP) $(SASIDUMP)
SRC_RASCSI = \
rascsi.cpp \
@@ -46,12 +71,21 @@ OBJ_RASCSI := $(SRC_RASCSI:%.cpp=%.o)
OBJ_RASCTL := $(SRC_RASCTL:%.cpp=%.o)
OBJ_RASDUMP := $(SRC_RASDUMP:%.cpp=%.o)
OBJ_SASIDUMP := $(SRC_SASIDUMP:%.cpp=%.o)
OBJ_SCSIMON := $(SRC_SCSIMON:%.cpp=%.o)
#OBJ_ALL := $(OBJ_RASCSI) $(OBJ_RASCTL) $(OBJ_RASDUMP) $(OBJ_SASIDUMP) $(OBJ_SCSIMON)
OBJ_ALL := $(OBJ_RASCSI) $(OBJ_RASCTL) $(OBJ_RASDUMP) $(OBJ_SASIDUMP)
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
ALL: $(BIN_ALL)
.DEFAULT_GOAL := all
.PHONY: all ALL docs
all: $(BIN_ALL) docs
ALL: all
docs: $(DOC_DIR)/rascsi_man_page.txt $(DOC_DIR)/rasctl_man_page.txt
$(RASCSI): $(OBJ_RASCSI)
$(CXX) -o $@ $(OBJ_RASCSI) -lpthread
@@ -65,5 +99,26 @@ $(RASDUMP): $(OBJ_RASDUMP)
$(SASIDUMP): $(OBJ_SASIDUMP)
$(CXX) -o $@ $(OBJ_SASIDUMP)
$(SCSIMON): $(OBJ_SCSIMON)
$(CXX) $(CXXFLAGS) -o $@ $(OBJ_SCSIMON) -lpthread
clean:
rm -f $(OBJ_ALL) $(BIN_ALL)
run:
sudo ./$(RASCSI) -ID1 /home/pi/HARDDISK2.hda -ID6 /home/pi/marathon.iso
install: $(MAN_PAGE_DIR)/rascsi.1 $(MAN_PAGE_DIR)/rasctl.1
sudo cp $(RASCTL) $(USR_LOCAL_BIN)
sudo cp $(RASCSI) $(USR_LOCAL_BIN)
$(MAN_PAGE_DIR)/%.1 : $(DOC_DIR)/%.1
sudo cp $< $@
$(DOC_DIR)/%_man_page.txt : $(DOC_DIR)/%.1
@echo "!! ------ THIS FILE IS AUTO_GENERATED! DO NOT MANUALLY UPDATE!!!" > $@
@echo "!! ------ The native file is $(notdir $<). Re-run 'make docs' after updating\n\n" >> $@
man -l $< | col -bx >> $@
.PHONY: Debug
Debug: all

View File

@@ -1894,7 +1894,7 @@ void CHostPath::Refresh()
if (stat(S2U(szPath), &sb))
#else
if (f_stat(S2U(szPath), NULL) != FR_OK)
#endif // BAREMETAL
#endif // BAREMETAL
break; // 利用可能パターンを発見
}
}
@@ -1957,7 +1957,7 @@ void CHostPath::Refresh()
// 日付時刻
pFilename->SetEntryDate(fno.fdate);
pFilename->SetEntryTime(fno.ftime);
#endif // BAREMETAL
#endif // BAREMETAL
// クラスタ番号設定
pFilename->SetEntryCluster(0);
@@ -2045,7 +2045,7 @@ void CHostPath::Backup()
m_tBackupT = fno.ftime;
}
}
#endif // BAREMETAL
#endif // BAREMETAL
}
//---------------------------------------------------------------------------
@@ -2613,9 +2613,8 @@ void CHostFiles::AddFilename()
{
ASSERT(this);
ASSERT(strlen(m_szHostResult) + strlen((const char*)m_szHumanFilename) < FILEPATH_MAX);
/// @warning Unicode未対応。いずれUnicodeの世界に飮まれた時はここで変換を行なう → 済
strcat(m_szHostResult, (const char*)m_szHumanFilename);
strncat(m_szHostResult, (const char*)m_szHumanFilename, ARRAY_SIZE(m_szHumanFilename));
}
//===========================================================================
@@ -2896,7 +2895,7 @@ BOOL CHostFcb::Open()
{
#ifndef BAREMETAL
struct stat st;
ASSERT(this);
ASSERT(strlen(m_szFilename) > 0);

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -101,14 +101,14 @@ char* dirname(char *path)
dirtmp[1] = '\0';
return dirtmp;
}
p = path + strlen(path) - 1;
while( *p == '/' ) {
if( p == path )
return path;
*p-- = '\0';
}
while( p >= path && *p != '/' ) {
p--;
}
@@ -143,7 +143,7 @@ char* basename(char *path)
basetmp[1] = '\0';
return basetmp;
}
p = path + strlen(path) - 1;
while( *p == '/' ) {
if( p == path ) {
@@ -151,11 +151,11 @@ char* basename(char *path)
}
*p-- = '\0';
}
while( p >= path && *p != '/' ) {
p--;
}
return p + 1;
}
#endif // BAREMETAL
@@ -219,9 +219,9 @@ void FASTCALL Filepath::Make()
m_szPath[0] = _T('\0');
// 合成
strcat(m_szPath, m_szDir);
strcat(m_szPath, m_szFile);
strcat(m_szPath, m_szExt);
strncat(m_szPath, m_szDir, ARRAY_SIZE(m_szPath) - strlen(m_szPath));
strncat(m_szPath, m_szFile, ARRAY_SIZE(m_szPath) - strlen(m_szPath));
strncat(m_szPath, m_szExt, ARRAY_SIZE(m_szPath) - strlen(m_szPath));
}
//---------------------------------------------------------------------------
@@ -343,4 +343,4 @@ char Filepath::ShortName[_MAX_FNAME + _MAX_DIR];
// ファイル名+拡張子
//
//---------------------------------------------------------------------------
TCHAR Filepath::FileExt[_MAX_FNAME + _MAX_DIR];
TCHAR Filepath::FileExt[_MAX_FNAME + _MAX_DIR];

View File

@@ -169,6 +169,7 @@ BOOL FASTCALL GPIOBUS::Init(mode_e mode)
// Open /dev/mem
fd = open("/dev/mem", O_RDWR | O_SYNC);
if (fd == -1) {
printf("Error: Unable to open /dev/mem. Are you running as root?\n");
return FALSE;
}
@@ -274,6 +275,7 @@ BOOL FASTCALL GPIOBUS::Init(mode_e mode)
PinConfig(PIN_DTD, GPIO_OUTPUT);
// Set the ENABLE signal
// This is used to show that the application is running
PinSetSignal(PIN_ENB, ENB_OFF);
PinConfig(PIN_ENB, GPIO_OUTPUT);
@@ -373,6 +375,7 @@ BOOL FASTCALL GPIOBUS::Init(mode_e mode)
MakeTable();
// Finally, enable ENABLE
// Show the user that this app is running
SetControl(PIN_ENB, ENB_ON);
return TRUE;

View File

@@ -114,6 +114,8 @@
#endif // NDEBUG
#endif // ASSERT_DIAG
#define ARRAY_SIZE(x) (sizeof(x)/(sizeof(x[0])))
//---------------------------------------------------------------------------
//
// 基本型定義

View File

@@ -78,7 +78,8 @@ void Banner(int argc, char* argv[])
FPRT(stdout,"Copyright (C) 2016-2020 GIMONS\n");
FPRT(stdout,"Connect type : %s\n", CONNECT_DESC);
if (argc > 1 && strcmp(argv[1], "-h") == 0) {
if ((argc > 1 && strcmp(argv[1], "-h") == 0) ||
(argc > 1 && strcmp(argv[1], "--help") == 0)){
FPRT(stdout,"\n");
FPRT(stdout,"Usage: %s [-IDn FILE] ...\n\n", argv[0]);
FPRT(stdout," n is SCSI identification number(0-7).\n");
@@ -153,7 +154,7 @@ BOOL Init()
// GPIOBUS creation
bus = new GPIOBUS();
// GPIO Initialization
if (!bus->Init()) {
return FALSE;
@@ -206,7 +207,7 @@ void Cleanup()
// Cleanup the Bus
bus->Cleanup();
// Discard the GPIOBUS object
delete bus;
@@ -306,7 +307,7 @@ void ListDevice(FILE *fp)
FPRT(fp, "No device is installed.\n");
return;
}
FPRT(fp, "+----+----+------+-------------------------------------\n");
}
@@ -580,7 +581,7 @@ BOOL ProcessCmd(FILE *fp, int id, int un, int cmd, int type, char *file)
filepath.SetPath(file);
// Open the file
if (pUnit->Open(filepath)) {
if (!pUnit->Open(filepath)) {
FPRT(fp, "Error : File open error [%s]\n", file);
return FALSE;
}
@@ -862,7 +863,7 @@ static void *MonThread(void *param)
{
struct sched_param schedparam;
struct sockaddr_in client;
socklen_t len;
socklen_t len;
int fd;
FILE *fp;
char buf[BUFSIZ];
@@ -892,8 +893,8 @@ static void *MonThread(void *param)
while (1) {
// Wait for connection
memset(&client, 0, sizeof(client));
len = sizeof(client);
memset(&client, 0, sizeof(client));
len = sizeof(client);
fd = accept(monsocket, (struct sockaddr*)&client, &len);
if (fd < 0) {
break;