[PATCH] bsps/aarch64/raspberrypi: Add system timer support

2024-04-16 Thread Ning Yang
The clock from the ARM timer is derived from the system clock. This clock can 
change dynamically e.g. if the system goes into reduced power or in low power 
mode. Thus the clock speed adapts to the overall system performance 
capabilities. For accurate timing it is recommended to use the system timers.

if BSP_CLOCK_USE_SYSTEMTIMER = 1, use the System Timer, otherwise use the ARM 
Timer.
---
 bsps/aarch64/raspberrypi/include/bsp/irq.h| 14 ++---
 .../raspberrypi/include/bsp/raspberrypi.h |  9 ++
 spec/build/bsps/aarch64/grp.yml   |  3 --
 .../aarch64/raspberrypi/bspraspberrypi4.yml   |  6 ++--
 .../bsps/aarch64/raspberrypi/objclock.yml | 31 +++
 .../aarch64/raspberrypi/objsystemtimer.yml| 23 ++
 .../aarch64/raspberrypi/optsystemtimer.yml| 24 ++
 7 files changed, 100 insertions(+), 10 deletions(-)
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/objclock.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/objsystemtimer.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/optsystemtimer.yml

diff --git a/bsps/aarch64/raspberrypi/include/bsp/irq.h 
b/bsps/aarch64/raspberrypi/include/bsp/irq.h
index 1ff6ae80de..d493e83707 100644
--- a/bsps/aarch64/raspberrypi/include/bsp/irq.h
+++ b/bsps/aarch64/raspberrypi/include/bsp/irq.h
@@ -9,6 +9,7 @@
 /**
  * Copyright (c) 2013 Alan Cudmore
  * Copyright (c) 2022 Mohd Noor Aman
+ * Copyright (c) 2024 Ning Yang
  *
  *  The license and distribution terms for this file may be
  *  found in the file LICENSE in this distribution or at
@@ -33,15 +34,18 @@
  * @brief Interrupt support.
  */

-#define BCM2835_INTC_TOTAL_IRQ   (64 + 8)
+#define BCM2835_INTC_TOTAL_IRQ   216

 #define BCM2835_IRQ_SET1_MIN 0
 #define BCM2835_IRQ_SET2_MIN 32

-#define BCM2835_IRQ_ID_GPU_TIMER_M0  0
-#define BCM2835_IRQ_ID_GPU_TIMER_M1  1
-#define BCM2835_IRQ_ID_GPU_TIMER_M2  2
-#define BCM2835_IRQ_ID_GPU_TIMER_M3  3
+#define BCM2711_IRQ_VC_PERIPHERAL_BASE 96
+
+/* Interrupt Vectors: System Timer */
+#define BCM2835_IRQ_ID_GPU_TIMER_M0(BCM2711_IRQ_VC_PERIPHERAL_BASE + 0)
+#define BCM2835_IRQ_ID_GPU_TIMER_M1(BCM2711_IRQ_VC_PERIPHERAL_BASE + 1)
+#define BCM2835_IRQ_ID_GPU_TIMER_M2(BCM2711_IRQ_VC_PERIPHERAL_BASE + 2)
+#define BCM2835_IRQ_ID_GPU_TIMER_M3(BCM2711_IRQ_VC_PERIPHERAL_BASE + 3)

 #define BCM2835_IRQ_ID_USB   9
 #define BCM2835_IRQ_ID_AUX   29
diff --git a/bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h 
b/bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
index 55dd9ed1e9..f185d1df57 100644
--- a/bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
+++ b/bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
@@ -8,6 +8,7 @@

 /*
  *  Copyright (c) 2022 Mohd Noor Aman
+ *  Copyright (c) 2024 Ning Yang
  *
  *  The license and distribution terms for this file may be
  *  found in the file LICENSE in this distribution or at
@@ -44,6 +45,7 @@

 #define BCM2711_REG(x)   (*(volatile uint64_t *)(x))
 #define BCM2711_BIT(n)   (1 << (n))
+#define BCM2835_REG(addr)(*(volatile uint32_t*)(addr))

 /** @} */

@@ -198,6 +200,13 @@
 #define BCM2711_GPU_TIMER_C2 (BCM2711_GPU_TIMER_BASE + 0x14)
 #define BCM2711_GPU_TIMER_C3 (BCM2711_GPU_TIMER_BASE + 0x18)

+/**
+ * NOTE: compatible with the BCM2835 system timer
+ */
+#define BCM2835_GPU_TIMER_CS_M3  BCM2711_GPU_TIMER_CS_M3
+#define BCM2835_GPU_TIMER_C3 BCM2711_GPU_TIMER_C3
+#define BCM2835_GPU_TIMER_CLOBCM2711_GPU_TIMER_CLO
+#define BCM2835_GPU_TIMER_CS BCM2711_GPU_TIMER_CS
 /** @} */

 /**
diff --git a/spec/build/bsps/aarch64/grp.yml b/spec/build/bsps/aarch64/grp.yml
index 9428fb9435..8f40a9952e 100644
--- a/spec/build/bsps/aarch64/grp.yml
+++ b/spec/build/bsps/aarch64/grp.yml
@@ -12,9 +12,6 @@ install:
   source:
   - bsps/aarch64/include/bsp/linker-symbols.h
   - bsps/aarch64/include/bsp/start.h
-- destination: ${BSP_INCLUDEDIR}/dev/clock
-  source:
-  - bsps/include/dev/clock/arm-generic-timer.h
 - destination: ${BSP_INCLUDEDIR}/dev/irq
   source:
   - bsps/aarch64/include/dev/irq/arm-gic-arch.h
diff --git a/spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml 
b/spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
index a579c094ba..7b6511a8cc 100644
--- a/spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
+++ b/spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
@@ -19,6 +19,10 @@ install:
   - bsps/aarch64/raspberrypi/include/bsp/irq.h
   - bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
 links:
+- role: build-dependency
+  uid: objclock
+- role: build-dependency
+  uid: objsystemtimer
 - role: build-dependency
   uid: ../grp
 - role: build-dependency
@@ -50,10 +54,8 @@ source:
 - bsps/aarch64/raspberrypi/start/bspstart.c
 - bsps/aarch64/raspberrypi/start/bspstarthooks.c
 - bsps/aarch64/raspberrypi/start/bspstartmmu.c
-- bsps/aarch64/shared/clock/arm-generic-timer-aarch64.c
 - bsps/aarch64/shared/cache/c

[PATCH] bsps/aarch64/raspberrypi: Add system timer support

2024-04-13 Thread Ning Yang
The clock from the ARM timer is derived from the system clock. This clock can 
change dynamically e.g. if the system goes into reduced power or in low power 
mode. Thus the clock speed adapts to the overall system performance 
capabilities. For accurate timing it is recommended to use the system timers.

if BSP_CLOCK_USE_SYSTEMTIMER = 1, use the System Timer, otherwise use the ARM 
Timer.
---
 bsps/aarch64/raspberrypi/include/bsp/irq.h| 14 ++---
 .../raspberrypi/include/bsp/raspberrypi.h |  9 ++
 spec/build/bsps/aarch64/grp.yml   |  3 --
 .../aarch64/raspberrypi/bspraspberrypi4.yml   |  6 ++--
 .../bsps/aarch64/raspberrypi/objclock.yml | 31 +++
 .../aarch64/raspberrypi/objsystemtimer.yml| 23 ++
 .../aarch64/raspberrypi/optsystemtimer.yml| 24 ++
 7 files changed, 100 insertions(+), 10 deletions(-)
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/objclock.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/objsystemtimer.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/optsystemtimer.yml

diff --git a/bsps/aarch64/raspberrypi/include/bsp/irq.h 
b/bsps/aarch64/raspberrypi/include/bsp/irq.h
index 1ff6ae80de..d493e83707 100644
--- a/bsps/aarch64/raspberrypi/include/bsp/irq.h
+++ b/bsps/aarch64/raspberrypi/include/bsp/irq.h
@@ -9,6 +9,7 @@
 /**
  * Copyright (c) 2013 Alan Cudmore
  * Copyright (c) 2022 Mohd Noor Aman
+ * Copyright (c) 2024 Ning Yang
  *
  *  The license and distribution terms for this file may be
  *  found in the file LICENSE in this distribution or at
@@ -33,15 +34,18 @@
  * @brief Interrupt support.
  */
 
-#define BCM2835_INTC_TOTAL_IRQ   (64 + 8)
+#define BCM2835_INTC_TOTAL_IRQ   216
 
 #define BCM2835_IRQ_SET1_MIN 0
 #define BCM2835_IRQ_SET2_MIN 32
 
