mirror of
https://github.com/fhgwright/SCSI2SD.git
synced 2025-04-10 01:37:07 +00:00
Minor config fixes for 5.1 support.
This commit is contained in:
parent
258da24a7a
commit
0af7e36966
@ -1,4 +1,4 @@
|
||||
2018XXXX 4.8
|
||||
20180416 4.8
|
||||
- Fix Unit Serial Number inquiry page to use return configured serial number
|
||||
- Apple mode pages now only sent when in Apple mode.
|
||||
- Added quirks selection to scsi2sd-util. Apple users should manually fix
|
||||
|
@ -79,6 +79,7 @@ static void initBoardConfig(BoardConfig* config) {
|
||||
config->flags = getConfigByIndex(0)->flagsDEPRECATED;
|
||||
|
||||
config->selectionDelay = 255; // auto
|
||||
config->flags6 = S2S_CFG_ENABLE_TERMINATOR;
|
||||
}
|
||||
}
|
||||
|
||||
@ -146,7 +147,7 @@ writeFlashCommand(const uint8_t* cmd, size_t cmdSize)
|
||||
if ((flashArray != SCSI_CONFIG_ARRAY) ||
|
||||
(flashRow < SCSI_CONFIG_4_ROW) ||
|
||||
(flashRow >= SCSI_CONFIG_3_ROW + SCSI_CONFIG_ROWS))
|
||||
{
|
||||
{
|
||||
uint8_t response[] = { CONFIG_STATUS_ERR };
|
||||
hidPacket_send(response, sizeof(response));
|
||||
}
|
||||
|
@ -41,6 +41,8 @@ int main()
|
||||
configInit(&scsiDev.boardCfg);
|
||||
debugInit();
|
||||
|
||||
scsiPhyConfig();
|
||||
|
||||
scsiInit();
|
||||
scsiDiskInit();
|
||||
|
||||
|
@ -509,7 +509,10 @@ void scsiPhyInit()
|
||||
SCSI_RST_ISR_StartEx(scsiResetISR);
|
||||
|
||||
SCSI_SEL_ISR_StartEx(scsiSelectionISR);
|
||||
}
|
||||
|
||||
void scsiPhyConfig()
|
||||
{
|
||||
// Disable the glitch filter for ACK to improve performance.
|
||||
if (scsiDev.boardCfg.flags & CONFIG_DISABLE_GLITCH)
|
||||
{
|
||||
@ -518,7 +521,7 @@ void scsiPhyInit()
|
||||
// Reduce deskew time to 1. (deskew init + 0)
|
||||
CY_SET_REG8(scsiTarget_datapath__D0_REG, 0);
|
||||
}
|
||||
if ((scsiDev.target->cfg->quirks == CONFIG_QUIRKS_XEBEC) ||
|
||||
if ((scsiDev.target->cfg->quirks & CONFIG_QUIRKS_XEBEC) ||
|
||||
(scsiDev.boardCfg.scsiSpeed == CONFIG_SPEED_ASYNC_15))
|
||||
{
|
||||
// 125ns to 250ns deskew time = 3.125 clocks
|
||||
|
@ -50,7 +50,7 @@ typedef enum
|
||||
CyPins_SetPin((pin));
|
||||
|
||||
#define SCSI_ClearPin(pin) \
|
||||
CyPins_ClearPin((pin));
|
||||
CyPins_ClearPin((pin));
|
||||
#endif
|
||||
|
||||
// Active low: we interpret a 0 as "true", and non-zero as "false"
|
||||
@ -83,6 +83,7 @@ extern volatile uint8_t scsiTxDMAComplete;
|
||||
|
||||
void scsiPhyReset(void);
|
||||
void scsiPhyInit(void);
|
||||
void scsiPhyConfig(void);
|
||||
|
||||
uint8_t scsiReadByte(void);
|
||||
void scsiRead(uint8_t* data, uint32_t count);
|
||||
|
@ -57,6 +57,7 @@ ifeq ($(TARGET),Win32)
|
||||
LIBZIPPER_CONFIG+=--host=i686-w64-mingw32
|
||||
EXE=.exe
|
||||
WX_CONFIG+=--host=i686-w64-mingw32
|
||||
TARGETOBJ = $(BUILD)/gnulib_ffs.o
|
||||
endif
|
||||
ifeq ($(TARGET),Win64)
|
||||
VPATH += hidapi-windows
|
||||
@ -67,6 +68,7 @@ ifeq ($(TARGET),Win64)
|
||||
LIBZIPPER_CONFIG+=--host=x86_64-w64-mingw32
|
||||
EXE=.exe
|
||||
WX_CONFIG+=--host=x86_64-w64-mingw32
|
||||
TARGETOBJ = $(BUILD)/gnulib_ffs.o
|
||||
endif
|
||||
ifeq ($(TARGET),Linux)
|
||||
VPATH += hidapi/linux
|
||||
@ -114,6 +116,7 @@ CONSOLEOBJ = \
|
||||
$(BUILD)/SCSI2SD_Bootloader.o \
|
||||
$(BUILD)/SCSI2SD_HID.o \
|
||||
$(BUILD)/hidpacket.o \
|
||||
$(TARGETOBJ)
|
||||
|
||||
OBJ = \
|
||||
${CONSOLEOBJ} \
|
||||
|
@ -32,6 +32,9 @@
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <strings.h> // for ffs
|
||||
#ifdef __MINGW32__
|
||||
extern "C" int ffs(int);
|
||||
#endif
|
||||
|
||||
using namespace SCSI2SD;
|
||||
|
||||
|
56
software/scsi2sd-util/gnulib_ffs.c
Normal file
56
software/scsi2sd-util/gnulib_ffs.c
Normal file
@ -0,0 +1,56 @@
|
||||
/* ffs.c -- find the first set bit in a word.
|
||||
Copyright (C) 2011-2018 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Eric Blake. */
|
||||
|
||||
// michael@codesrc.com #include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include <strings.h>
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
int
|
||||
ffs (int i)
|
||||
{
|
||||
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
|
||||
return __builtin_ffs (i);
|
||||
#else
|
||||
/* <https://github.com/gibsjose/BitHacks>
|
||||
gives this deBruijn constant for a branch-less computation, although
|
||||
that table counted trailing zeros rather than bit position. This
|
||||
requires 32-bit int, we fall back to a naive algorithm on the rare
|
||||
platforms where that assumption is not true. */
|
||||
if (CHAR_BIT * sizeof i == 32)
|
||||
{
|
||||
static unsigned int table[] = {
|
||||
1, 2, 29, 3, 30, 15, 25, 4, 31, 23, 21, 16, 26, 18, 5, 9,
|
||||
32, 28, 14, 24, 22, 20, 17, 8, 27, 13, 19, 7, 12, 6, 11, 10
|
||||
};
|
||||
unsigned int u = i;
|
||||
unsigned int bit = u & -u;
|
||||
return table[(bit * 0x077cb531U) >> 27] - !i;
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned int j;
|
||||
for (j = 0; j < CHAR_BIT * sizeof i; j++)
|
||||
if (i & (1U << j))
|
||||
return j + 1;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}
|
@ -177,6 +177,18 @@ public:
|
||||
ID_ConfigDefaults,
|
||||
_("Load &Defaults"),
|
||||
_("Load default configuration options."));
|
||||
|
||||
menuFile->AppendSeparator();
|
||||
myLoadButton = menuFile->Append(
|
||||
ID_BtnLoad,
|
||||
_("Load from device"),
|
||||
_("Load configuration from hardware device"));
|
||||
mySaveButton = menuFile->Append(
|
||||
ID_BtnSave,
|
||||
_("Save to device"),
|
||||
_("Save configuration to hardware device"));
|
||||
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->Append(
|
||||
ID_Firmware,
|
||||
_("&Upgrade Firmware..."),
|
||||
@ -241,23 +253,13 @@ public:
|
||||
tabs->Fit();
|
||||
fgs->Add(tabs);
|
||||
|
||||
|
||||
wxPanel* btnPanel = new wxPanel(cfgPanel);
|
||||
wxFlexGridSizer *btnFgs = new wxFlexGridSizer(1, 2, 5, 5);
|
||||
btnPanel->SetSizer(btnFgs);
|
||||
myLoadButton =
|
||||
new wxButton(btnPanel, ID_BtnLoad, _("Load from device"));
|
||||
btnFgs->Add(myLoadButton);
|
||||
mySaveButton =
|
||||
new wxButton(btnPanel, ID_BtnSave, _("Save to device"));
|
||||
btnFgs->Add(mySaveButton);
|
||||
fgs->Add(btnPanel);
|
||||
|
||||
btnPanel->Fit();
|
||||
cfgPanel->Fit();
|
||||
}
|
||||
//Fit(); // Needed to reduce window size on Windows
|
||||
#ifdef __WINDOWS__
|
||||
Fit(); // Needed to reduce window size on Windows
|
||||
#else
|
||||
FitInside(); // Needed on Linux to prevent status bar overlap
|
||||
#endif
|
||||
|
||||
myLogWindow = new wxLogWindow(this, _("scsi2sd-util debug log"), true);
|
||||
myLogWindow->PassMessages(false); // Prevent messagebox popups
|
||||
@ -270,8 +272,8 @@ private:
|
||||
wxLogWindow* myLogWindow;
|
||||
BoardPanel* myBoardPanel;
|
||||
std::vector<TargetPanel*> myTargets;
|
||||
wxButton* myLoadButton;
|
||||
wxButton* mySaveButton;
|
||||
wxMenuItem* myLoadButton;
|
||||
wxMenuItem* mySaveButton;
|
||||
wxMenuItem* mySCSILogChk;
|
||||
wxMenuItem* mySelfTestChk;
|
||||
wxTimer* myTimer;
|
||||
@ -1211,7 +1213,7 @@ private:
|
||||
{
|
||||
wxMessageBox(
|
||||
"SCSI2SD (scsi2sd-util)\n"
|
||||
"Copyright (C) 2014 Michael McMaster <michael@codesrc.com>\n"
|
||||
"Copyright (C) 2014-2018 Michael McMaster <michael@codesrc.com>\n"
|
||||
"\n"
|
||||
"This program is free software: you can redistribute it and/or modify\n"
|
||||
"it under the terms of the GNU General Public License as published by\n"
|
||||
@ -1246,8 +1248,8 @@ wxBEGIN_EVENT_TABLE(AppFrame, wxFrame)
|
||||
|
||||
EVT_COMMAND(wxID_ANY, ConfigChangedEvent, AppFrame::onConfigChanged)
|
||||
|
||||
EVT_BUTTON(ID_BtnSave, AppFrame::doSave)
|
||||
EVT_BUTTON(ID_BtnLoad, AppFrame::doLoad)
|
||||
EVT_MENU(ID_BtnSave, AppFrame::doSave)
|
||||
EVT_MENU(ID_BtnLoad, AppFrame::doLoad)
|
||||
|
||||
EVT_CLOSE(AppFrame::OnCloseEvt)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user