diff --git a/ion/src/device/n0100/Makefile b/ion/src/device/n0100/Makefile index 931bd69d0..8b0271c7b 100644 --- a/ion/src/device/n0100/Makefile +++ b/ion/src/device/n0100/Makefile @@ -2,4 +2,6 @@ ion_device_src += $(addprefix ion/src/device/n0100/drivers/, \ board.cpp \ ) +ion_device_src += ion/src/device/n0101/usb/stack/device.cpp + LDSCRIPT ?= ion/src/device/n0100/flash.ld diff --git a/ion/src/device/n0100/usb/stack/device.cpp b/ion/src/device/n0100/usb/stack/device.cpp new file mode 100644 index 000000000..c868116ed --- /dev/null +++ b/ion/src/device/n0100/usb/stack/device.cpp @@ -0,0 +1,20 @@ +#include +#include + +namespace Ion { +namespace Device { +namespace USB { + +void Device::leave() { + /* We don't perform a core reset because at this point in time the USB cable + * is most likely plugged in. Doing a full core reset would be the clean + * thing to do but would therefore result in the device entering the ROMed + * DFU bootloader, which we want to avoid. By performing a jump-reset, we + * will enter the newly flashed firmware. */ + Ion::Device::Reset::jump(); +} + +} +} +} + diff --git a/ion/src/device/n0101/Makefile b/ion/src/device/n0101/Makefile index 5f1bf5b13..de1b95697 100644 --- a/ion/src/device/n0101/Makefile +++ b/ion/src/device/n0101/Makefile @@ -3,4 +3,6 @@ ion_device_src += $(addprefix ion/src/device/n0101/drivers/, \ cache.cpp \ ) +ion_device_src += ion/src/device/n0101/usb/stack/device.cpp + LDSCRIPT ?= ion/src/device/n0101/flash.ld diff --git a/ion/src/device/n0101/usb/stack/device.cpp b/ion/src/device/n0101/usb/stack/device.cpp new file mode 100644 index 000000000..08ca6a9f4 --- /dev/null +++ b/ion/src/device/n0101/usb/stack/device.cpp @@ -0,0 +1,16 @@ +#include +#include + +namespace Ion { +namespace Device { +namespace USB { + +void Device::leave() { + Ion::Device::Reset::core(); +} + +} +} +} + + diff --git a/ion/src/device/shared/usb/Makefile b/ion/src/device/shared/usb/Makefile index 7c77dff0d..b61dbdb6b 100644 --- a/ion/src/device/shared/usb/Makefile +++ b/ion/src/device/shared/usb/Makefile @@ -48,6 +48,7 @@ dfu_src += liba/src/memcpy.c dfu_src += libaxx/src/cxxabi/pure_virtual.cpp dfu_src += ion/src/device/shared/usb/boot.cpp dfu_src += ion/src/device/$(MODEL)/drivers/cache.cpp +dfu_src += ion/src/device/$(MODEL)/usb/stack/device.cpp dfu_src += $(addprefix ion/src/device/shared/drivers/, \ base64.cpp \ external_flash.cpp \ diff --git a/ion/src/device/shared/usb/calculator.cpp b/ion/src/device/shared/usb/calculator.cpp index 0ad5a285c..60a63185e 100644 --- a/ion/src/device/shared/usb/calculator.cpp +++ b/ion/src/device/shared/usb/calculator.cpp @@ -1,7 +1,6 @@ #include "calculator.h" #include #include -#include #include namespace Ion { @@ -30,12 +29,7 @@ void Calculator::PollAndReset(bool exitWithKeyboard) { c.detach(); } if (c.resetOnDisconnect()) { - /* We don't perform a core reset because at this point in time the USB cable - * is most likely plugged in. Doing a full core reset would be the clean - * thing to do but would therefore result in the device entering the ROMed - * DFU bootloader, which we want to avoid. By performing a jump-reset, we - * will enter the newly flashed firmware. */ - Ion::Device::Reset::jump(); + c.leave(); } } diff --git a/ion/src/device/shared/usb/stack/device.h b/ion/src/device/shared/usb/stack/device.h index 64d97d0fb..e1bcb3daf 100644 --- a/ion/src/device/shared/usb/stack/device.h +++ b/ion/src/device/shared/usb/stack/device.h @@ -23,6 +23,7 @@ public: void poll(); bool isSoftDisconnected() const; void detach(); + void leave(); bool resetOnDisconnect() { return m_resetOnDisconnect; } void setResetOnDisconnect(bool reset) { m_resetOnDisconnect = reset; } protected: