pxt-common-packages 10.1.6 → 10.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/libs/core/hf2.cpp
CHANGED
|
@@ -267,9 +267,11 @@ static void copy_words(void *dst0, const void *src0, uint32_t n_words) {
|
|
|
267
267
|
#if defined(NRF52840) || defined(NRF52833)
|
|
268
268
|
#define DBL_TAP_PTR ((volatile uint32_t *)0x20007F7C)
|
|
269
269
|
#endif
|
|
270
|
+
#ifdef DBL_TAP_PTR
|
|
270
271
|
#define DBL_TAP_MAGIC_QUICK_BOOT 0xf02669ef
|
|
271
272
|
#define QUICK_BOOT(v) *DBL_TAP_PTR = v ? DBL_TAP_MAGIC_QUICK_BOOT : 0
|
|
272
273
|
#endif
|
|
274
|
+
#endif
|
|
273
275
|
|
|
274
276
|
static HF2 *jdLogger;
|
|
275
277
|
static void jdLog(const uint8_t *frame) {
|
|
@@ -279,7 +281,7 @@ static void jdLog(const uint8_t *frame) {
|
|
|
279
281
|
void HF2::pokeSend() {
|
|
280
282
|
#ifdef USB_EP_FLAG_ASYNC
|
|
281
283
|
target_disable_irq();
|
|
282
|
-
|
|
284
|
+
while (pendingWrite && in->canWrite()) {
|
|
283
285
|
in->flags |= USB_EP_FLAG_ASYNC;
|
|
284
286
|
|
|
285
287
|
int size = pendingWrite->size - pendingWritePtr;
|
|
@@ -291,7 +293,8 @@ void HF2::pokeSend() {
|
|
|
291
293
|
s = size;
|
|
292
294
|
buf[0] = pendingWrite->flag;
|
|
293
295
|
} else {
|
|
294
|
-
buf[0] = pendingWrite->flag == HF2_FLAG_CMDPKT_LAST ? HF2_FLAG_CMDPKT_BODY
|
|
296
|
+
buf[0] = pendingWrite->flag == HF2_FLAG_CMDPKT_LAST ? HF2_FLAG_CMDPKT_BODY
|
|
297
|
+
: pendingWrite->flag;
|
|
295
298
|
}
|
|
296
299
|
buf[0] |= s;
|
|
297
300
|
uint8_t *dst = (uint8_t *)buf;
|
|
@@ -364,6 +367,7 @@ int HF2::endpointRequest() {
|
|
|
364
367
|
target_reset();
|
|
365
368
|
break;
|
|
366
369
|
|
|
370
|
+
#ifdef QUICK_BOOT
|
|
367
371
|
case HF2_CMD_RESET_INTO_APP:
|
|
368
372
|
QUICK_BOOT(1);
|
|
369
373
|
NVIC_SystemReset();
|
|
@@ -372,6 +376,12 @@ int HF2::endpointRequest() {
|
|
|
372
376
|
QUICK_BOOT(0);
|
|
373
377
|
NVIC_SystemReset();
|
|
374
378
|
break;
|
|
379
|
+
#else
|
|
380
|
+
case HF2_CMD_RESET_INTO_APP:
|
|
381
|
+
NVIC_SystemReset();
|
|
382
|
+
break;
|
|
383
|
+
// reset into bootloader not supported
|
|
384
|
+
#endif
|
|
375
385
|
|
|
376
386
|
#if USB_HANDOVER
|
|
377
387
|
case HF2_CMD_START_FLASH:
|