-#define BCM2835_IRQ_ID_GPU_TIMER_M0  0
-#define BCM2835_IRQ_ID_GPU_TIMER_M1  1
-#define BCM2835_IRQ_ID_GPU_TIMER_M2  2
-#define BCM2835_IRQ_ID_GPU_TIMER_M3  3
+#define BCM2711_IRQ_VC_PERIPHERAL_BASE 96
+
+/* Interrupt Vectors: System Timer */
+#define BCM2835_IRQ_ID_GPU_TIMER_M0(BCM2711_IRQ_VC_PERIPHERAL_BASE + 0)
+#define BCM2835_IRQ_ID_GPU_TIMER_M1(BCM2711_IRQ_VC_PERIPHERAL_BASE + 1)
+#define BCM2835_IRQ_ID_GPU_TIMER_M2(BCM2711_IRQ_VC_PERIPHERAL_BASE + 2)
+#define BCM2835_IRQ_ID_GPU_TIMER_M3(BCM2711_IRQ_VC_PERIPHERAL_BASE + 3)
 
 #define BCM2835_IRQ_ID_USB   9
 #define BCM2835_IRQ_ID_AUX   29
diff --git a/bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h 
b/bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
index 55dd9ed1e9..f185d1df57 100644
--- a/bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
+++ b/bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
@@ -8,6 +8,7 @@
 
 /*
  *  Copyright (c) 2022 Mohd Noor Aman
+ *  Copyright (c) 2024 Ning Yang
  *
  *  The license and distribution terms for this file may be
  *  found in the file LICENSE in this distribution or at
@@ -44,6 +45,7 @@
 
 #define BCM2711_REG(x)   (*(volatile uint64_t *)(x))
 #define BCM2711_BIT(n)   (1 << (n))
+#define BCM2835_REG(addr)(*(volatile uint32_t*)(addr))
 
 /** @} */
 
@@ -198,6 +200,13 @@
 #define BCM2711_GPU_TIMER_C2 (BCM2711_GPU_TIMER_BASE + 0x14)
 #define BCM2711_GPU_TIMER_C3 (BCM2711_GPU_TIMER_BASE + 0x18)
 
+/**
+ * NOTE: compatible with the BCM2835 system timer
+ */
+#define BCM2835_GPU_TIMER_CS_M3  BCM2711_GPU_TIMER_CS_M3
+#define BCM2835_GPU_TIMER_C3 BCM2711_GPU_TIMER_C3
+#define BCM2835_GPU_TIMER_CLOBCM2711_GPU_TIMER_CLO
+#define BCM2835_GPU_TIMER_CS BCM2711_GPU_TIMER_CS
 /** @} */
 
 /**
diff --git a/spec/build/bsps/aarch64/grp.yml b/spec/build/bsps/aarch64/grp.yml
index 9428fb9435..8f40a9952e 100644
--- a/spec/build/bsps/aarch64/grp.yml
+++ b/spec/build/bsps/aarch64/grp.yml
@@ -12,9 +12,6 @@ install:
   source:
   - bsps/aarch64/include/bsp/linker-symbols.h
   - bsps/aarch64/include/bsp/start.h
-- destination: ${BSP_INCLUDEDIR}/dev/clock
-  source:
-  - bsps/include/dev/clock/arm-generic-timer.h
 - destination: ${BSP_INCLUDEDIR}/dev/irq
   source:
   - bsps/aarch64/include/dev/irq/arm-gic-arch.h
diff --git a/spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml 
b/spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
index a579c094ba..7b6511a8cc 100644
--- a/spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
+++ b/spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
@@ -19,6 +19,10 @@ install:
   - bsps/aarch64/raspberrypi/include/bsp/irq.h
   - bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
 links:
+- role: build-dependency
+  uid: objclock
+- role: build-dependency
+  uid: objsystemtimer
 - role: build-dependency
   uid: ../grp
 - role: build-dependency
@@ -50,10 +54,8 @@ source:
 - bsps/aarch64/raspberrypi/start/bspstart.c
 - bsps/aarch64/raspberrypi/start/bspstarthooks.c
 - bsps/aarch64/raspberrypi/start/bspstartmmu.c
-- bsps/aarch64/shared/clock/arm-generic-timer-aarch64.c
 - bsps/aarch64/shared

[PATCH] bsps/aarch64/raspberrypi: Add system timer support

2024-04-13 Thread Ning Yang
The clock from the ARM timer is derived from the system clock. This clock can 
change dynamically e.g. if the system goes into reduced power or in low power 
mode. Thus the clock speed adapts to the overall system performance 
capabilities. For accurate timing it is recommended to use the system timers.

if BSP_CLOCK_USE_SYSTEMTIMER = 1, use the System Timer, otherwise use the ARM 
Timer.
---
 bsps/aarch64/raspberrypi/include/bsp/irq.h| 15 ++---
 .../raspberrypi/include/bsp/raspberrypi.h |  9 ++
 spec/build/bsps/aarch64/grp.yml   |  3 --
 .../aarch64/raspberrypi/bspraspberrypi4.yml   |  6 ++--
 .../bsps/aarch64/raspberrypi/objclock.yml | 31 +++
 .../aarch64/raspberrypi/objsystemtimer.yml| 23 ++
 .../aarch64/raspberrypi/optsystemtimer.yml| 24 ++
 7 files changed, 101 insertions(+), 10 deletions(-)
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/objclock.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/objsystemtimer.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/optsystemtimer.yml

diff --git a/bsps/aarch64/raspberrypi/include/bsp/irq.h 
b/bsps/aarch64/raspberrypi/include/bsp/irq.h
index 1ff6ae80de..f2dd2f6c14 100644
--- a/bsps/aarch64/raspberrypi/include/bsp/irq.h
+++ b/bsps/aarch64/raspberrypi/include/bsp/irq.h
@@ -9,6 +9,7 @@
 /**
  * Copyright (c) 2013 Alan Cudmore
  * Copyright (c) 2022 Mohd Noor Aman
+ * Copyright (c) 2024 Ning Yang
  *
  *  The license and distribution terms for this file may be
  *  found in the file LICENSE in this distribution or at
@@ -24,6 +25,7 @@
 
 #include 
 #include 
+#include 
 
 /**
  * @defgroup raspberrypi_interrupt Interrrupt Support
@@ -33,15 +35,18 @@
  * @brief Interrupt support.
  */
 
-#define BCM2835_INTC_TOTAL_IRQ   (64 + 8)
+#define BCM2835_INTC_TOTAL_IRQ   216
 
 #define BCM2835_IRQ_SET1_MIN 0
 #define BCM2835_IRQ_SET2_MIN 32
 
-#define BCM2835_IRQ_ID_GPU_TIMER_M0  0
-#define BCM2835_IRQ_ID_GPU_TIMER_M1  1
-#define BCM2835_IRQ_ID_GPU_TIMER_M2  2
-#define BCM2835_IRQ_ID_GPU_TIMER_M3  3
+#define BCM2711_IRQ_VC_PERIPHERAL_BASE 96
+
+/* Interrupt Vectors: System Timer */
+#define BCM2835_IRQ_ID_GPU_TIMER_M0(BCM2711_IRQ_VC_PERIPHERAL_BASE + 0)
+#define BCM2835_IRQ_ID_GPU_TIMER_M1(BCM2711_IRQ_VC_PERIPHERAL_BASE + 1)
+#define BCM2835_IRQ_ID_GPU_TIMER_M2(BCM2711_IRQ_VC_PERIPHERAL_BASE + 2)
+#define BCM2835_IRQ_ID_GPU_TIMER_M3(BCM2711_IRQ_VC_PERIPHERAL_BASE + 3)
 
 #define BCM2835_IRQ_ID_USB   9
 #define BCM2835_IRQ_ID_AUX   29
diff --git a/bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h 
b/bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
index 55dd9ed1e9..f185d1df57 100644
--- a/bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
+++ b/bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
@@ -8,6 +8,7 @@
 
 /*
  *  Copyright (c) 2022 Mohd Noor Aman
+ *  Copyright (c) 2024 Ning Yang
  *
  *  The license and distribution terms for this file may be
  *  found in the file LICENSE in this distribution or at
@@ -44,6 +45,7 @@
 
 #define BCM2711_REG(x)   (*(volatile uint64_t *)(x))
 #define BCM2711_BIT(n)   (1 << (n))
+#define BCM2835_REG(addr)(*(volatile uint32_t*)(addr))
 
 /** @} */
 
@@ -198,6 +200,13 @@
 #define BCM2711_GPU_TIMER_C2 (BCM2711_GPU_TIMER_BASE + 0x14)
 #define BCM2711_GPU_TIMER_C3 (BCM2711_GPU_TIMER_BASE + 0x18)
 
