Merge pull request #174 from xmos/feature/6.15.3_fixes

Document 50 and 500 msec delays before DFU resets (sc_usb_audio 49e2ce9)
This commit is contained in:
oscarbailey-xmos
2020-12-08 16:39:57 +00:00
committed by GitHub

View File

@@ -66,6 +66,22 @@
#include "xua_dfu.h"
#define DFU_IF_NUM INPUT_INTERFACES + OUTPUT_INTERFACES + MIDI_INTERFACES + 1
extern void device_reboot(void);
/* Windows core USB/device driver stack may not like device coming off bus for
* a very short period of less than 500ms. Enforce at least 500ms by stalling.
* This may not have the desired effect depending on whether 'off the bus'
* requires device terminations disabled (PHY off). In that case we would be
* better off doing the reboot to DFU and then delaying PHY initialisation
* instead. Suggest revisiting.
*/
#define DELAY_BEFORE_REBOOT_TO_DFU_MS 500
/* Similarly to the delay before reboot to DFU mode, this delay is meant to
* avoid shocking the Windows software stack. Suggest revisiting to establish
* if 50 or 500 is needed.
*/
#define DELAY_BEFORE_REBOOT_FROM_DFU_MS 50
#endif
#if( 0 < HID_CONTROLS )
@@ -814,7 +830,7 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0
if(reset)
{
DFUDelay(50000000);
DFUDelay(DELAY_BEFORE_REBOOT_TO_DFU_MS * 100000);
device_reboot();
}
}
@@ -1035,7 +1051,7 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0
DFU_mode_active = 0;
/* Send reboot command */
DFUDelay(5000000);
DFUDelay(DELAY_BEFORE_REBOOT_FROM_DFU_MS * 100000);
device_reboot();
}
}