+20160716 6.03 (BETA3)
+ - SCSI bug fixes.
+
20160616 6.01
- Improved SD card compatibility
- Fixed SCSI interfaces on slower SCSI controllers
SRC = \
src/firmware/bootloader.c \
+ src/firmware/cdrom.c \
src/firmware/config.c \
src/firmware/disk.c \
src/firmware/diagnostic.c \
src/firmware/inquiry.c \
src/firmware/led.c \
src/firmware/main.c \
+ src/firmware/mo.c \
src/firmware/mode.c \
src/firmware/scsiPhy.c \
src/firmware/scsi.c \
src/firmware/sd.c \
+ src/firmware/tape.c \
src/firmware/time.c \
src/firmware/trace.c \
${USBCOMPOSITE_SRC}
hsram1.Init.AsynchronousWait = FSMC_ASYNCHRONOUS_WAIT_DISABLE;
hsram1.Init.WriteBurst = FSMC_WRITE_BURST_DISABLE;
/* Timing */
+
/*
Timing.AddressSetupTime = 3;
Timing.AddressHoldTime = 2;
Timing.DataSetupTime = 5;
*/
+
Timing.AddressSetupTime = 2;
Timing.AddressHoldTime = 1;
Timing.DataSetupTime = 4;
MX_SDIO_SD_Init();
MX_SPI1_Init();
MX_TIM4_Init();
- MX_USART3_UART_Init();
- MX_USB_HOST_Init();
+ // TODO re-enable MX_USART3_UART_Init();
+ // TODO re-enable MX_USB_HOST_Init();
/* USER CODE BEGIN 2 */
mainInit();
while (1)
{
/* USER CODE END WHILE */
- MX_USB_HOST_Process();
+ // TODO re-enable MX_USB_HOST_Process();
/* USER CODE BEGIN 3 */
mainLoop();
//
// You should have received a copy of the GNU General Public License
// along with SCSI2SD. If not, see <http://www.gnu.org/licenses/>.
-#pragma GCC push_options
-#pragma GCC optimize("-flto")
-#include "device.h"
#include "scsi.h"
#include "config.h"
#include "cdrom.h"
+#include <string.h>
+
static const uint8_t SimpleTOC[] =
{
0x00, // toc length, MSB
{
int commandHandled = 1;
- uint8 command = scsiDev.cdb[0];
+ uint8_t command = scsiDev.cdb[0];
if (command == 0x43)
{
// CD-ROM Read TOC
return commandHandled;
}
-#pragma GCC pop_options
// along with SCSI2SD. If not, see <http://www.gnu.org/licenses/>.\r
\r
#include "config.h"\r
-#include "debug.h"\r
#include "led.h"\r
\r
#include "scsi.h"\r
\r
#include <string.h>\r
\r
-static const uint16_t FIRMWARE_VERSION = 0x0601;\r
+static const uint16_t FIRMWARE_VERSION = 0x0603;\r
\r
// 1 flash row\r
static const uint8_t DEFAULT_CONFIG[128] =\r
response[15] = scsiDev.lastSense;\r
response[16] = scsiDev.phase;\r
response[17] = scsiStatusBSY();\r
- response[18] = *SCSI_STS_SELECTED;\r
+ response[18] = scsiStatusSEL();\r
response[19] = scsiStatusATN();\r
response[20] = scsiStatusRST();\r
response[21] = scsiDev.rstCount;\r
response[28] = scsiDev.lastSenseASC;\r
response[29] = *SCSI_STS_DBX;\r
response[30] = LastTrace;\r
+ response[31] = scsiStatusACK();\r
hidPacket_send(response, sizeof(response));\r
}\r
\r
\r
}\r
\r
-void debugPoll()\r
-{\r
-#if 0\r
- if (!usbReady)\r
- {\r
- return;\r
- }\r
-\r
- if(USBFS_GetEPState(USB_EP_COMMAND) == USBFS_OUT_BUFFER_FULL)\r
- {\r
- // The host sent us some data!\r
- int byteCount = USBFS_GetEPCount(USB_EP_COMMAND);\r
- USBFS_ReadOutEP(USB_EP_COMMAND, (uint8 *)&hidBuffer, byteCount);\r
-\r
- if (byteCount >= 1 &&\r
- hidBuffer[0] == 0x01)\r
- {\r
- // Reboot command.\r
- Bootloadable_1_Load();\r
- }\r
-\r
- // Allow the host to send us another command.\r
- // (assuming we didn't reboot outselves)\r
- USBFS_EnableOutEP(USB_EP_COMMAND);\r
- }\r
-\r
- switch (usbDebugEpState)\r
- {\r
- case USB_IDLE:\r
- memcpy(&hidBuffer, &scsiDev.cdb, 12);\r
- hidBuffer[12] = scsiDev.msgIn;\r
- hidBuffer[13] = scsiDev.msgOut;\r
- hidBuffer[14] = scsiDev.lastStatus;\r
- hidBuffer[15] = scsiDev.lastSense;\r
- hidBuffer[16] = scsiDev.phase;\r
- hidBuffer[17] = SCSI_ReadFilt(SCSI_Filt_BSY);\r
- hidBuffer[18] = SCSI_ReadFilt(SCSI_Filt_SEL);\r
- hidBuffer[19] = SCSI_ReadFilt(SCSI_Filt_ATN);\r
- hidBuffer[20] = SCSI_ReadFilt(SCSI_Filt_RST);\r
- hidBuffer[21] = scsiDev.rstCount;\r
- hidBuffer[22] = scsiDev.selCount;\r
- hidBuffer[23] = scsiDev.msgCount;\r
- hidBuffer[24] = scsiDev.cmdCount;\r
- hidBuffer[25] = scsiDev.watchdogTick;\r
- hidBuffer[26] = blockDev.state;\r
- hidBuffer[27] = scsiDev.lastSenseASC >> 8;\r
- hidBuffer[28] = scsiDev.lastSenseASC;\r
- hidBuffer[29] = scsiReadDBxPins();\r
- hidBuffer[30] = LastTrace;\r
-\r
- hidBuffer[58] = sdDev.capacity >> 24;\r
- hidBuffer[59] = sdDev.capacity >> 16;\r
- hidBuffer[60] = sdDev.capacity >> 8;\r
- hidBuffer[61] = sdDev.capacity;\r
-\r
- hidBuffer[62] = FIRMWARE_VERSION >> 8;\r
- hidBuffer[63] = FIRMWARE_VERSION;\r
-\r
- USBFS_LoadInEP(USB_EP_DEBUG, (uint8 *)&hidBuffer, sizeof(hidBuffer));\r
- usbDebugEpState = USB_DATA_SENT;\r
- break;\r
-\r
- case USB_DATA_SENT:\r
- if (USBFS_bGetEPAckState(USB_EP_DEBUG))\r
- {\r
- // Data accepted.\r
- usbDebugEpState = USB_IDLE;\r
- }\r
- break;\r
- }\r
-#endif\r
-}\r
-\r
-#if 0\r
-CY_ISR(debugTimerISR)\r
-{\r
- Debug_Timer_ReadStatusRegister();\r
- Debug_Timer_Interrupt_ClearPending();\r
- uint8 savedIntrStatus = CyEnterCriticalSection();\r
- debugPoll();\r
- CyExitCriticalSection(savedIntrStatus);\r
-}\r
-#endif\r
-\r
-void s2s_debugInit()\r
-{\r
-#if 0\r
- Debug_Timer_Interrupt_StartEx(debugTimerISR);\r
- Debug_Timer_Start();\r
-#endif\r
-}\r
\r
-void debugPause()\r
-{\r
-#if 0\r
- Debug_Timer_Stop();\r
-#endif\r
-}\r
-\r
-void debugResume()\r
-{\r
-#if 0\r
- Debug_Timer_Start();\r
-#endif\r
-}\r
-\r
-int isDebugEnabled()\r
-{\r
- return usbReady;\r
-}\r
\r
// Public method for storing MODE SELECT results.\r
void s2s_configSave(int scsiId, uint16_t bytesPerSector)\r
+++ /dev/null
-// Copyright (C) 2015 Michael McMaster <michael@codesrc.com>
-//
-// This file is part of SCSI2SD.
-//
-// SCSI2SD 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.
-//
-// SCSI2SD 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 SCSI2SD. If not, see <http://www.gnu.org/licenses/>.
-#ifndef Debug_H
-#define Debug_H
-
-void debugInit(void);
-void debugPause(void);
-void debugResume(void);
-int isDebugEnabled(void);
-
-#endif
-
#include "scsi.h"\r
#include "scsiPhy.h"\r
#include "config.h"\r
-#include "debug.h"\r
#include "disk.h"\r
#include "sd.h"\r
#include "time.h"\r
}\r
sdActive = 1;\r
}\r
+#endif\r
+#if 0\r
+ uint32_t maxSectors = sizeof(scsiDev.data) / SD_SECTOR_SIZE;\r
+ uint32_t rem = totalSDSectors - i;\r
+ uint32_t sectors =\r
+ rem < maxSectors ? rem : maxSectors;\r
+ sdTmpRead(&scsiDev.data[0], i + sdLBA, sectors);\r
+ scsiWrite(&scsiDev.data[0], sectors * SD_SECTOR_SIZE);\r
+ i += sectors;\r
#endif\r
if ((prep - i < buffers) &&\r
(prep < totalSDSectors))\r
// do this in a half-duplex fashion. We need to write as much as\r
// possible in each SD card transaction.\r
uint32_t maxSectors = sizeof(scsiDev.data) / SD_SECTOR_SIZE;\r
+ uint32_t rem = totalSDSectors - i;\r
uint32_t sectors =\r
- totalSDSectors < maxSectors ? totalSDSectors : maxSectors;\r
+ rem < maxSectors ? rem : maxSectors;\r
scsiRead(&scsiDev.data[0], sectors * SD_SECTOR_SIZE);\r
sdTmpWrite(&scsiDev.data[0], i + sdLBA, sectors);\r
i += sectors;\r
scsiPhyConfig();\r
scsiInit();\r
\r
- s2s_debugInit();\r
-\r
-\r
MX_USB_DEVICE_Init(); // USB lun config now available.\r
\r
// Optional bootup delay\r
//
// You should have received a copy of the GNU General Public License
// along with SCSI2SD. If not, see <http://www.gnu.org/licenses/>.
-#pragma GCC push_options
-#pragma GCC optimize("-flto")
-#include "device.h"
#include "scsi.h"
#include "config.h"
#include "mo.h"
{
int commandHandled = 0;
- uint8 command = scsiDev.cdb[0];
+ uint8_t command = scsiDev.cdb[0];
if ((command == 0x2C) || // ERASE(10)
(command == 0xAC)) // ERASE(12)
{
return commandHandled;
}
-#pragma GCC pop_options
#include "mode.h"\r
#include "time.h"\r
#include "bsp.h"\r
-//#include "cdrom.h"\r
+#include "cdrom.h"\r
//#include "debug.h"\r
-//#include "tape.h"\r
-//#include "mo.h"\r
+#include "tape.h"\r
+#include "mo.h"\r
\r
#include <string.h>\r
\r
scsiDev.lastSense = scsiDev.target->sense.code;\r
scsiDev.lastSenseASC = scsiDev.target->sense.asc;\r
\r
-\r
// Command Complete occurs AFTER a valid status has been\r
// sent. then we go bus-free.\r
enter_MessageIn(message);\r
control = scsiDev.cdb[scsiDev.cdbLen - 1];\r
\r
scsiDev.cmdCount++;\r
- // TODO const S2S_TargetCfg* cfg = scsiDev.target->cfg;\r
+ const S2S_TargetCfg* cfg = scsiDev.target->cfg;\r
\r
if (unlikely(scsiDev.resetFlag))\r
{\r
{\r
enter_Status(CONFLICT);\r
}\r
-#if 0\r
// Handle odd device types first that may override basic read and\r
// write commands. Will fall-through to generic disk handling.\r
else if (((cfg->deviceType == S2S_CFG_OPTICAL) && scsiCDRomCommand()) ||\r
{\r
// Already handled.\r
}\r
-#endif\r
else if (scsiDiskCommand())\r
{\r
// Already handled.\r
// SCSI1/SASI initiators may not set their own ID.\r
scsiDev.initiatorId = (selStatus >> 3) & 0x7;\r
\r
- // Wait until the end of the selection phase.\r
- while (likely(!scsiDev.resetFlag))\r
+ while (likely(!scsiDev.resetFlag) && scsiStatusSEL())\r
{\r
- if ((*SCSI_STS_SELECTED & 0x40) == 0)\r
- {\r
- break;\r
- }\r
+ // Wait until the end of the selection phase.\r
}\r
\r
scsiDev.phase = COMMAND;\r
}\r
}\r
\r
-#if 0\r
-uint8_t\r
-scsiReadDBxPins()\r
+static void assertFail()\r
{\r
- return\r
- (SCSI_ReadPin(SCSI_In_DBx_DB7) << 7) |\r
- (SCSI_ReadPin(SCSI_In_DBx_DB6) << 6) |\r
- (SCSI_ReadPin(SCSI_In_DBx_DB5) << 5) |\r
- (SCSI_ReadPin(SCSI_In_DBx_DB4) << 4) |\r
- (SCSI_ReadPin(SCSI_In_DBx_DB3) << 3) |\r
- (SCSI_ReadPin(SCSI_In_DBx_DB2) << 2) |\r
- (SCSI_ReadPin(SCSI_In_DBx_DB1) << 1) |\r
- SCSI_ReadPin(SCSI_In_DBx_DB0);\r
+ while (1)\r
+ {\r
+ s2s_ledOn();\r
+ s2s_delay_ms(100);\r
+ s2s_ledOff();\r
+ s2s_delay_ms(100);\r
+ }\r
}\r
-#endif\r
\r
static void\r
startScsiRx(uint32_t count)\r
uint8_t\r
scsiReadByte(void)\r
{\r
+#if FIFODEBUG\r
+ if (!scsiPhyFifoAltEmpty()) {\r
+ // Force a lock-up.\r
+ assertFail();\r
+ }\r
+#endif\r
startScsiRx(1);\r
\r
trace(trace_spinPhyRxFifo);\r
uint8_t val = scsiPhyRx();\r
// TODO scsiDev.parityError = scsiDev.parityError || SCSI_Parity_Error_Read();\r
\r
+#if FIFODEBUG\r
+ if (!scsiPhyFifoEmpty()) {\r
+ int j = 0;\r
+ uint8_t k __attribute((unused));\r
+ while (!scsiPhyFifoEmpty()) { k = scsiPhyRx(); ++j; }\r
+\r
+ // Force a lock-up.\r
+ assertFail();\r
+ }\r
+#endif\r
return val;\r
}\r
\r
chunk = chunk & 0xFFFFFFF8;\r
}\r
\r
+#if FIFODEBUG\r
+ if (!scsiPhyFifoAltEmpty()) {\r
+ // Force a lock-up.\r
+ assertFail();\r
+ }\r
+#endif\r
+\r
startScsiRx(chunk);\r
// Wait for the next scsi interrupt (or the 1ms systick)\r
__WFI();\r
};\r
}\r
\r
+#if FIFODEBUG\r
+ if (!scsiPhyFifoEmpty()) {\r
+ int j = 0;\r
+ while (!scsiPhyFifoEmpty()) { scsiPhyRx(); ++j; }\r
+ // Force a lock-up.\r
+ assertFail();\r
+ }\r
+#endif\r
i += chunk;\r
}\r
}\r
void\r
scsiWriteByte(uint8_t value)\r
{\r
+#if FIFODEBUG\r
+ if (!scsiPhyFifoEmpty()) {\r
+ // Force a lock-up.\r
+ assertFail();\r
+ }\r
+#endif\r
trace(trace_spinPhyTxFifo);\r
scsiPhyTx(value);\r
scsiPhyFifoFlip();\r
\r
trace(trace_spinTxComplete);\r
while (!scsiPhyComplete() && likely(!scsiDev.resetFlag)) {}\r
+\r
+#if FIFODEBUG\r
+ if (!scsiPhyFifoAltEmpty()) {\r
+ // Force a lock-up.\r
+ assertFail();\r
+ }\r
+#endif\r
}\r
\r
static void\r
uint32_t chunk = ((count - i) > SCSI_FIFO_DEPTH)\r
? SCSI_FIFO_DEPTH : (count - i);\r
\r
+#if FIFODEBUG\r
+ if (!scsiPhyFifoEmpty()) {\r
+ // Force a lock-up.\r
+ assertFail();\r
+ }\r
+#endif\r
+\r
if (chunk < 16)\r
{\r
scsiWritePIO(data + i, chunk);\r
}\r
\r
while (!scsiPhyComplete() && likely(!scsiDev.resetFlag)) {}\r
+\r
+#if FIFODEBUG\r
+ if (!scsiPhyFifoAltEmpty()) {\r
+ // Force a lock-up.\r
+ assertFail();\r
+ }\r
+#endif\r
+\r
scsiPhyFifoFlip();\r
#if 0\r
// TODO NEED SCSI IRQs\r
i += chunk;\r
}\r
while (!scsiPhyComplete() && likely(!scsiDev.resetFlag)) {}\r
+\r
+#if FIFODEBUG\r
+ if (!scsiPhyFifoAltEmpty()) {\r
+ // Force a lock-up.\r
+ assertFail();\r
+ }\r
+#endif\r
}\r
\r
static inline void busSettleDelay(void)\r
\r
void scsiEnterBusFree()\r
{\r
- *SCSI_CTRL_PHASE = 0;\r
*SCSI_CTRL_BSY = 0x00;\r
+ // We now have a Bus Clear Delay of 800ns to release remaining signals.\r
+ *SCSI_CTRL_PHASE = 0;\r
}\r
\r
void scsiEnterPhase(int phase)\r
{\r
// ANSI INCITS 362-2002 SPI-3 10.7.1:\r
// Phase changes are not allowed while REQ or ACK is asserted.\r
-#if 0\r
- while (likely(!scsiDev.resetFlag) &&\r
- (SCSI_ReadPin(SCSI_In_REQ) || SCSI_ReadFilt(SCSI_Filt_ACK))\r
- ) {}\r
-#endif\r
+ while (likely(!scsiDev.resetFlag) && scsiStatusACK()) {}\r
\r
int newPhase = phase > 0 ? phase : 0;\r
- if (newPhase != *SCSI_CTRL_PHASE)\r
+ int oldPhase = *SCSI_CTRL_PHASE;\r
+\r
+ if (!scsiPhyFifoEmpty() || !scsiPhyFifoAltEmpty()) {\r
+ // Force a lock-up.\r
+ assertFail();\r
+ }\r
+ if (newPhase != oldPhase)\r
{\r
*SCSI_CTRL_PHASE = newPhase;\r
busSettleDelay();\r
{\r
s2s_delay_us(100);\r
}\r
+\r
}\r
}\r
\r
{\r
if (scsiDev.data[j] != (uint8_t) j)\r
{\r
- while (1)\r
- {\r
- s2s_ledOn();\r
- s2s_delay_ms(100);\r
- s2s_ledOff();\r
- s2s_delay_ms(100);\r
- }\r
+ assertFail();\r
}\r
}\r
\r
#define scsiPhyFifoFull() ((*SCSI_STS_FIFO & 0x01) == 0x01)
#define scsiPhyFifoEmpty() ((*SCSI_STS_FIFO & 0x02) == 0x02)
+#define scsiPhyFifoAltEmpty() ((*SCSI_STS_ALTFIFO & 0x02) == 0x02)
#define scsiPhyFifoFlip() \
{\
#define scsiStatusATN() ((*SCSI_STS_SCSI & 0x01) == 0x01)
#define scsiStatusBSY() ((*SCSI_STS_SCSI & 0x02) == 0x02)
#define scsiStatusRST() ((*SCSI_STS_SCSI & 0x04) == 0x04)
+#define scsiStatusSEL() ((*SCSI_STS_SCSI & 0x08) == 0x08)
+#define scsiStatusACK() ((*SCSI_STS_SCSI & 0x10) == 0x10)
extern uint8_t scsiPhyFifoSel;
sdInitDMA();\r
}\r
\r
- if (scsiDev.phase == BUS_FREE)\r
+ if (firstInit || (scsiDev.phase == BUS_FREE))\r
{\r
uint8_t cs = HAL_GPIO_ReadPin(nSD_CD_GPIO_Port, nSD_CD_Pin) ? 0 : 1;\r
uint8_t wp = HAL_GPIO_ReadPin(nSD_WP_GPIO_Port, nSD_WP_Pin) ? 0 : 1;\r
//
// You should have received a copy of the GNU General Public License
// along with SCSI2SD. If not, see <http://www.gnu.org/licenses/>.
-#pragma GCC push_options
-#pragma GCC optimize("-flto")
-#include "device.h"
#include "scsi.h"
#include "config.h"
#include "tape.h"
return 0;
}
-#pragma GCC pop_options
-VPATH=../firmware
+VPATH=../firmware dfu-programmer/src
VERSION=6.0
NAME=scsi2sd-util6
USE_SYSTEM_HIDAPI = Yes
USE_SYSTEM_ZLIB = Yes
USE_SYSTEM_WX = Yes
+USE_SYSTEM_LIBUSB = Yes
+endif
+
+ifeq ($(USE_SYSTEM_LIBUSB), Yes)
+CPPFLAGS_LIBUSB=$(shell pkg-config libusb-1.0 --cflags)
+LDFLAGS_LIBUSB=$(shell pkg-config libusb-1.0 --libs)
+else
+CPPFLAGS_LIBUSB=-I libusb-1.0.9/libusb
+LDFLAGS_LIBUSB=-L $(BUILD)/libusb/libusb/.libs -lusb-1.0
endif
ifeq ($(USE_SYSTEM_HIDAPI), Yes)
LDFLAGS_WX=$(shell $(BUILD)/wx/wx-config --libs)
endif
-CPPFLAGS = $(CPPFLAGS_HIDAPI) -I. -I ../../include -Ilibzipper-1.0.4 $(CPPFLAGS_ZLIB)
+CPPFLAGS = $(CPPFLAGS_HIDAPI) -I. -I ../../include -Idfu-programmer/src \
+ -Ilibzipper-1.0.4 \
+ $(CPPFLAGS_ZLIB) \
+ $(CPPFLAGS_LIBUSB) \
+ -DHAVE_LIBUSB_1_0 \
+
+
CFLAGS += -Wall -Wno-pointer-sign -O2 -g
CXXFLAGS += -Wall -O2 -g -std=c++0x
-LDFLAGS += -L$(BUILD)/libzipper/.libs -lzipper $(LDFLAGS_ZLIB) $(LDFLAGS_HIDAPI)
+LDFLAGS += -L$(BUILD)/libzipper/.libs -lzipper \
+ $(LDFLAGS_ZLIB) \
+ $(LDFLAGS_HIDAPI) \
+ $(LDFLAGS_LIBUSB)
# wxWidgets 3.0.2 uses broken Webkit headers under OSX Yosemeti
LIBZIPPER_CONFIG+=--host=i686-w64-mingw32
EXE=.exe
WX_CONFIG+=--host=i686-w64-mingw32
+ LIBUSB_CONFIG+=--host=i686-w64-mingw32 --disable-shared
endif
ifeq ($(TARGET),Win64)
VPATH += hidapi/windows
LIBZIPPER_CONFIG+=--host=x86_64-w64-mingw32
EXE=.exe
WX_CONFIG+=--host=x86_64-w64-mingw32
+ LIBUSB_CONFIG+=--host=x86_64-w64-mingw32 --disable-shared
endif
ifeq ($(TARGET),Linux)
VPATH += hidapi/linux
- CPPFLAGS += -DHAS_LIBUSB
LDFLAGS += -ludev -lexpat -lusb-1.0
BUILD := $(PWD)/build/linux
+ LIBUSB_CONFIG+=--disable-shared
endif
ifeq ($(TARGET),Darwin)
# Should match OSX
CC=clang -mmacosx-version-min=10.7
CXX=clang++ -stdlib=libc++ -mmacosx-version-min=10.7
WX_CONFIG += --with-macosx-version-min=10.7
+ LIBUSB_CONFIG += --with-macosx-version-min=10.7 --disable-shared
BUILD := $(PWD)/build/mac
all: $(BUILD)/scsi2sd-util6.dmg
$(BUILD)/SCSI2SD_HID.o \
$(BUILD)/hidpacket.o \
+# $(BUILD)/Dfu.o \
+# $(BUILD)/dfu.o \
+
+
EXEOBJ = \
$(BUILD)/scsi2sd-util6.o \
-
ifneq ($(USE_SYSTEM_ZLIB),Yes)
$(OBJ): $(BUILD)/zlib/buildstamp
$(EXEOBJ): $(BUILD)/zlib/buildstamp
touch $@
endif
+ifneq ($(USE_SYSTEM_LIBUSB),Yes)
+$(OBJ): $(BUILD)/libusb/buildstamp
+$(EXEOBJ): $(BUILD)/libusb/buildstamp
+$(BUILD)/libusb/buildstamp:
+ mkdir -p $(dir $@)
+ ( \
+ cd $(dir $@) && \
+ $(CURDIR)/libusb-1.0.9/configure $(LIBUSB_CONFIG) && \
+ $(MAKE) \
+ ) && \
+ touch $@
+endif
+
ifneq ($(USE_SYSTEM_WX),Yes)
$(OBJ): $(BUILD)/wx/buildstamp
$(EXEOBJ): $(BUILD)/wx/buildstamp
bool
HID::readSCSIDebugInfo(std::vector<uint8_t>& buf)
{
-#if 0
- buf[0] = 0; // report id
- hid_set_nonblocking(myDebugHandle, 1);
- int result =
- hid_read_timeout(
- myDebugHandle,
- &buf[0],
- HID_PACKET_SIZE,
- HID_TIMEOUT_MS);
- hid_set_nonblocking(myDebugHandle, 0);
-
- if (result <= 0)
- {
- const wchar_t* err = hid_error(myDebugHandle);
- std::stringstream ss;
- ss << "USB HID read failure: " << err;
- throw std::runtime_error(ss.str());
- }
- return result > 0;
-#endif
- return false;
+ std::vector<uint8_t> cmd { S2S_CMD_DEBUG };
+ sendHIDPacket(cmd, buf, 1);
+ return buf.size() > 0;
}
#include "BoardPanel.hh"
#include "TargetPanel.hh"
#include "SCSI2SD_HID.hh"
+//#include "Dfu.hh"
#include <algorithm>
#include <iomanip>
using std::tr1::shared_ptr;
#endif
-#ifdef HAS_LIBUSB
-#include <libusb-1.0/libusb.h>
-#endif
-
using namespace SCSI2SD;
class ProgressWrapper
namespace
{
-bool hasDFUdevice() {
-#ifdef HAS_LIBUSB
- bool found = false;
-
- libusb_device **list;
- ssize_t cnt = libusb_get_device_list(NULL, &list);
- ssize_t i = 0;
- if (cnt < 0) return false;
-
- for (i = 0; i < cnt; i++) {
- libusb_device *device = list[i];
- libusb_device_descriptor desc;
- libusb_get_device_descriptor(device, &desc);
- if (desc.idVendor == 0x0483 && desc.idProduct == 0xdf11) {
- found = true;
- break;
- }
- }
-
- libusb_free_device_list(list, 1);
-
- return found;
-#else
- return false;
-#endif
-}
-
static uint8_t sdCrc7(uint8_t* chr, uint8_t cnt, uint8_t crc)
{
myLogWindow->PassMessages(false); // Prevent messagebox popups
myTimer = new wxTimer(this, ID_Timer);
- myTimer->Start(16); //ms, suitable for scsi debug logging
+ myTimer->Start(64); //ms, suitable for scsi debug logging
}
private:
+ //Dfu myDfu;
wxLogWindow* myLogWindow;
BoardPanel* myBoardPanel;
std::vector<TargetPanel*> myTargets;
}
- if (hasDFUdevice())
+/*
+ if (myDfu.hasDevice())
{
mmLogStatus("STM DFU Bootloader found");
progress->Show(0);
doDFUUpdate(filename);
return;
}
+*/
}
catch (std::exception& e)
{
}
try
{
- std::vector<uint8_t> info(HID::HID_PACKET_SIZE);
+ std::vector<uint8_t> info;
if (myHID->readSCSIDebugInfo(info))
{
dumpSCSICommand(info);
public:
virtual bool OnInit()
{
-#ifdef HAS_LIBUSB
- libusb_init(NULL);
-#endif
AppFrame* frame = new AppFrame();
frame->Show(true);
SetTopWindow(frame);