+/**
+ * NOTE: compatible with the BCM2835 system timer
+ */
+#define BCM2835_GPU_TIMER_CS_M3  BCM2711_GPU_TIMER_CS_M3
+#define BCM2835_GPU_TIMER_C3 BCM2711_GPU_TIMER_C3
+#define BCM2835_GPU_TIMER_CLOBCM2711_GPU_TIMER_CLO
+#define BCM2835_GPU_TIMER_CS BCM2711_GPU_TIMER_CS
 /** @} */
 
 /**
diff --git a/spec/build/bsps/aarch64/grp.yml b/spec/build/bsps/aarch64/grp.yml
index 9428fb9435..8f40a9952e 100644
--- a/spec/build/bsps/aarch64/grp.yml
+++ b/spec/build/bsps/aarch64/grp.yml
@@ -12,9 +12,6 @@ install:
   source:
   - bsps/aarch64/include/bsp/linker-symbols.h
   - bsps/aarch64/include/bsp/start.h
-- destination: ${BSP_INCLUDEDIR}/dev/clock
-  source:
-  - bsps/include/dev/clock/arm-generic-timer.h
 - destination: ${BSP_INCLUDEDIR}/dev/irq
   source:
   - bsps/aarch64/include/dev/irq/arm-gic-arch.h
diff --git a/spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml 
b/spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
index a579c094ba..7b6511a8cc 100644
--- a/spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
+++ b/spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
@@ -19,6 +19,10 @@ install:
   - bsps/aarch64/raspberrypi/include/bsp/irq.h
   - bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
 links:
+- role: build-dependency
+  uid: objclock
+- role: build-dependency
+  uid: objsystemtimer
 - role: build-dependency
   uid: ../grp
 - role: build-dependency
@@ -50,10 +54,8 @@ source:
 - bsps/aarch64/raspberrypi/start/bspstart.c
 - bsps/aarch64/raspberrypi/start/bspstarthooks.c
 - bsps/a

[PATCH] bsps/aarch64/raspberrypi: Add system timer support

2024-04-12 Thread Ning Yang
The clock from the ARM timer is derived from the system clock. This clock can 
change dynamically e.g. if the system goes into reduced power or in low power 
mode. Thus the clock speed adapts to the overall system performance 
capabilities. For accurate timing it is recommended to use the system timers.

if BSP_CLOCK_USE_SYSTEMTIMER = 1, use the System Timer, otherwise use the ARM 
Timer.
---
 bsps/aarch64/raspberrypi/include/bsp/irq.h| 15 ++---
 .../raspberrypi/include/bsp/raspberrypi.h | 28 +
 spec/build/bsps/aarch64/grp.yml   |  3 --
 .../aarch64/raspberrypi/bspraspberrypi4.yml   |  7 +++--
 .../bsps/aarch64/raspberrypi/objclock.yml | 31 +++
 .../aarch64/raspberrypi/objsystemtimer.yml| 23 ++
 .../aarch64/raspberrypi/optsystemtimer.yml| 24 ++
 7 files changed, 107 insertions(+), 24 deletions(-)
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/objclock.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/objsystemtimer.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/optsystemtimer.yml

diff --git a/bsps/aarch64/raspberrypi/include/bsp/irq.h 
b/bsps/aarch64/raspberrypi/include/bsp/irq.h
index 1ff6ae80de..f2dd2f6c14 100644
--- a/bsps/aarch64/raspberrypi/include/bsp/irq.h
+++ b/bsps/aarch64/raspberrypi/include/bsp/irq.h
@@ -9,6 +9,7 @@
 /**
  * Copyright (c) 2013 Alan Cudmore
  * Copyright (c) 2022 Mohd Noor Aman
+ * Copyright (c) 2024 Ning Yang
  *
  *  The license and distribution terms for this file may be
  *  found in the file LICENSE in this distribution or at
@@ -24,6 +25,7 @@
 
 #include 
 #include 
+#include 
 
 /**
  * @defgroup raspberrypi_interrupt Interrrupt Support
@@ -33,15 +35,18 @@
  * @brief Interrupt support.
  */
 
-#define BCM2835_INTC_TOTAL_IRQ   (64 + 8)
+#define BCM2835_INTC_TOTAL_IRQ   216
 
 #define BCM2835_IRQ_SET1_MIN 0
 #define BCM2835_IRQ_SET2_MIN 32
 
-#define BCM2835_IRQ_ID_GPU_TIMER_M0  0
-#define BCM2835_IRQ_ID_GPU_TIMER_M1  1
-#define BCM2835_IRQ_ID_GPU_TIMER_M2  2
-#define BCM2835_IRQ_ID_GPU_TIMER_M3  3
+#define BCM2711_IRQ_VC_PERIPHERAL_BASE 96
+
+/* Interrupt Vectors: System Timer */
+#define BCM2835_IRQ_ID_GPU_TIMER_M0(BCM2711_IRQ_VC_PERIPHERAL_BASE + 0)
+#define BCM2835_IRQ_ID_GPU_TIMER_M1(BCM2711_IRQ_VC_PERIPHERAL_BASE + 1)
+#define BCM2835_IRQ_ID_GPU_TIMER_M2(BCM2711_IRQ_VC_PERIPHERAL_BASE + 2)
+#define BCM2835_IRQ_ID_GPU_TIMER_M3(BCM2711_IRQ_VC_PERIPHERAL_BASE + 3)
 
 #define BCM2835_IRQ_ID_USB   9
 #define BCM2835_IRQ_ID_AUX   29
diff --git a/bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h 
b/bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
index 55dd9ed1e9..3d6a03c715 100644
--- a/bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
+++ b/bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
@@ -8,6 +8,7 @@
 
 /*
  *  Copyright (c) 2022 Mohd Noor Aman
+ *  Copyright (c) 2024 Ning Yang
  *
  *  The license and distribution terms for this file may be
  *  found in the file LICENSE in this distribution or at
@@ -44,6 +45,7 @@
 
 #define BCM2711_REG(x)   (*(volatile uint64_t *)(x))
 #define BCM2711_BIT(n)   (1 << (n))
+#define BCM2835_REG(addr)(*(volatile uint32_t*)(addr))
 
 /** @} */
 
@@ -184,19 +186,19 @@
  *   it's own RTOS. 1 and 3 are available for use in
  *   RTEMS.
  */
-#define BCM2711_GPU_TIMER_BASE   (RPI_PERIPHERAL_BASE + 0x3000)
-
-#define BCM2711_GPU_TIMER_CS (BCM2711_GPU_TIMER_BASE + 0x00)
-#define BCM2711_GPU_TIMER_CS_M0  0x0001
-#define BCM2711_GPU_TIMER_CS_M1  0x0002
-#define BCM2711_GPU_TIMER_CS_M2  0x0004
-#define BCM2711_GPU_TIMER_CS_M3  0x0008
-#define BCM2711_GPU_TIMER_CLO(BCM2711_GPU_TIMER_BASE + 0x04)
-#define BCM2711_GPU_TIMER_CHI(BCM2711_GPU_TIMER_BASE + 0x08)
-#define BCM2711_GPU_TIMER_C0 (BCM2711_GPU_TIMER_BASE + 0x0C)
-#define BCM2711_GPU_TIMER_C1 (BCM2711_GPU_TIMER_BASE + 0x10)
-#define BCM2711_GPU_TIMER_C2 (BCM2711_GPU_TIMER_BASE + 0x14)
-#define BCM2711_GPU_TIMER_C3 (BCM2711_GPU_TIMER_BASE + 0x18)
+#define BCM2835_GPU_TIMER_BASE   (RPI_PERIPHERAL_BASE + 0x3000)
+
+#define BCM2835_GPU_TIMER_CS (BCM2835_GPU_TIMER_BASE + 0x00)
+#define BCM2835_GPU_TIMER_CS_M0  0x0001
+#define BCM2835_GPU_TIMER_CS_M1  0x0002
+#define BCM2835_GPU_TIMER_CS_M2  0x0004
+#define BCM2835_GPU_TIMER_CS_M3  0x0008
+#define BCM2835_GPU_TIMER_CLO(BCM2835_GPU_TIMER_BASE + 0x04)
+#define BCM2835_GPU_TIMER_CHI(BCM2835_GPU_TIMER_BASE + 0x08)
+#define BCM2835_GPU_TIMER_C0 (BCM2835_GPU_TIMER_BASE + 0x0C)
+#define BCM2835_GPU_TIMER_C1 (BCM2835_GPU_TIMER_BASE + 0x10)
+#define BCM2835_GPU_TIMER_C2 (BCM2835_GPU_TIMER_BASE + 0x14)
+#define BCM2835_GPU_TIMER_C3 (BCM2835_GPU_TIMER_BASE + 0x18)
 
 /** @} */
 
diff --git a/spec/build/bsps/aarch64/grp.yml b/spec/build/bsps/aarch64/grp.yml

Re: [PATCH] bsps/aarch64/raspberrypi: Add system timer support

2024-04-11 Thread Ning Yang
Hi Mr. Kinsey Moore,

I will send the patch based on the current RTEMS master as soon as possible.

