You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

188 lines
6.3 KiB
Diff

diff -Naur /home/aleph/Downloads/USB_Host_Shield_2.0-master/masstorage.cpp lib/masstorage.cpp
--- /home/aleph/Downloads/USB_Host_Shield_2.0-master/masstorage.cpp 2018-09-21 10:19:36.107502252 -0600
+++ lib/masstorage.cpp 2018-09-21 09:46:19.620175519 -0600
@@ -24,6 +24,8 @@
#include "masstorage.h"
+#if ENABLED(USB_FLASH_DRIVE_SUPPORT)
+
const uint8_t BulkOnly::epDataInIndex = 1;
const uint8_t BulkOnly::epDataOutIndex = 2;
const uint8_t BulkOnly::epInterruptInIndex = 3;
@@ -796,6 +798,9 @@
buf[i] = 0x00;
}
WriteOk[lun] = true;
+ #if ENABLED(USB_FLASH_DRIVE_SUPPORT) && defined(SKIP_WRITE_PROTECT)
+ return 0;
+ #endif
uint8_t rc = ModeSense6(lun, 0, 0x3f, 0, 192, buf);
if(!rc) {
WriteOk[lun] = ((buf[2] & 0x80) == 0);
@@ -1271,3 +1276,5 @@
return MASS_ERR_NOT_IMPLEMENTED;
#endif
}
+
+#endif // USB_FLASH_DRIVE_SUPPORT
\ No newline at end of file
diff -Naur /home/aleph/Downloads/USB_Host_Shield_2.0-master/message.cpp lib/message.cpp
--- /home/aleph/Downloads/USB_Host_Shield_2.0-master/message.cpp 2018-09-21 10:20:15.995647957 -0600
+++ lib/message.cpp 2018-09-19 07:43:46.520339375 -0600
@@ -23,6 +23,9 @@
*/
#include "Usb.h"
+
+#if ENABLED(USB_FLASH_DRIVE_SUPPORT)
+
// 0x80 is the default (i.e. trace) to turn off set this global to something lower.
// this allows for 126 other debugging levels.
// TO-DO: Allow assignment to a different serial port by software
@@ -120,4 +123,6 @@
D_PrintHex<uint8_t > (rcode, 0x80);
Notify(PSTR("\r\n"), 0x80);
}
-#endif
+#endif // DEBUG_USB_HOST
+
+#endif // USB_FLASH_DRIVE_SUPPORT
\ No newline at end of file
diff -Naur /home/aleph/Downloads/USB_Host_Shield_2.0-master/parsetools.cpp lib/parsetools.cpp
--- /home/aleph/Downloads/USB_Host_Shield_2.0-master/parsetools.cpp 2018-09-21 10:21:16.215867769 -0600
+++ lib/parsetools.cpp 2018-09-19 07:43:46.520339375 -0600
@@ -23,6 +23,8 @@
*/
#include "Usb.h"
+#if ENABLED(USB_FLASH_DRIVE_SUPPORT)
+
bool MultiByteValueParser::Parse(uint8_t **pp, uint16_t *pcntdn) {
if(!pBuf) {
Notify(PSTR("Buffer pointer is NULL!\r\n"), 0x80);
@@ -72,3 +74,5 @@
}
return true;
}
+
+#endif // USB_FLASH_DRIVE_SUPPORT
\ No newline at end of file
diff -Naur /home/aleph/Downloads/USB_Host_Shield_2.0-master/settings.h lib/settings.h
--- /home/aleph/Downloads/USB_Host_Shield_2.0-master/settings.h 2018-09-21 10:22:21.792106872 -0600
+++ lib/settings.h 2018-09-21 10:01:53.383594081 -0600
@@ -25,7 +25,21 @@
#ifndef USB_HOST_SHIELD_SETTINGS_H
#define USB_HOST_SHIELD_SETTINGS_H
#include "macros.h"
-
+#if ENABLED(USB_FLASH_DRIVE_SUPPORT)
+ ////////////////////////////////////////////////////////////////////////////////
+ /* Added by Bill Greiman to speed up mass storage initialization with USB
+ * flash drives and simple USB hard drives.
+ * Disable this by defining DELAY(x) to be delay(x).
+ */
+ #define delay(x) if((x) < 200) safe_delay(x)
+ /* Almost all USB flash drives and simple USB hard drives fail the write
+ * protect test and add 20 - 30 seconds to USB init. Set SKIP_WRITE_PROTECT
+ * to nonzero to skip the test and assume the drive is writable.
+ */
+ #define SKIP_WRITE_PROTECT 1
+ /* Since Marlin only cares about USB flash drives, we only need one LUN. */
+ #define MASS_MAX_SUPPORTED_LUN 1
+#endif
////////////////////////////////////////////////////////////////////////////////
// SPI Configuration
////////////////////////////////////////////////////////////////////////////////
@@ -45,6 +59,10 @@
* multiple serial ports are available.
* For example Serial3.
*/
+#if ENABLED(USB_FLASH_DRIVE_SUPPORT)
+ #define USB_HOST_SERIAL MYSERIAL0
+#endif
+
#ifndef USB_HOST_SERIAL
#define USB_HOST_SERIAL Serial
#endif
@@ -99,7 +117,7 @@
// No user serviceable parts below this line.
// DO NOT change anything below here unless you are a developer!
-#include "version_helper.h"
+//#include "version_helper.h"
#if defined(__GNUC__) && defined(__AVR__)
#ifndef GCC_VERSION
@@ -149,7 +167,6 @@
#else
#define USING_SPI4TEENSY3 0
#endif
-
#if ((defined(ARDUINO_SAM_DUE) && defined(__SAM3X8E__)) || defined(__ARDUINO_X86__) || ARDUINO >= 10600) && !USING_SPI4TEENSY3
#include <SPI.h> // Use the Arduino SPI library for the Arduino Due, Intel Galileo 1 & 2, Intel Edison or if the SPI library with transaction is available
#endif
diff -Naur /home/aleph/Downloads/USB_Host_Shield_2.0-master/UsbCore.h lib/UsbCore.h
--- /home/aleph/Downloads/USB_Host_Shield_2.0-master/UsbCore.h 2018-09-21 10:23:09.348280107 -0600
+++ lib/UsbCore.h 2018-09-19 07:43:46.520339375 -0600
@@ -32,7 +32,10 @@
//#define USB_METHODS_INLINE
/* shield pins. First parameter - SS pin, second parameter - INT pin */
-#ifdef BOARD_BLACK_WIDDOW
+
+#if defined(__MARLIN_H__)
+typedef MAX3421e MAX3421E; // Marlin redefines this class in "../usb_host.h"
+#elif defined(BOARD_BLACK_WIDDOW)
typedef MAX3421e<P6, P3> MAX3421E; // Black Widow
#elif defined(CORE_TEENSY) && (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__))
#if EXT_RAM
diff -Naur /home/aleph/Downloads/USB_Host_Shield_2.0-master/Usb.cpp lib/Usb.cpp
--- /home/aleph/Downloads/USB_Host_Shield_2.0-master/Usb.cpp 2018-09-21 10:23:20.732321559 -0600
+++ lib/Usb.cpp 2018-09-19 07:43:46.520339375 -0600
@@ -25,6 +25,8 @@
#include "Usb.h"
+#if ENABLED(USB_FLASH_DRIVE_SUPPORT)
+
static uint8_t usb_error = 0;
static uint8_t usb_task_state;
@@ -825,3 +827,4 @@
}
#endif // defined(USB_METHODS_INLINE)
+#endif // USB_FLASH_DRIVE_SUPPORT
diff -Naur /home/aleph/Downloads/USB_Host_Shield_2.0-master/Usb.h lib/Usb.h
--- /home/aleph/Downloads/USB_Host_Shield_2.0-master/Usb.h 2018-09-21 10:23:33.756368972 -0600
+++ lib/Usb.h 2018-09-19 07:43:46.520339375 -0600
@@ -25,6 +25,8 @@
#ifndef _usb_h_
#define _usb_h_
+#include "../../../Marlin.h"
+
// WARNING: Do not change the order of includes, or stuff will break!
#include <inttypes.h>
#include <stddef.h>
@@ -34,13 +36,15 @@
#include "settings.h"
#include "printhex.h"
#include "message.h"
+
#include "hexdump.h"
-#include "sink_parser.h"
+//#include "sink_parser.h"
#include "max3421e.h"
#include "address.h"
-#include "avrpins.h"
+//#include "avrpins.h"
#include "usb_ch9.h"
-#include "usbhost.h"
+//#include "usbhost.h"
+#include "../usb_host.h"
#include "UsbCore.h"
#include "parsetools.h"
#include "confdescparser.h"