You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/03/08 03:51:21 UTC

[incubator-nuttx] 01/03: arch: cxd56xx: Fix cxd56_usbdev.c for SMP

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 197187d8267e1c72dd230bc46390192cf47270c3
Author: Masayuki Ishikawa <ma...@gmail.com>
AuthorDate: Fri Mar 5 08:58:49 2021 +0900

    arch: cxd56xx: Fix cxd56_usbdev.c for SMP
    
    Summary:
    - This commit fixes hardfault when running nxplayer with rndis_smp
    
    Impact:
    - SMP only
    
    Testing:
    - Tested with rndis_smp
    
    Signed-off-by: Masayuki Ishikawa <Ma...@jp.sony.com>
---
 arch/arm/src/cxd56xx/cxd56_usbdev.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/arch/arm/src/cxd56xx/cxd56_usbdev.c b/arch/arm/src/cxd56xx/cxd56_usbdev.c
index 8a96636..a0e70fd 100644
--- a/arch/arm/src/cxd56xx/cxd56_usbdev.c
+++ b/arch/arm/src/cxd56xx/cxd56_usbdev.c
@@ -1540,6 +1540,10 @@ static int cxd56_epinterrupt(int irq, FAR void *context)
   uint16_t len;
   int n;
 
+#ifdef CONFIG_SMP
+  irqstate_t flags = enter_critical_section();
+#endif
+
   eps = getreg32(CXD56_USB_DEV_EP_INTR);
     {
       for (n = 0; n < CXD56_NENDPOINTS; n++)
@@ -1813,6 +1817,10 @@ static int cxd56_epinterrupt(int irq, FAR void *context)
         }
     }
 
+#ifdef CONFIG_SMP
+  leave_critical_section(flags);
+#endif
+
   return OK;
 }
 
@@ -2585,6 +2593,10 @@ static int cxd56_epstall(FAR struct usbdev_ep_s *ep, bool resume)
   uint32_t ctrl;
   uint32_t addr;
 
+#ifdef CONFIG_SMP
+  irqstate_t flags = enter_critical_section();
+#endif
+
   addr = USB_ISEPIN(ep->eplog) ? CXD56_USB_IN_EP_CONTROL(privep->epphy)
                                : CXD56_USB_OUT_EP_CONTROL(privep->epphy);
 
@@ -2603,6 +2615,10 @@ static int cxd56_epstall(FAR struct usbdev_ep_s *ep, bool resume)
       privep->stalled = 1;
     }
 
+#ifdef CONFIG_SMP
+  leave_critical_section(flags);
+#endif
+
   return OK;
 }