I am an applicant for GSOC2024 and will continue to improve RPi4 BSP the year. 
I'm currently working on debugging UART interrupt mode. Please let me know if 
there's anything I can do to help.

Best regards,

Ning

> 2024年4月12日 00:08,Kinsey Moore  写道:
> 
> Ah, that makes sense. If your patch depends on Utkarsh's work, then we'll 
> need to work on getting that into upstream RTEMS as well. If your patch can 
> be rebased on to current RTEMS master, that would be ideal.
> 
> Regarding Utkarsh's work not being merged into RTEMS, patches sometimes slip 
> through the cracks and fail to get the reviews they need to progress to a 
> point where they can be accepted into RTEMS. I'm actually working on Noor's 
> SMP patch for RPi4 (also one of last year's GSoC projects) right now to get 
> it into good condition for merging into RTEMS.
> 
> Kinsey
> 
> On Thu, Apr 11, 2024 at 10:59 AM Ning Yang  wrote:
> Hi Mr. Kinsey Moore:
> 
> I am using the RPi4 BSP (project of GSOC2023) written by Utkarsh Verma. For 
> some reason it wasn't merged.
> https://lists.rtems.org/pipermail/devel/2023-August/076152.html
> I got the code from his github: https://github.com/UtkarshVerma/rtems
> 
> Best regards,
> 
> Ning
> 
> > 2024年4月11日 23:22,Kinsey Moore  写道:
> > 
> > I couldn't get this patch to apply. Are you sure it came from the right 
> > branch and has no merge commits ahead of it?
> > 
> > Kinsey
> > 
> > On Wed, Apr 10, 2024 at 9:24 AM Ning Yang  wrote:
> > The clock from the ARM timer is derived from the system clock. This clock 
> > can change dynamically e.g. if the system goes into reduced power or in low 
> > power mode. Thus the clock speed adapts to the overall system performance 
> > capabilities. For accurate timing it is recommended to use the system 
> > timers.
> > 
> > if BSP_CLOCK_USE_SYSTEMTIMER = 1, use the System Timer, otherwise use the 
> > ARM Timer.
> > ---
> >  .../aarch64/raspberrypi/include/bsp/bcm2711.h | 28 
> >  .../raspberrypi/include/bsp/raspberrypi.h | 43 +++
> >  bsps/aarch64/raspberrypi/start/bspstartmmu.c  |  8 
> >  spec/build/bsps/aarch64/raspberrypi/bsp4b.yml |  1 +
> >  spec/build/bsps/aarch64/raspberrypi/obj.yml   |  3 ++
> >  .../bsps/aarch64/raspberrypi/objclock.yml |  4 +-
> >  .../aarch64/raspberrypi/objsystemtimer.yml| 22 ++
> >  .../aarch64/raspberrypi/optsystemtimer.yml| 24 +++
> >  8 files changed, 132 insertions(+), 1 deletion(-)
> >  create mode 100644 bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
> >  create mode 100644 spec/build/bsps/aarch64/raspberrypi/objsystemtimer.yml
> >  create mode 100644 spec/build/bsps/aarch64/raspberrypi/optsystemtimer.yml
> > 
> > diff --git a/bsps/aarch64/raspberrypi/include/bsp/bcm2711.h 
> > b/bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
> > index e6c77fa025..8707582ebb 100644
> > --- a/bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
> > +++ b/bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
> > @@ -11,6 +11,7 @@
> >  /*
> >   * Copyright (C) 2022 Mohd Noor Aman
> >   * Copyright (C) 2023 Utkarsh Verma
> > + * Copyright (C) 2024 Ning Yang
> >   *
> >   *
> >   * Redistribution and use in source and binary forms, with or without
> > @@ -91,6 +92,27 @@
> >  #define BCM2711_UART5_BASE (BCM2711_PL011_BASE + 0xa00)
> >  #define BCM2711_UART5_SIZE BCM2711_PL011_DEVICE_SIZE
> > 
> > +/* System Timer */
> > +/**
> > + * NOTE: The GPU uses Compare registers 0 and 2 for
> > + *   it's own RTOS. 1 and 3 are available for use in
> > + *   RTEMS.
> > + */
> > +#define BCM2835_GPU_TIMER_BASE(BCM2711_PERIPHERAL_BASE + 0x200+ 
> > 0x3000)
> > +#define BCM2835_GPU_TIMER_SIZE0x1C
> > +
> > +#define BCM2835_GPU_TIMER_CS  (BCM2835_GPU_TIMER_BASE + 0x00)
> > +#define BCM2835_GPU_TIMER_CS_M0   0x0001
> > +#define BCM2835_GPU_TIMER_CS_M1   0x0002
> > +#define BCM2835_GPU_TIMER_CS_M2   0x0004
> > +#define BCM2835_GPU_TIMER_CS_M3   0x0008
> > +#define BCM2835_GPU_TIMER_CLO (BCM2835_GPU_TIMER_BASE + 0x04)
> > +#define BCM2835_GPU_TIMER_CHI (BCM2835_GPU_TIMER_BASE + 0x08)
> > +#define BCM2835_GPU_TIMER_C0  (BCM2835_GPU_TIMER_BASE + 0x0C)
> > +#define BCM2835_GPU_TIMER_C1  (BCM2835_GPU_TIMER_BASE + 0x10)
> > +#define BCM2835_GPU_TIMER_C2  (BCM2835_GPU_TIMER_BASE + 0x14)
> > +#define BCM2835_GPU_TIMER_C3  (BCM2835_GPU_TIMER_BASE + 0x18)
>

Re: [PATCH] bsps/aarch64/raspberrypi: Add system timer support

2024-04-11 Thread Ning Yang
Hi Mr. Kinsey Moore:

I am using the RPi4 BSP (project of GSOC2023) written by Utkarsh Verma. For 
some reason it wasn't merged.
https://lists.rtems.org/pipermail/devel/2023-August/076152.html
I got the code from his github: https://github.com/UtkarshVerma/rtems

Best regards,

Ning

