[PATCH rtems-lwip 1/2] rtemslwip: Clean up __rtems__ ifdefs

Kinsey Moore kinsey.moore at oarcorp.com
Mon Jan 22 19:47:27 UTC 2024


Remove and simplify __rtems__ ifdefs in files that are now
authoritatively owned by rtems-lwip.
---
 rtemslwip/common/sys_arch.c             |  8 --------
 rtemslwip/include/arch/sys_arch.h       | 21 ---------------------
 rtemslwip/tms570/include/phy_dp83848h.h |  2 --
 rtemslwip/tms570/phy_dp83848h.c         |  2 --
 rtemslwip/tms570/tms570_netif.c         |  2 --
 5 files changed, 35 deletions(-)

diff --git a/rtemslwip/common/sys_arch.c b/rtemslwip/common/sys_arch.c
index b97404c..cfb25fd 100644
--- a/rtemslwip/common/sys_arch.c
+++ b/rtemslwip/common/sys_arch.c
@@ -57,13 +57,11 @@ 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)
@@ -277,11 +275,7 @@ sys_thread_new(const char *name, lwip_thread_fn function, void *arg, int stack_s
   rtems_status_code res;
 
   res = rtems_task_create(
-#ifdef __rtems__
     rtems_build_name(name[0], name[1], name[2], name[3]),
-#else
-    rtems_build_name('L', 'W', 'I', 'P'),
-#endif
     prio,
     stack_size,
     RTEMS_PREEMPT,
@@ -368,7 +362,6 @@ sys_request_irq(unsigned int irqnum, sys_irq_handler_t handler,
   return (res != RTEMS_SUCCESSFUL) ? -1 : 0;
 }
 
-#ifdef __rtems__
 sys_prot_t
 sys_arch_protect()
 {
@@ -396,4 +389,3 @@ sys_mbox_trypost_fromisr(sys_mbox_t *q, void *msg)
 {
   return sys_mbox_trypost(q, msg);
 }
-#endif
diff --git a/rtemslwip/include/arch/sys_arch.h b/rtemslwip/include/arch/sys_arch.h
index b602127..5fbdc73 100644
--- a/rtemslwip/include/arch/sys_arch.h
+++ b/rtemslwip/include/arch/sys_arch.h
@@ -68,16 +68,12 @@ typedef port_mailbox_t sys_mbox_t;
 typedef port_sem_t sys_sem_t;
 typedef rtems_id sys_thread_t;
 typedef port_mutex_t sys_mutex_t;
-#ifdef __rtems__
 #include <rtems/score/threaddispatch.h>
 #ifdef RTEMS_SMP
 typedef Per_CPU_Control *sys_prot_t;
 #else
 typedef rtems_interrupt_level sys_prot_t;
 #endif
-#else
-typedef rtems_interrupt_level sys_prot_t;
-#endif
 
 void
 sys_arch_delay(unsigned int x);
@@ -109,26 +105,9 @@ sys_arch_unmask_interrupt_source(unsigned int x)
   bsp_interrupt_vector_enable(x);
 }
 
-#ifndef __rtems__
-static inline sys_prot_t
-sys_arch_protect(void)
-{
-  sys_prot_t pval;
-
-  rtems_interrupt_disable(pval);
-  return pval;
-}
-
-static inline void
-sys_arch_unprotect(sys_prot_t pval)
-{
-  rtems_interrupt_enable(pval);
-}
-#else
 sys_prot_t sys_arch_protect();
 
 void sys_arch_unprotect(sys_prot_t pval);
-#endif
 
 static inline void
 sys_arch_data_sync_barier(void)
diff --git a/rtemslwip/tms570/include/phy_dp83848h.h b/rtemslwip/tms570/include/phy_dp83848h.h
index d45ecc5..8ddb3ec 100644
--- a/rtemslwip/tms570/include/phy_dp83848h.h
+++ b/rtemslwip/tms570/include/phy_dp83848h.h
@@ -35,9 +35,7 @@
 #ifndef __DRV_PHY_H
 #define __DRV_PHY_H
 
-#ifdef __rtems__
 #include <bsp/ti_herc/reg_mdio.h>
-#endif /* __rtems__ */
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/rtemslwip/tms570/phy_dp83848h.c b/rtemslwip/tms570/phy_dp83848h.c
index 91516bf..dec1011 100644
--- a/rtemslwip/tms570/phy_dp83848h.c
+++ b/rtemslwip/tms570/phy_dp83848h.c
@@ -34,9 +34,7 @@
 
 #include "ti_drv_mdio.h"
 #include "phy_dp83848h.h"
-#ifdef __rtems__
 #include "mdio.h"
-#endif /* __rtems__ */
 
 #ifndef TRUE
 /**
diff --git a/rtemslwip/tms570/tms570_netif.c b/rtemslwip/tms570/tms570_netif.c
index 8d14687..45ed3f0 100644
--- a/rtemslwip/tms570/tms570_netif.c
+++ b/rtemslwip/tms570/tms570_netif.c
@@ -330,7 +330,6 @@ tms570_eth_init_find_PHY(struct tms570_netif_state *nf_state)
 static void
 tms570_eth_init_set_pinmux(void)
 {
-#if defined(__rtems__)
   TMS570_IOMM.KICK_REG0 = 0x83E70B13U;
   TMS570_IOMM.KICK_REG1 = 0x95A4F1E0U;
 
@@ -355,7 +354,6 @@ tms570_eth_init_set_pinmux(void)
 
   TMS570_IOMM.KICK_REG0 = 0;
   TMS570_IOMM.KICK_REG1 = 0;
-#endif /*__rtems__*/
 }
 
 static err_t
-- 
2.39.2



More information about the devel mailing list