Skip to content

Commit

Permalink
chips/samd21: Clear error status bits when setting ep bank ready
Browse files Browse the repository at this point in the history
This is what the sample code does, so we'll just play along.

Signed-off-by: Keith Packard <keithp@keithp.com>
  • Loading branch information
keith-packard committed Aug 4, 2019
1 parent 05f8688 commit 613b52f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions chips/samd21/samd21.h
Expand Up @@ -1222,6 +1222,7 @@ samd21_usb_desc_set_byte_count(uint8_t ep, uint8_t bank, uint32_t count)
uint32_t pcksize = samd21_usb_desc[ep].bank[bank].pcksize;

pcksize &= ~(SAMD21_USB_DESC_PCKSIZE_BYTE_COUNT_MASK << SAMD21_USB_DESC_PCKSIZE_BYTE_COUNT);
pcksize &= ~(SAMD21_USB_DESC_PCKSIZE_MULTI_PACKET_SIZE_MASK << SAMD21_USB_DESC_PCKSIZE_MULTI_PACKET_SIZE);
pcksize |= (count << SAMD21_USB_DESC_PCKSIZE_BYTE_COUNT);
samd21_usb_desc[ep].bank[bank].pcksize = pcksize;
}
Expand Down Expand Up @@ -1252,6 +1253,7 @@ static inline void
samd21_usb_ep_set_ready(uint8_t ep, uint8_t bank)
{
samd21_usb.ep[ep].epstatusset = (1 << (SAMD21_USB_EP_EPSTATUS_BK0RDY + bank));
samd21_usb.ep[ep].epintflag = (1 << (SAMD21_USB_EP_EPINTFLAG_TRFAIL0 + bank));
}

static inline void
Expand Down Expand Up @@ -1457,6 +1459,8 @@ extern struct samd21_systick samd21_systick;
#define SAMD21_SYSTICK_CSR_CLKSOURCE_HCLK_8 1
#define SAMD21_SYSTICK_CSR_COUNTFLAG 16

#define SAMD21_SYSTICK_PRI 15

/* The NVIC starts at 0xe000e100, so add that to the offsets to find the absolute address */

struct samd21_nvic {
Expand Down

0 comments on commit 613b52f

Please sign in to comment.