> 2024年4月11日 23:22,Kinsey Moore  写道:
> 
> I couldn't get this patch to apply. Are you sure it came from the right 
> branch and has no merge commits ahead of it?
> 
> Kinsey
> 
> On Wed, Apr 10, 2024 at 9:24 AM Ning Yang  wrote:
> The clock from the ARM timer is derived from the system clock. This clock can 
> change dynamically e.g. if the system goes into reduced power or in low power 
> mode. Thus the clock speed adapts to the overall system performance 
> capabilities. For accurate timing it is recommended to use the system timers.
> 
> if BSP_CLOCK_USE_SYSTEMTIMER = 1, use the System Timer, otherwise use the ARM 
> Timer.
> ---
>  .../aarch64/raspberrypi/include/bsp/bcm2711.h | 28 
>  .../raspberrypi/include/bsp/raspberrypi.h | 43 +++
>  bsps/aarch64/raspberrypi/start/bspstartmmu.c  |  8 
>  spec/build/bsps/aarch64/raspberrypi/bsp4b.yml |  1 +
>  spec/build/bsps/aarch64/raspberrypi/obj.yml   |  3 ++
>  .../bsps/aarch64/raspberrypi/objclock.yml |  4 +-
>  .../aarch64/raspberrypi/objsystemtimer.yml| 22 ++
>  .../aarch64/raspberrypi/optsystemtimer.yml| 24 +++
>  8 files changed, 132 insertions(+), 1 deletion(-)
>  create mode 100644 bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/objsystemtimer.yml
>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/optsystemtimer.yml
> 
> diff --git a/bsps/aarch64/raspberrypi/include/bsp/bcm2711.h 
> b/bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
> index e6c77fa025..8707582ebb 100644
> --- a/bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
> +++ b/bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
> @@ -11,6 +11,7 @@
>  /*
>   * Copyright (C) 2022 Mohd Noor Aman
>   * Copyright (C) 2023 Utkarsh Verma
> + * Copyright (C) 2024 Ning Yang
>   *
>   *
>   * Redistribution and use in source and binary forms, with or without
> @@ -91,6 +92,27 @@
>  #define BCM2711_UART5_BASE (BCM2711_PL011_BASE + 0xa00)
>  #define BCM2711_UART5_SIZE BCM2711_PL011_DEVICE_SIZE
> 
> +/* System Timer */
> +/**
> + * NOTE: The GPU uses Compare registers 0 and 2 for
> + *   it's own RTOS. 1 and 3 are available for use in
> + *   RTEMS.
> + */
> +#define BCM2835_GPU_TIMER_BASE(BCM2711_PERIPHERAL_BASE + 0x200+ 
> 0x3000)
> +#define BCM2835_GPU_TIMER_SIZE0x1C
> +
> +#define BCM2835_GPU_TIMER_CS  (BCM2835_GPU_TIMER_BASE + 0x00)
> +#define BCM2835_GPU_TIMER_CS_M0   0x0001
> +#define BCM2835_GPU_TIMER_CS_M1   0x0002
> +#define BCM2835_GPU_TIMER_CS_M2   0x0004
> +#define BCM2835_GPU_TIMER_CS_M3   0x0008
> +#define BCM2835_GPU_TIMER_CLO (BCM2835_GPU_TIMER_BASE + 0x04)
> +#define BCM2835_GPU_TIMER_CHI (BCM2835_GPU_TIMER_BASE + 0x08)
> +#define BCM2835_GPU_TIMER_C0  (BCM2835_GPU_TIMER_BASE + 0x0C)
> +#define BCM2835_GPU_TIMER_C1  (BCM2835_GPU_TIMER_BASE + 0x10)
> +#define BCM2835_GPU_TIMER_C2  (BCM2835_GPU_TIMER_BASE + 0x14)
> +#define BCM2835_GPU_TIMER_C3  (BCM2835_GPU_TIMER_BASE + 0x18)
> +
>  /* ARM Local */
>  #define BCM2711_ARM_LOCAL_BASE 0xff80LL
>  #define BCM2711_ARM_LOCAL_SIZE 0x80
> @@ -114,4 +136,10 @@
>  #define BCM2711_IRQ_AUX(BCM2711_IRQ_VC_PERIPHERAL_BASE + 29)
>  #define BCM2711_IRQ_PL011_UART (BCM2711_IRQ_VC_PERIPHERAL_BASE + 57)
> 
> +/* Interrupt Vectors: System Timer */
> +#define BCM2835_IRQ_ID_GPU_TIMER_M0(BCM2711_IRQ_VC_PERIPHERAL_BASE + 0)
> +#define BCM2835_IRQ_ID_GPU_TIMER_M1(BCM2711_IRQ_VC_PERIPHERAL_BASE + 1)
> +#define BCM2835_IRQ_ID_GPU_TIMER_M2(BCM2711_IRQ_VC_PERIPHERAL_BASE + 2)
> +#define BCM2835_IRQ_ID_GPU_TIMER_M3(BCM2711_IRQ_VC_PERIPHERAL_BASE + 3)
> +
>  #endif /* LIBBSP_AARCH64_RASPBERRYPI_BSP_BCM2711_H */
> diff --git a/bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h 
> b/bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
> new file mode 100644
> index 00..2e1c673bfb
> --- /dev/null
> +++ b/bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
> @@ -0,0 +1,43 @@
> +/* SPDX-License-Identifier: BSD-2-Clause */
> +
> +/**
> + * @file
> + *
> + * @ingroup RTEMSBSPsAArch64RaspberryPi
> + *
> + * @brief RaspberryPi shared Register Definitions
> + */
> +
> +/*
> + * Copyright (C) 2024 Ning Yang
> + *
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the followin

[PATCH] bsps/aarch64/raspberrypi: Add system timer support

2024-04-10 Thread Ning Yang
The clock from the ARM timer is derived from the system clock. This clock can 
change dynamically e.g. if the system goes into reduced power or in low power 
mode. Thus the clock speed adapts to the overall system performance 
capabilities. For accurate timing it is recommended to use the system timers.

if BSP_CLOCK_USE_SYSTEMTIMER = 1, use the System Timer, otherwise use the ARM 
Timer.
---
 .../aarch64/raspberrypi/include/bsp/bcm2711.h | 28 
 .../raspberrypi/include/bsp/raspberrypi.h | 43 +++
 bsps/aarch64/raspberrypi/start/bspstartmmu.c  |  8 
 spec/build/bsps/aarch64/raspberrypi/bsp4b.yml |  1 +
 spec/build/bsps/aarch64/raspberrypi/obj.yml   |  3 ++
 .../bsps/aarch64/raspberrypi/objclock.yml |  4 +-
 .../aarch64/raspberrypi/objsystemtimer.yml| 22 ++
 .../aarch64/raspberrypi/optsystemtimer.yml| 24 +++
 8 files changed, 132 insertions(+), 1 deletion(-)
 create mode 100644 bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/objsystemtimer.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/optsystemtimer.yml

diff --git a/bsps/aarch64/raspberrypi/include/bsp/bcm2711.h 
b/bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
index e6c77fa025..8707582ebb 100644
--- a/bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
+++ b/bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
@@ -11,6 +11,7 @@
 /*
  * Copyright (C) 2022 Mohd Noor Aman
  * Copyright (C) 2023 Utkarsh Verma
+ * Copyright (C) 2024 Ning Yang
  *
  *
  * Redistribution and use in source and binary forms, with or without
@@ -91,6 +92,27 @@
 #define BCM2711_UART5_BASE (BCM2711_PL011_BASE + 0xa00)
 #define BCM2711_UART5_SIZE BCM2711_PL011_DEVICE_SIZE
 
+/* System Timer */
+/**
+ * NOTE: The GPU uses Compare registers 0 and 2 for
+ *   it's own RTOS. 1 and 3 are available for use in
+ *   RTEMS.
+ */
+#define BCM2835_GPU_TIMER_BASE(BCM2711_PERIPHERAL_BASE + 0x200+ 0x3000)
+#define BCM2835_GPU_TIMER_SIZE0x1C
+
+#define BCM2835_GPU_TIMER_CS  (BCM2835_GPU_TIMER_BASE + 0x00)
+#define BCM2835_GPU_TIMER_CS_M0   0x0001
+#define BCM2835_GPU_TIMER_CS_M1   0x0002
+#define BCM2835_GPU_TIMER_CS_M2   0x0004
+#define BCM2835_GPU_TIMER_CS_M3   0x0008
+#define BCM2835_GPU_TIMER_CLO (BCM2835_GPU_TIMER_BASE + 0x04)
+#define BCM2835_GPU_TIMER_CHI (BCM2835_GPU_TIMER_BASE + 0x08)
+#define BCM2835_GPU_TIMER_C0  (BCM2835_GPU_TIMER_BASE + 0x0C)
+#define BCM2835_GPU_TIMER_C1  (BCM2835_GPU_TIMER_BASE + 0x10)
+#define BCM2835_GPU_TIMER_C2  (BCM2835_GPU_TIMER_BASE + 0x14)
+#define BCM2835_GPU_TIMER_C3  (BCM2835_GPU_TIMER_BASE + 0x18)
+
 /* ARM Local */
 #define BCM2711_ARM_LOCAL_BASE 0xff80LL
 #define BCM2711_ARM_LOCAL_SIZE 0x80
@@ -114,4 +136,10 @@
 #define BCM2711_IRQ_AUX(BCM2711_IRQ_VC_PERIPHERAL_BASE + 29)
 #define BCM2711_IRQ_PL011_UART (BCM2711_IRQ_VC_PERIPHERAL_BASE + 57)
 
+/* Interrupt Vectors: System Timer */
+#define BCM2835_IRQ_ID_GPU_TIMER_M0(BCM2711_IRQ_VC_PERIPHERAL_BASE + 0)
+#define BCM2835_IRQ_ID_GPU_TIMER_M1(BCM2711_IRQ_VC_PERIPHERAL_BASE + 1)
+#define BCM2835_IRQ_ID_GPU_TIMER_M2(BCM2711_IRQ_VC_PERIPHERAL_BASE + 2)
+#define BCM2835_IRQ_ID_GPU_TIMER_M3(BCM2711_IRQ_VC_PERIPHERAL_BASE + 3)
+
 #endif /* LIBBSP_AARCH64_RASPBERRYPI_BSP_BCM2711_H */
