From 87d89cf5cbc42bc905654cca92c8a1809183a23d Mon Sep 17 00:00:00 2001 From: hathach Date: Wed, 24 Oct 2018 16:48:27 +0700 Subject: [PATCH] fix nrf52 freeRTOS interrupt priority --- hw/mcu/nordic/FreeRTOSConfig.h | 11 +++++++---- src/device/usbd.c | 6 +++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/hw/mcu/nordic/FreeRTOSConfig.h b/hw/mcu/nordic/FreeRTOSConfig.h index be2768ba7..96de8f8c5 100644 --- a/hw/mcu/nordic/FreeRTOSConfig.h +++ b/hw/mcu/nordic/FreeRTOSConfig.h @@ -112,7 +112,10 @@ do {\ if ( !(_exp) ) { \ volatile uint32_t* ARM_CM_DHCSR = ((volatile uint32_t*) 0xE000EDF0UL); /* Cortex M CoreDebug->DHCSR */ \ - if ( (*ARM_CM_DHCSR) & 1UL ) __asm("BKPT #0\n"); /* Only halt mcu if debugger is attached */\ + if ( (*ARM_CM_DHCSR) & 1UL ) { /* Only halt mcu if debugger is attached */ \ + taskDISABLE_INTERRUPTS(); \ + __asm("BKPT #0\n"); \ + }\ }\ } while(0) #else @@ -136,7 +139,7 @@ /* The lowest interrupt priority that can be used in a call to a "set priority" function. */ -#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0x0f +#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY ((1<xfer_complete.len) { (void) event->xfer_complete.result; // TODO handle control error/stalled - osal_semaphore_post( _usbd_ctrl_sem, true); + osal_semaphore_post( _usbd_ctrl_sem, in_isr); } }else { - osal_queue_send(_usbd_q, event, true); + osal_queue_send(_usbd_q, event, in_isr); } TU_ASSERT(event->xfer_complete.result == DCD_XFER_SUCCESS,); break;