<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr"><div dir="ltr">One comment inline below.<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 9, 2024 at 10:02 AM Ning Yang <<a href="mailto:yangn0@qq.com">yangn0@qq.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This patch moves the bcm2835 system timer driver in the arm/raspberrypi directory to the shared directory.<br>
<br>
Made some changes in the include section to adapt to rpi4 BSP.<br>
---<br>
 .../clockdrv.c => shared/dev/clock/bcm2835-system-timer.c} | 7 +++++++<br>
 spec/build/bsps/arm/raspberrypi/obj.yml                    | 2 +-<br>
 2 files changed, 8 insertions(+), 1 deletion(-)<br>
 rename bsps/{arm/raspberrypi/clock/clockdrv.c => shared/dev/clock/bcm2835-system-timer.c} (95%)<br>
<br>
diff --git a/bsps/arm/raspberrypi/clock/clockdrv.c b/bsps/shared/dev/clock/bcm2835-system-timer.c<br>
similarity index 95%<br>
rename from bsps/arm/raspberrypi/clock/clockdrv.c<br>
rename to bsps/shared/dev/clock/bcm2835-system-timer.c<br>
index 8d220d51ba..2725735860 100644<br>
--- a/bsps/arm/raspberrypi/clock/clockdrv.c<br>
+++ b/bsps/shared/dev/clock/bcm2835-system-timer.c<br>
@@ -22,7 +22,14 @@<br>
 #include <bsp.h><br>
 #include <bsp/irq.h><br>
 #include <bsp/irq-generic.h><br>
+<br>
+#if RTEMS_BSP == raspberrypi4b<br>
+#include <bsp/bcm2711.h><br>
+#define BCM2835_REG(addr)          *(volatile uint32_t*)(addr)<br>
+#else<br>
 #include <bsp/raspberrypi.h><br>
+#endif /* RTEMS_BSP */<br>
+<br></blockquote><div><br></div><div>This change should really be in patch 2, but there is another issue with this change. This pattern is not used in existing code that I could find because it's fragile and introduces BSP-specific code into a shared driver that will need to be updated for every single BSP that eventually wants to use it. Either the RPi4 BSP should define BCM2835_REG as a 32bit register access for compatibility or this driver should have its register accesses renamed to something more generic such as PI32_REG which the RPi3 and RPi4 BSPs can provide for usage with this driver.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
 #include <rtems/timecounter.h><br>
<br>
 /* This is defined in ../../../shared/dev/clock/clockimpl.h */<br>
diff --git a/spec/build/bsps/arm/raspberrypi/obj.yml b/spec/build/bsps/arm/raspberrypi/obj.yml<br>
index ec5c82a8fb..ea370829df 100644<br>
--- a/spec/build/bsps/arm/raspberrypi/obj.yml<br>
+++ b/spec/build/bsps/arm/raspberrypi/obj.yml<br>
@@ -26,7 +26,6 @@ install:<br>
   - bsps/arm/raspberrypi/include/bsp/vc.h<br>
 links: []<br>
 source:<br>
-- bsps/arm/raspberrypi/clock/clockdrv.c<br>
 - bsps/arm/raspberrypi/console/console-config.c<br>
 - bsps/arm/raspberrypi/console/fb.c<br>
 - bsps/arm/raspberrypi/console/fbcons.c<br>
@@ -47,6 +46,7 @@ source:<br>
 - bsps/arm/shared/cp15/arm-cp15-set-exception-handler.c<br>
 - bsps/arm/shared/cp15/arm-cp15-set-ttb-entries.c<br>
 - bsps/arm/shared/start/bsp-start-memcpy.S<br>
+- bsps/shared/dev/clock/bcm2835-system-timer.c<br>
 - bsps/shared/dev/cpucounter/cpucounterfrequency.c<br>
 - bsps/shared/dev/cpucounter/cpucounterread.c<br>
 - bsps/shared/dev/getentropy/getentropy-cpucounter.c<br>
-- <br>
2.34.1<br>
<br>
_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
</blockquote></div></div>