diff --git a/bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h 
b/bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
new file mode 100644
index 00..2e1c673bfb
--- /dev/null
+++ b/bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
@@ -0,0 +1,43 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSBSPsAArch64RaspberryPi
+ *
+ * @brief RaspberryPi shared Register Definitions
+ */
+
+/*
+ * Copyright (C) 2024 Ning Yang
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRA

[PATCH] dev/clock: Move bcm2835-system-timer driver to shared space

2024-04-10 Thread Ning Yang
This patch moves the bcm2835 system timer driver in the arm/raspberrypi 
directory to the shared directory and adjusts arm/raspberrypi BSP.
---
 .../clockdrv.c => shared/dev/clock/bcm2835-system-timer.c}  | 0
 spec/build/bsps/arm/raspberrypi/obj.yml | 2 +-
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename bsps/{arm/raspberrypi/clock/clockdrv.c => 
shared/dev/clock/bcm2835-system-timer.c} (100%)

diff --git a/bsps/arm/raspberrypi/clock/clockdrv.c 
b/bsps/shared/dev/clock/bcm2835-system-timer.c
similarity index 100%
rename from bsps/arm/raspberrypi/clock/clockdrv.c
rename to bsps/shared/dev/clock/bcm2835-system-timer.c
diff --git a/spec/build/bsps/arm/raspberrypi/obj.yml 
b/spec/build/bsps/arm/raspberrypi/obj.yml
index ec5c82a8fb..ea370829df 100644
--- a/spec/build/bsps/arm/raspberrypi/obj.yml
+++ b/spec/build/bsps/arm/raspberrypi/obj.yml
@@ -26,7 +26,6 @@ install:
   - bsps/arm/raspberrypi/include/bsp/vc.h
 links: []
 source:
-- bsps/arm/raspberrypi/clock/clockdrv.c
 - bsps/arm/raspberrypi/console/console-config.c
 - bsps/arm/raspberrypi/console/fb.c
 - bsps/arm/raspberrypi/console/fbcons.c
@@ -47,6 +46,7 @@ source:
 - bsps/arm/shared/cp15/arm-cp15-set-exception-handler.c
 - bsps/arm/shared/cp15/arm-cp15-set-ttb-entries.c
 - bsps/arm/shared/start/bsp-start-memcpy.S
+- bsps/shared/dev/clock/bcm2835-system-timer.c
 - bsps/shared/dev/cpucounter/cpucounterfrequency.c
 - bsps/shared/dev/cpucounter/cpucounterread.c
 - bsps/shared/dev/getentropy/getentropy-cpucounter.c
-- 
2.34.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 2/2] bsps/aarch64/raspberrypi: Add system timer support

2024-04-09 Thread Ning Yang
The clock from the ARM timer is derived from the system clock. This clock can 
change dynamically e.g. if the system goes into reduced power or in low power 
mode. Thus the clock speed adapts to the overall system performance 
capabilities. For accurate timing it is recommended to use the system timers.

if BSP_CLOCK_USE_SYSTEMTIMER = 1, use the System Timer, otherwise use the ARM 
Timer.
---
 .../aarch64/raspberrypi/include/bsp/bcm2711.h | 29 ++
 bsps/aarch64/raspberrypi/start/bspstartmmu.c  |  8 +
 spec/build/bsps/aarch64/raspberrypi/obj.yml   |  3 ++
 .../bsps/aarch64/raspberrypi/objclock.yml |  6 +++-
 .../aarch64/raspberrypi/objsystemtimer.yml| 30 +++
 .../aarch64/raspberrypi/optsystemtimer.yml| 24 +++
 6 files changed, 99 insertions(+), 1 deletion(-)
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/objsystemtimer.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/optsystemtimer.yml

diff --git a/bsps/aarch64/raspberrypi/include/bsp/bcm2711.h 
b/bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
index e6c77fa025..1601009552 100644
--- a/bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
+++ b/bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
@@ -11,6 +11,7 @@
 /*
  * Copyright (C) 2022 Mohd Noor Aman
  * Copyright (C) 2023 Utkarsh Verma
+ * Copyright (C) 2024 Ning Yang
  *
  *
  * Redistribution and use in source and binary forms, with or without
@@ -91,6 +92,28 @@
 #define BCM2711_UART5_BASE (BCM2711_PL011_BASE + 0xa00)
 #define BCM2711_UART5_SIZE BCM2711_PL011_DEVICE_SIZE
 
+/* System Timer */
+/**
+ * NOTE: The GPU uses Compare registers 0 and 2 for
+ *   it's own RTOS. 1 and 3 are available for use in
+ *   RTEMS.
+ */
+#define BCM2835_GPU_TIMER_BASE(BCM2711_PERIPHERAL_BASE + 0x200+ 0x3000)
+#define BCM2835_GPU_TIMER_SIZE0x1C
+
+#define BCM2835_GPU_TIMER_CS  (BCM2835_GPU_TIMER_BASE + 0x00)
+#define BCM2835_GPU_TIMER_CS_M0   0x0001
+#define BCM2835_GPU_TIMER_CS_M1   0x0002
+#define BCM2835_GPU_TIMER_CS_M2   0x0004
+#define BCM2835_GPU_TIMER_CS_M3   0x0008
+#define BCM2835_GPU_TIMER_CLO (BCM2835_GPU_TIMER_BASE + 0x04)
+#define BCM2835_GPU_TIMER_CHI (BCM2835_GPU_TIMER_BASE + 0x08)
+#define BCM2835_GPU_TIMER_C0  (BCM2835_GPU_TIMER_BASE + 0x0C)
+#define BCM2835_GPU_TIMER_C1  (BCM2835_GPU_TIMER_BASE + 0x10)
+#define BCM2835_GPU_TIMER_C2  (BCM2835_GPU_TIMER_BASE + 0x14)
+#define BCM2835_GPU_TIMER_C3  (BCM2835_GPU_TIMER_BASE + 0x18)
+
+
 /* ARM Local */
 #define BCM2711_ARM_LOCAL_BASE 0xff80LL
 #define BCM2711_ARM_LOCAL_SIZE 0x80
@@ -114,4 +137,10 @@
 #define BCM2711_IRQ_AUX(BCM2711_IRQ_VC_PERIPHERAL_BASE + 29)
 #define BCM2711_IRQ_PL011_UART (BCM2711_IRQ_VC_PERIPHERAL_BASE + 57)
 
+/* Interrupt Vectors: System Timer */
+#define BCM2835_IRQ_ID_GPU_TIMER_M0(BCM2711_IRQ_VC_PERIPHERAL_BASE + 0)
+#define BCM2835_IRQ_ID_GPU_TIMER_M1(BCM2711_IRQ_VC_PERIPHERAL_BASE + 1)
+#define BCM2835_IRQ_ID_GPU_TIMER_M2(BCM2711_IRQ_VC_PERIPHERAL_BASE + 2)
+#define BCM2835_IRQ_ID_GPU_TIMER_M3(BCM2711_IRQ_VC_PERIPHERAL_BASE + 3)
+
 #endif /* LIBBSP_AARCH64_RASPBERRYPI_BSP_BCM2711_H */
diff --git a/bsps/aarch64/raspberrypi/start/bspstartmmu.c 
b/bsps/aarch64/raspberrypi/start/bspstartmmu.c
index d5d1381357..eb59b8f31b 100644
--- a/bsps/aarch64/raspberrypi/start/bspstartmmu.c
+++ b/bsps/aarch64/raspberrypi/start/bspstartmmu.c
@@ -11,6 +11,7 @@
 /*
  * Copyright (C) 2022 Mohd Noor Aman
  * Copyright (C) 2023 Utkarsh Verma
+ * Copyright (C) 2024 Ning Yang
  *
  *
  * Redistribution and use in source and binary forms, with or without
@@ -45,6 +46,7 @@
 #include "bsp/irq.h"
 #include "bsp/mbox.h"
 #include "bsp/rpi-gpio.h"
+#include "bsp/bcm2711.h"
 
 #define CONSOLE_DEVICE_MMU_CONFIG(_port, _file, base, size, ...) \
 {.begin = base, .end = base + size, .flags = AARCH64_MMU_DEVICE},
@@ -52,6 +54,12 @@
 BSP_START_DATA_SECTION static const aarch64_mmu_config_entry
 bsp_mmu_config_table[] = {
 AARCH64_MMU_DEFAULT_SECTIONS,
+{
+/* System Timer */
+.begin = BCM2835_GPU_TIMER_BASE,
+.end   = BCM2835_GPU_TIMER_BASE + BCM2835_GPU_TIMER_SIZE,
+.flags = AARCH64_MMU_DEVICE,
+},
 
 /* clang-format off */
 CONSOLE_DEVICES(CONSOLE_DEVICE_MMU_CONFIG)
diff --git a/spec/build/bsps/aarch64/raspberrypi/obj.yml 
b/spec/build/bsps/aarch64/raspberrypi/obj.yml
index 4a320336b7..9692cc955f 100644
--- a/spec/build/bsps/aarch64/raspberrypi/obj.yml
+++ b/spec/build/bsps/aarch64/raspberrypi/obj.yml
@@ -2,6 +2,7 @@ SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
 copyrights:
   - Copyright (C) 2022 Mohd Noor Aman
   - Copyright (C) 2023 Utkarsh Verma
+  - Copyright (C) 2024 Ning Yang
 
 type: build
 enabled-by: true
@@ -31,6 +32,8 @@ links:
 uid: objcache
   - role: build-dependency
 uid: objclock
+  - role: build-dependency
+uid: ob

[PATCH 1/2] dev/clock: Move bcm2835-system-timer driver to shared space

2024-04-09 Thread Ning Yang
This patch moves the bcm2835 system timer driver in the arm/raspberrypi 
directory to the shared directory.

Made some changes in the include section to adapt to rpi4 BSP.
---
 .../clockdrv.c => shared/dev/clock/bcm2835-system-timer.c} | 7 +++
 spec/build/bsps/arm/raspberrypi/obj.yml| 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)
 rename bsps/{arm/raspberrypi/clock/clockdrv.c => 
shared/dev/clock/bcm2835-system-timer.c} (95%)

