<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr"><div>Hi Ning,</div><div>Patch 1 looks good. Instead of renaming it, you can include bcm2711.h in the RPi4's raspberrypi.h or in bsp.h so that the RPi4 BSP remains largely unchanged.</div><div><br></div><div>Kinsey<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 10, 2024 at 2:14 AM <a href="mailto:yangn0@qq.com">yangn0@qq.com</a> <<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"><div class="msg8436494677384214457">




<div dir="ltr">
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Hi Mr. Kinsey Moore,</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Thank you very much for your help.</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
I just sent patch 1. And about patch2, I have a question:</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
In shared/dev/clock/bcm2835-system-timer.c:</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
#if RTEMS_BSP == raspberrypi4b</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
#include <bsp/bcm2711.h></div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
#else</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
#include <bsp/raspberrypi.h></div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
#endif /* RTEMS_BSP */</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Do I need to rename bcm2711.h in rpi4 BSP to raspberrypi.h, this will modify many files in rpi4 BSP.</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Best regards,</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Ning</div>
<hr style="display:inline-block;width:98%">
<div style="direction:ltr;font-family:Calibri,sans-serif;font-size:11pt;color:rgb(0,0,0)">
<b>From:</b> Kinsey Moore <<a href="mailto:kinsey.moore@oarcorp.com" target="_blank">kinsey.moore@oarcorp.com</a>><br>
<b>Sent:</b> Tuesday, April 9, 2024 11:10<br>
<b>To:</b> Ning Yang <<a href="mailto:yangn0@qq.com" target="_blank">yangn0@qq.com</a>><br>
<b>Cc:</b> <a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a> <<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a>><br>
<b>Subject:</b> Re: [PATCH 1/2] dev/clock: Move bcm2835-system-timer driver to shared space</div>
<div style="direction:ltr"> </div>
<div style="direction:ltr">One comment inline below.</div>
<div style="direction:ltr"><br>
</div>
<div style="direction:ltr">On Tue, Apr 9, 2024 at 10:02 AM Ning Yang <<a href="mailto:yangn0@qq.com" id="m_8436494677384214457OWA1d95e4fb-f37a-b265-2800-08e09ee212b3" target="_blank">yangn0@qq.com</a>> wrote:</div>
<blockquote style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left:1px solid rgb(204,204,204)">
<div style="direction:ltr">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>
+</div>
</blockquote>
<div style="direction:ltr"><br>
</div>
<div style="direction:ltr">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 style="direction:ltr"><br>
</div>
<blockquote style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left:1px solid rgb(204,204,204)">
<div style="direction:ltr"> #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" id="m_8436494677384214457OWAb9a482bd-335c-d2c3-12ca-6b98b8ecbc4b" target="_blank">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" id="m_8436494677384214457OWA82274851-87d2-f370-e363-74b09dc4959a" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a></div>
</blockquote>
</div>

_______________________________________________<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></div></blockquote></div></div>