summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2019-11-28 11:56:35 +0700
committerhathach <[email protected]>2019-11-28 11:56:35 +0700
commit552cc3ef33aee21eba3ea60ad07c461181eeaa58 (patch)
tree54934a7eec2e65f6e50f46d910b1b74cea39a205
parent5dc04887e28314c1d74409939af66445ce9626ae (diff)
implement dcd_edpt_stall
-rw-r--r--src/portable/microchip/samg/dcd_samg.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/portable/microchip/samg/dcd_samg.c b/src/portable/microchip/samg/dcd_samg.c
index bf842eab3..1d2e150d5 100644
--- a/src/portable/microchip/samg/dcd_samg.c
+++ b/src/portable/microchip/samg/dcd_samg.c
@@ -215,7 +215,12 @@ bool dcd_edpt_xfer (uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t
void dcd_edpt_stall (uint8_t rhport, uint8_t ep_addr)
{
(void) rhport;
- (void) ep_addr;
+
+ uint8_t const epnum = tu_edpt_number(ep_addr);
+// uint8_t const dir = tu_edpt_dir(ep_addr);
+
+ // Set force stall bit
+ UDP->UDP_CSR[epnum] |= UDP_CSR_FORCESTALL_Msk;
}
// clear stall, data toggle is also reset to DATA0
@@ -302,6 +307,12 @@ void dcd_isr(uint8_t rhport)
// Clear DATA Bank0 bit
UDP->UDP_CSR[0] &= ~UDP_CSR_RX_DATA_BK0_Msk;
}
+
+ // Stall sent to host
+ if (UDP->UDP_CSR[epnum] & UDP_CSR_STALLSENT_Msk)
+ {
+ UDP->UDP_CSR[0] &= ~UDP_CSR_STALLSENT_Msk;
+ }
}
}