diff --git a/bsps/arm/raspberrypi/clock/clockdrv.c 
b/bsps/shared/dev/clock/bcm2835-system-timer.c
similarity index 95%
rename from bsps/arm/raspberrypi/clock/clockdrv.c
rename to bsps/shared/dev/clock/bcm2835-system-timer.c
index 8d220d51ba..2725735860 100644
--- a/bsps/arm/raspberrypi/clock/clockdrv.c
+++ b/bsps/shared/dev/clock/bcm2835-system-timer.c
@@ -22,7 +22,14 @@
 #include 
 #include 
 #include 
+
+#if RTEMS_BSP == raspberrypi4b
+#include 
+#define BCM2835_REG(addr)  *(volatile uint32_t*)(addr)
+#else
 #include 
+#endif /* RTEMS_BSP */
+
 #include 
 
 /* This is defined in ../../../shared/dev/clock/clockimpl.h */
diff --git a/spec/build/bsps/arm/raspberrypi/obj.yml 
b/spec/build/bsps/arm/raspberrypi/obj.yml
index ec5c82a8fb..ea370829df 100644
--- a/spec/build/bsps/arm/raspberrypi/obj.yml
+++ b/spec/build/bsps/arm/raspberrypi/obj.yml
@@ -26,7 +26,6 @@ install:
   - bsps/arm/raspberrypi/include/bsp/vc.h
 links: []
 source:
-- bsps/arm/raspberrypi/clock/clockdrv.c
 - bsps/arm/raspberrypi/console/console-config.c
 - bsps/arm/raspberrypi/console/fb.c
 - bsps/arm/raspberrypi/console/fbcons.c
@@ -47,6 +46,7 @@ source:
 - bsps/arm/shared/cp15/arm-cp15-set-exception-handler.c
 - bsps/arm/shared/cp15/arm-cp15-set-ttb-entries.c
 - bsps/arm/shared/start/bsp-start-memcpy.S
+- bsps/shared/dev/clock/bcm2835-system-timer.c
 - bsps/shared/dev/cpucounter/cpucounterfrequency.c
 - bsps/shared/dev/cpucounter/cpucounterread.c
 - bsps/shared/dev/getentropy/getentropy-cpucounter.c
-- 
2.34.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 1/2] dev/clock: add bcm2835-system-timer driver

2024-04-07 Thread Ning Yang
This patch ports the bcm2835 system timer driver in the arm/raspberrypi 
directory to the shared directory.

Made some changes in the include section to adapt to rpi4 BSP.
---
 bsps/shared/dev/clock/bcm2835-system-timer.c | 114 +++
 1 file changed, 114 insertions(+)
 create mode 100644 bsps/shared/dev/clock/bcm2835-system-timer.c

diff --git a/bsps/shared/dev/clock/bcm2835-system-timer.c 
b/bsps/shared/dev/clock/bcm2835-system-timer.c
new file mode 100644
index 00..f59c9e5424
--- /dev/null
+++ b/bsps/shared/dev/clock/bcm2835-system-timer.c
@@ -0,0 +1,114 @@
+/**
+ * @file
+ *
+ * @ingroup RTEMSDriverClockImpl
+ *
+ * @brief This source file contains the implementation of the BCM2835 Clock
+ *   Driver.
+ */
+
+/*
+ * Copyright (c) 2013 Alan Cudmore
+ * Copyright (c) 2016 Pavel Pisa
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *
+ *  http://www.rtems.org/license/LICENSE
+ *
+*/
+
+#include 
+#include 
+#include 
+#include 
+
+#if RTEMS_BSP == raspberrypi4b
+#include 
+#else
+#include 
+#endif /* RTEMS_BSP */
+
+#include 
+
+#define BCM2835_REG(addr)  *(volatile uint32_t*)(addr)
+
+/* This is defined in ../../../shared/dev/clock/clockimpl.h */
+void Clock_isr(rtems_irq_hdl_param arg);
+
+static struct timecounter raspberrypi_tc;
+
+static uint32_t raspberrypi_clock_get_timecount(struct timecounter *tc)
+{
+  return BCM2835_REG(BCM2835_GPU_TIMER_CLO);
+}
+
+static void raspberrypi_clock_at_tick(void)
+{
+  uint32_t act_val;
+  uint32_t next_cmp = BCM2835_REG(BCM2835_GPU_TIMER_C3);
+  next_cmp += rtems_configuration_get_microseconds_per_tick();
+  BCM2835_REG(BCM2835_GPU_TIMER_C3) = next_cmp;
+  act_val = BCM2835_REG(BCM2835_GPU_TIMER_CLO);
+
+  /*
+   * Clear interrupt only if there is time left to the next tick.
+   * If time of the next tick has already passed then interrupt
+   * request stays active and fires immediately after current tick
+   * processing is finished.
+   */
+  if ((int32_t)(next_cmp - act_val) > 0)
+BCM2835_REG(BCM2835_GPU_TIMER_CS) = BCM2835_GPU_TIMER_CS_M3;
+}
+
+static void raspberrypi_clock_handler_install_isr(
+  rtems_isr_entry clock_isr
+)
+{
+  rtems_status_code sc = RTEMS_SUCCESSFUL;
+
+  if (clock_isr != NULL) {
+sc = rtems_interrupt_handler_install(
+  BCM2835_IRQ_ID_GPU_TIMER_M3,
+  "Clock",
+  RTEMS_INTERRUPT_UNIQUE,
+  (rtems_interrupt_handler) clock_isr,
+  NULL
+);
+  } else {
+/* Remove interrupt handler */
+sc = rtems_interrupt_handler_remove(
+  BCM2835_IRQ_ID_GPU_TIMER_M3,
+  (rtems_interrupt_handler) Clock_isr,
+  NULL
+);
+  }
+  if ( sc != RTEMS_SUCCESSFUL ) {
+rtems_fatal_error_occurred(0xdeadbeef);
+  }
+}
+
+static void raspberrypi_clock_initialize_hardware(void)
+{
+  uint32_t next_cmp = BCM2835_REG(BCM2835_GPU_TIMER_CLO);
+  next_cmp += rtems_configuration_get_microseconds_per_tick();
+  BCM2835_REG(BCM2835_GPU_TIMER_C3) = next_cmp;
+  BCM2835_REG(BCM2835_GPU_TIMER_CS) = BCM2835_GPU_TIMER_CS_M3;
+
+  raspberrypi_tc.tc_get_timecount = raspberrypi_clock_get_timecount;
+  raspberrypi_tc.tc_counter_mask = 0x;
+  raspberrypi_tc.tc_frequency = 100; /* 1 MHz */
+  raspberrypi_tc.tc_quality = RTEMS_TIMECOUNTER_QUALITY_CLOCK_DRIVER;
+  rtems_timecounter_install(_tc);
+}
+
+#define Clock_driver_support_at_tick() raspberrypi_clock_at_tick()
+
+#define Clock_driver_support_initialize_hardware() 
raspberrypi_clock_initialize_hardware()
+
+#define Clock_driver_support_install_isr(clock_isr) \
+  raspberrypi_clock_handler_install_isr(clock_isr)
+
+#define CLOCK_DRIVER_USE_ONLY_BOOT_PROCESSOR 1
+
+#include "../../../shared/dev/clock/clockimpl.h"
-- 
2.34.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 2/2] bsps/aarch64/raspberrypi: Add system timer support

2024-04-07 Thread Ning Yang
The clock from the ARM timer is derived from the system clock. This clock can 
change dynamically e.g. if the system goes into reduced power or in low power 
mode. Thus the clock speed adapts to the overall system performance 
capabilities. For accurate timing it is recommended to use the system timers.

if BSP_CLOCK_USE_SYSTEMTIMER =1, use the System Timer.
else use the ARM Timer
---
 .../aarch64/raspberrypi/include/bsp/bcm2711.h | 28 +
 bsps/aarch64/raspberrypi/start/bspstartmmu.c  |  7 +
 spec/build/bsps/aarch64/raspberrypi/obj.yml   |  2 ++
 .../bsps/aarch64/raspberrypi/objclock.yml |  6 +++-
 .../aarch64/raspberrypi/objsystemtimer.yml| 30 +++
 .../aarch64/raspberrypi/optsystemtimer.yml| 24 +++
 6 files changed, 96 insertions(+), 1 deletion(-)
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/objsystemtimer.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/optsystemtimer.yml

diff --git a/bsps/aarch64/raspberrypi/include/bsp/bcm2711.h 
b/bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
index e6c77fa025..13be411e8f 100644
--- a/bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
+++ b/bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
@@ -91,6 +91,28 @@
 #define BCM2711_UART5_BASE (BCM2711_PL011_BASE + 0xa00)
 #define BCM2711_UART5_SIZE BCM2711_PL011_DEVICE_SIZE
 
