summaryrefslogtreecommitdiff
path: root/src/portable/synopsys
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2025-11-20 14:17:13 +0700
committerGitHub <[email protected]>2025-11-20 14:17:13 +0700
commit409c19364b3be723b26b013efa5ab3ec1d17435a (patch)
treeec06dc2164823297b2be8eeb7276d054ed4cda62 /src/portable/synopsys
parent3af1bec1a9161ee8dec29487831f7ac7ade9e189 (diff)
parentcea86617f75804ad9347c0b9686c102db555d4b7 (diff)
Merge pull request #3313 from hathach/copilot/fix-dcd-edpt-xfer-issue
Add is_isr parameter to dcd_edpt_xfer, dcd_edpt_xfer_fifo, usbd_edpt_xfer, and usbd_edpt_xfer_fifo functions
Diffstat (limited to 'src/portable/synopsys')
-rw-r--r--src/portable/synopsys/dwc2/dcd_dwc2.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/portable/synopsys/dwc2/dcd_dwc2.c b/src/portable/synopsys/dwc2/dcd_dwc2.c
index 53b6821fa..e99cd29c6 100644
--- a/src/portable/synopsys/dwc2/dcd_dwc2.c
+++ b/src/portable/synopsys/dwc2/dcd_dwc2.c
@@ -515,7 +515,7 @@ void dcd_set_address(uint8_t rhport, uint8_t dev_addr) {
dwc2->dcfg = (dwc2->dcfg & ~DCFG_DAD_Msk) | (dev_addr << DCFG_DAD_Pos);
// Response with status after changing device address
- dcd_edpt_xfer(rhport, tu_edpt_addr(0, TUSB_DIR_IN), NULL, 0);
+ dcd_edpt_xfer(rhport, tu_edpt_addr(0, TUSB_DIR_IN), NULL, 0, false);
}
void dcd_remote_wakeup(uint8_t rhport) {
@@ -636,13 +636,14 @@ bool dcd_edpt_iso_activate(uint8_t rhport, tusb_desc_endpoint_t const * p_endpo
return true;
}
-bool dcd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t* buffer, uint16_t total_bytes) {
+bool dcd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t* buffer, uint16_t total_bytes, bool is_isr) {
+ (void) is_isr;
uint8_t const epnum = tu_edpt_number(ep_addr);
uint8_t const dir = tu_edpt_dir(ep_addr);
xfer_ctl_t* xfer = XFER_CTL_BASE(epnum, dir);
bool ret;
- usbd_spin_lock(false);
+ usbd_spin_lock(is_isr);
if (xfer->max_size == 0) {
ret = false; // Endpoint is closed
@@ -662,7 +663,7 @@ bool dcd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t* buffer, uint16_t to
ret = true;
}
- usbd_spin_unlock(false);
+ usbd_spin_unlock(is_isr);
return ret;
}
@@ -671,7 +672,8 @@ bool dcd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t* buffer, uint16_t to
// bytes should be written and second to keep the return value free to give back a boolean
// success message. If total_bytes is too big, the FIFO will copy only what is available
// into the USB buffer!
-bool dcd_edpt_xfer_fifo(uint8_t rhport, uint8_t ep_addr, tu_fifo_t* ff, uint16_t total_bytes) {
+bool dcd_edpt_xfer_fifo(uint8_t rhport, uint8_t ep_addr, tu_fifo_t* ff, uint16_t total_bytes, bool is_isr) {
+ (void) is_isr;
// USB buffers always work in bytes so to avoid unnecessary divisions we demand item_size = 1
TU_ASSERT(ff->item_size == 1);
@@ -680,7 +682,7 @@ bool dcd_edpt_xfer_fifo(uint8_t rhport, uint8_t ep_addr, tu_fifo_t* ff, uint16_t
xfer_ctl_t* xfer = XFER_CTL_BASE(epnum, dir);
bool ret;
- usbd_spin_lock(false);
+ usbd_spin_lock(is_isr);
if (xfer->max_size == 0) {
ret = false; // Endpoint is closed
@@ -696,7 +698,7 @@ bool dcd_edpt_xfer_fifo(uint8_t rhport, uint8_t ep_addr, tu_fifo_t* ff, uint16_t
ret = true;
}
- usbd_spin_unlock(false);
+ usbd_spin_unlock(is_isr);
return ret;
}