disabled usb interrupts in WriteEP

This commit is contained in:
schneider 2011-12-10 21:39:04 +01:00
parent 7193ee5972
commit 5704ce08cb
1 changed files with 8 additions and 0 deletions

View File

@ -26,6 +26,7 @@
#include "usbhw.h" #include "usbhw.h"
#include "usbcore.h" #include "usbcore.h"
#include "usbuser.h" #include "usbuser.h"
#include "basic/basic.h"
#include "usb/usbmsc.h" #include "usb/usbmsc.h"
@ -470,6 +471,10 @@ uint32_t USB_ReadEP (uint32_t EPNum, uint8_t *pData)
uint32_t USB_WriteEP (uint32_t EPNum, uint8_t *pData, uint32_t cnt) uint32_t USB_WriteEP (uint32_t EPNum, uint8_t *pData, uint32_t cnt)
{ {
uint32_t n; uint32_t n;
//this seems rather brutal...
//disable all usb related interrupts or WrCmd might block
USB_DEVINTEN = 0;
USB_CTRL = ((EPNum & 0x0F) << 2) | CTRL_WR_EN; USB_CTRL = ((EPNum & 0x0F) << 2) | CTRL_WR_EN;
/* 3 clock cycles to fetch the packet length from RAM. */ /* 3 clock cycles to fetch the packet length from RAM. */
@ -486,6 +491,9 @@ uint32_t USB_WriteEP (uint32_t EPNum, uint8_t *pData, uint32_t cnt)
WrCmdEP(EPNum, CMD_VALID_BUF); WrCmdEP(EPNum, CMD_VALID_BUF);
//enable interrupts again
USB_DEVINTEN = DEV_STAT_INT | (0xFF<<1) | (USB_SOF_EVENT ? FRAME_INT : 0);
return (cnt); return (cnt);
} }