-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
config->flags = getConfigByIndex(0)->flagsDEPRECATED;\r
\r
config->selectionDelay = 255; // auto\r
+ config->flags6 = S2S_CFG_ENABLE_TERMINATOR;\r
}\r
}\r
\r
if ((flashArray != SCSI_CONFIG_ARRAY) ||\r
(flashRow < SCSI_CONFIG_4_ROW) ||\r
(flashRow >= SCSI_CONFIG_3_ROW + SCSI_CONFIG_ROWS))\r
- {\r
+ {\r
uint8_t response[] = { CONFIG_STATUS_ERR };\r
hidPacket_send(response, sizeof(response));\r
}\r
configInit(&scsiDev.boardCfg);\r
debugInit();\r
\r
+ scsiPhyConfig();\r
+\r
scsiInit();\r
scsiDiskInit();\r
\r
SCSI_RST_ISR_StartEx(scsiResetISR);\r
\r
SCSI_SEL_ISR_StartEx(scsiSelectionISR);\r
+}\r
\r
+void scsiPhyConfig()\r
+{\r
// Disable the glitch filter for ACK to improve performance.\r
if (scsiDev.boardCfg.flags & CONFIG_DISABLE_GLITCH)\r
{\r
// Reduce deskew time to 1. (deskew init + 0)\r
CY_SET_REG8(scsiTarget_datapath__D0_REG, 0);\r
}\r
- if ((scsiDev.target->cfg->quirks == CONFIG_QUIRKS_XEBEC) ||\r
+ if ((scsiDev.target->cfg->quirks & CONFIG_QUIRKS_XEBEC) ||\r
(scsiDev.boardCfg.scsiSpeed == CONFIG_SPEED_ASYNC_15))\r
{\r
// 125ns to 250ns deskew time = 3.125 clocks\r
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"
void scsiPhyReset(void);
void scsiPhyInit(void);
+void scsiPhyConfig(void);
uint8_t scsiReadByte(void);
void scsiRead(uint8_t* data, uint32_t count);
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
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
$(BUILD)/SCSI2SD_Bootloader.o \
$(BUILD)/SCSI2SD_HID.o \
$(BUILD)/hidpacket.o \
+ $(TARGETOBJ)
OBJ = \
${CONSOLEOBJ} \
#include <math.h>
#include <string.h>
#include <strings.h> // for ffs
+#ifdef __MINGW32__
+extern "C" int ffs(int);
+#endif
using namespace SCSI2SD;
--- /dev/null
+/* 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
+}
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..."),
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
wxLogWindow* myLogWindow;
BoardPanel* myBoardPanel;
std::vector<TargetPanel*> myTargets;
- wxButton* myLoadButton;
- wxButton* mySaveButton;
+ wxMenuItem* myLoadButton;
+ wxMenuItem* mySaveButton;
wxMenuItem* mySCSILogChk;
wxMenuItem* mySelfTestChk;
wxTimer* myTimer;
{
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"
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)