summaryrefslogtreecommitdiffstats
path: root/uLan/ports/os/rtems/arch/sys_arch.c
diff options
context:
space:
mode:
authorKinsey Moore <kinsey.moore@oarcorp.com>2022-06-16 13:32:21 -0500
committerKinsey Moore <kinsey.moore@oarcorp.com>2022-07-12 08:41:46 -0500
commitc3b8ce71c4897be9984e555d8f1042e273edaa35 (patch)
tree5d0960badf954c4dc9dd6e34736652a754091042 /uLan/ports/os/rtems/arch/sys_arch.c
parenttelnetd01: Break out network startup (diff)
downloadrtems-lwip-c3b8ce71c4897be9984e555d8f1042e273edaa35.tar.bz2
lwip: Add support for SMP systems
For BSPs that support SMP, the sys_arch_protect and sys_arch_unprotect calls must use a global mutex instead of a local CPU interrupt disable to protect critical sections.
Diffstat (limited to 'uLan/ports/os/rtems/arch/sys_arch.c')
-rw-r--r--uLan/ports/os/rtems/arch/sys_arch.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/uLan/ports/os/rtems/arch/sys_arch.c b/uLan/ports/os/rtems/arch/sys_arch.c
index fa344a1..3a454b8 100644
--- a/uLan/ports/os/rtems/arch/sys_arch.c
+++ b/uLan/ports/os/rtems/arch/sys_arch.c
@@ -57,6 +57,14 @@ sys_now()
return temp;
}
+#ifdef __rtems__
+#if RTEMS_SMP
+#include <rtems/thread.h>
+rtems_recursive_mutex sys_arch_lock =
+ RTEMS_RECURSIVE_MUTEX_INITIALIZER( "LWIP System Protection Lock" );
+#endif
+#endif
+
void
sys_init(void)
{
@@ -366,14 +374,24 @@ sys_arch_protect()
{
sys_prot_t pval;
+#if RTEMS_SMP
+ pval = _Thread_Dispatch_disable();
+ rtems_recursive_mutex_lock( &sys_arch_lock );
+#else
rtems_interrupt_disable(pval);
+#endif
return pval;
}
void
sys_arch_unprotect(sys_prot_t pval)
{
+#if RTEMS_SMP
+ rtems_recursive_mutex_unlock( &sys_arch_lock );
+ _Thread_Dispatch_enable(pval);
+#else
rtems_interrupt_enable(pval);
+#endif
}
err_t
sys_mbox_trypost_fromisr(sys_mbox_t *q, void *msg)