summaryrefslogtreecommitdiff
path: root/src/portable
diff options
context:
space:
mode:
authorhathach <[email protected]>2019-10-10 11:03:31 +0700
committerhathach <[email protected]>2019-10-10 11:03:31 +0700
commit267c76c7db814513957f721bc70c31267dd37308 (patch)
treee8b47b32b2cfe5ea97270b6eb9528fbf81c4ce69 /src/portable
parentc42edc080cb61d4af8015df6c1d404273b3a5bfa (diff)
embOS port by Matt Pageport-embos
note: embOS require OS_EnterInterrupt/OS_LeaveInterrupt to be called. This should be resolved by implementing #128 without introduce new OSAL API
Diffstat (limited to 'src/portable')
-rw-r--r--src/portable/microchip/samd21/dcd_samd21.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/portable/microchip/samd21/dcd_samd21.c b/src/portable/microchip/samd21/dcd_samd21.c
index 231abc7d0..9848f445c 100644
--- a/src/portable/microchip/samd21/dcd_samd21.c
+++ b/src/portable/microchip/samd21/dcd_samd21.c
@@ -30,6 +30,7 @@
#include "device/dcd.h"
#include "sam.h"
+#include "osal/osal.h"
/*------------------------------------------------------------------*/
/* MACRO TYPEDEF CONSTANT ENUM
@@ -37,6 +38,14 @@
static TU_ATTR_ALIGNED(4) UsbDeviceDescBank sram_registers[8][2];
static TU_ATTR_ALIGNED(4) uint8_t _setup_packet[8];
+
+//---------------------
+// Forward declarations
+//---------------------
+void maybe_transfer_complete(void);
+void USB_IRQHandler(void);
+//=====================
+
// Setup the control endpoint 0.
static void bus_reset(void)
{
@@ -291,11 +300,13 @@ void maybe_transfer_complete(void) {
}
}
-void USB_Handler(void)
+void USB_IRQHandler(void) // Renamed
{
- uint32_t int_status = USB->DEVICE.INTFLAG.reg & USB->DEVICE.INTENSET.reg;
+ uint32_t int_status;
+ osal_enter_interrupt();
+ int_status = USB->DEVICE.INTFLAG.reg & USB->DEVICE.INTENSET.reg;
USB->DEVICE.INTFLAG.reg = int_status; // clear interrupt
-
+ //printf("USB_IRQ %x\r\n", int_status);
/*------------- Interrupt Processing -------------*/
if ( int_status & USB_DEVICE_INTFLAG_SOF )
{
@@ -338,6 +349,7 @@ void USB_Handler(void)
// Handle complete transfer
maybe_transfer_complete();
+ osal_leave_interrupt();
}
#endif