+/* System Timer */
+/**
+ * NOTE: The GPU uses Compare registers 0 and 2 for
+ *   it's own RTOS. 1 and 3 are available for use in
+ *   RTEMS.
+ */
+#define BCM2835_GPU_TIMER_BASE(BCM2711_PERIPHERAL_BASE + 0x200+ 0x3000)
+#define BCM2835_GPU_TIMER_SIZE0x1C
+
+#define BCM2835_GPU_TIMER_CS  (BCM2835_GPU_TIMER_BASE + 0x00)
+#define BCM2835_GPU_TIMER_CS_M0   0x0001
+#define BCM2835_GPU_TIMER_CS_M1   0x0002
+#define BCM2835_GPU_TIMER_CS_M2   0x0004
+#define BCM2835_GPU_TIMER_CS_M3   0x0008
+#define BCM2835_GPU_TIMER_CLO (BCM2835_GPU_TIMER_BASE + 0x04)
+#define BCM2835_GPU_TIMER_CHI (BCM2835_GPU_TIMER_BASE + 0x08)
+#define BCM2835_GPU_TIMER_C0  (BCM2835_GPU_TIMER_BASE + 0x0C)
+#define BCM2835_GPU_TIMER_C1  (BCM2835_GPU_TIMER_BASE + 0x10)
+#define BCM2835_GPU_TIMER_C2  (BCM2835_GPU_TIMER_BASE + 0x14)
+#define BCM2835_GPU_TIMER_C3  (BCM2835_GPU_TIMER_BASE + 0x18)
+
+
 /* ARM Local */
 #define BCM2711_ARM_LOCAL_BASE 0xff80LL
 #define BCM2711_ARM_LOCAL_SIZE 0x80
@@ -114,4 +136,10 @@
 #define BCM2711_IRQ_AUX(BCM2711_IRQ_VC_PERIPHERAL_BASE + 29)
 #define BCM2711_IRQ_PL011_UART (BCM2711_IRQ_VC_PERIPHERAL_BASE + 57)
 
+/* Interrupt Vectors: System Timer */
+#define BCM2835_IRQ_ID_GPU_TIMER_M0(BCM2711_IRQ_VC_PERIPHERAL_BASE + 0)
+#define BCM2835_IRQ_ID_GPU_TIMER_M1(BCM2711_IRQ_VC_PERIPHERAL_BASE + 1)
+#define BCM2835_IRQ_ID_GPU_TIMER_M2(BCM2711_IRQ_VC_PERIPHERAL_BASE + 2)
+#define BCM2835_IRQ_ID_GPU_TIMER_M3(BCM2711_IRQ_VC_PERIPHERAL_BASE + 3)
+
 #endif /* LIBBSP_AARCH64_RASPBERRYPI_BSP_BCM2711_H */
diff --git a/bsps/aarch64/raspberrypi/start/bspstartmmu.c 
b/bsps/aarch64/raspberrypi/start/bspstartmmu.c
index d5d1381357..4128e76c65 100644
--- a/bsps/aarch64/raspberrypi/start/bspstartmmu.c
+++ b/bsps/aarch64/raspberrypi/start/bspstartmmu.c
@@ -45,6 +45,7 @@
 #include "bsp/irq.h"
 #include "bsp/mbox.h"
 #include "bsp/rpi-gpio.h"
+#include "bsp/bcm2711.h"
 
 #define CONSOLE_DEVICE_MMU_CONFIG(_port, _file, base, size, ...) \
 {.begin = base, .end = base + size, .flags = AARCH64_MMU_DEVICE},
@@ -52,6 +53,12 @@
 BSP_START_DATA_SECTION static const aarch64_mmu_config_entry
 bsp_mmu_config_table[] = {
 AARCH64_MMU_DEFAULT_SECTIONS,
+{
+/* System Timer */
+.begin = BCM2835_GPU_TIMER_BASE,
+.end   = BCM2835_GPU_TIMER_BASE + BCM2835_GPU_TIMER_SIZE,
+.flags = AARCH64_MMU_DEVICE,
+},
 
 /* clang-format off */
 CONSOLE_DEVICES(CONSOLE_DEVICE_MMU_CONFIG)
diff --git a/spec/build/bsps/aarch64/raspberrypi/obj.yml 
b/spec/build/bsps/aarch64/raspberrypi/obj.yml
index 4a320336b7..07b287e9e7 100644
--- a/spec/build/bsps/aarch64/raspberrypi/obj.yml
+++ b/spec/build/bsps/aarch64/raspberrypi/obj.yml
@@ -31,6 +31,8 @@ links:
 uid: objcache
   - role: build-dependency
 uid: objclock
+  - role: build-dependency
+uid: objsystemtimer
   - role: build-dependency
 uid: objconsole
   - role: build-dependency
diff --git a/spec/build/bsps/aarch64/raspberrypi/objclock.yml 
b/spec/build/bsps/aarch64/raspberrypi/objclock.yml
index 550df8029a..b7832236f3 100644
--- a/spec/build/bsps/aarch64/raspberrypi/objclock.yml
+++ b/spec/build/bsps/aarch64/raspberrypi/objclock.yml
@@ -2,9 +2,11 @@ SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
 copyrights:
   - Copyright (C) 2022 Mohd Noor Aman
   - Copyright (C) 2023 Utkarsh Verma
+  - Copyright (C) 2024 Ning Yang
 
 type: build
-enabled-by: true
+enabled-by:
+  not: BSP_CLOCK_USE_SYSTEMTIMER
 
 build-type: objects
 cfla

GSOC2024_Yang_Adding SPI, Watchdog and SD card support to Raspberry Pi 4B BSP

2024-03-15 Thread Ning Yang
Hello everyone,

I have included the SD card support part in my proposal, please let me know how 
I can continue to improve it. 
The SD card support is complex, any suggestions would be very appreciated.

https://docs.google.com/document/d/1NjlUSWhqwUvrsQPBISU05ah0I0IGkEuq6BIThrkMBsg/edit?usp=sharing
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


GSOC proposal: GSOC2024_Yang_Adding SPI and Watchdog support to Raspberry Pi4B BSP

2024-03-08 Thread Ning Yang
Hello everyone,

I've prepared a draft for my proposal. Please let me know how I could improve 
it.

Thank you inadvance.

https://docs.google.com/document/d/1NjlUSWhqwUvrsQPBISU05ah0I0IGkEuq6BIThrkMBsg/edit?usp=sharing___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

GSOC: GSOC2024_Yang_Adding SPI and Watchdog support to Raspberry Pi 4B BSP

2024-03-06 Thread Ning Yang
I've prepared a draft for my proposal. Please let me know how I could improve 
it.
Thank you in advance. 
https://docs.google.com/document/d/1NjlUSWhqwUvrsQPBISU05ah0I0IGkEuq6BIThrkMBsg/edit___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH 0/2] GSOC: ​Hello World exercise

2024-02-28 Thread Ning Yang
Hello, My name is Yang Ning, a computer science master's student at China 
Yanshan University.My research chiefly focuses on RTEMS.

This is my first contact with operating system-related projects. I have been 
study RTEMS on RPi4 for half year. During the half year,I configured and 
builded RTEMS and RTEMS-libbsd for RPi4. 
I also ported btstack( https://github.com/bluekitchen/btstack ) to RTEMS. It 
works well.
Then I have been working on RPi4 BSP.I debugged the issue of 
set_attributes().(https://discord.com/channels/82045382112799/85822508908585/1180421668502511706)(
 I commented a few lines directly.Does not conform to the data sheet, but it 
can works.)

I'm still reading the existing RPi4 BSP code.And I'm interested in porting 
USB3.0.Freebsd already supports usb3.0 of RPi4 ( 
https://reviews.freebsd.org/D25068 ). I just need to integrate it into libbsd.

discord: @yangn0
github: https://github.com/yangn0
blog: https://blog.csdn.net/qq_41058067

Ning Yang (2):
  hello world exercise
  helloworld & gdb screen snapshot

 hello/gdb.png   | Bin 0 -> 414373 bytes
 hello/hello.c   |   2 +-
 hello/hello.png | Bin 0 -> 37259 bytes
 3 files changed, 1 insertion(+), 1 deletion(-)
 create mode 100644 hello/gdb.png
 create mode 100644 hello/hello.png

-- 
2.34.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 1/2] hello world exercise

2024-02-28 Thread Ning Yang
---
 hello/hello.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hello/hello.c b/hello/hello.c
index d2321d8..e074563 100644
--- a/hello/hello.c
+++ b/hello/hello.c
@@ -8,6 +8,6 @@
 rtems_task Init(
 rtems_task_argument ignored)
 {
-  puts("hello, world!");
+  puts("Hello, My name is Yang Ning. I am a master's student at China Yanshan 
University.My research chiefly focuses on RTEMS.");
   exit(0);
 }
-- 
2.34.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel