summaryrefslogtreecommitdiff
path: root/uLan/ports/os/rtems/arch/sys_arch.c
diff options
context:
space:
mode:
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)