This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new b3656d34b6f arch/arm/src/samX/sam_gpioirq.c: fix pin base address 
calculation
b3656d34b6f is described below

commit b3656d34b6f895076e5b91a8d167a23a870196ed
Author: Michal Lenc <[email protected]>
AuthorDate: Wed Mar 4 17:08:25 2026 +0100

    arch/arm/src/samX/sam_gpioirq.c: fix pin base address calculation
    
    GPIO PIN base address calculation had double right shift, thus call
    to SAM_PION_BASE was always with port = 0 instead of correct port
    number. As a result, function sam_gpioirq didn't correctly configure
    additional interrupt modes (only rising or falling edge and level
    interrupts).
    
    The issue occured on SAMv7 and SAM34 platforms (likely copy-pasted
    from one to another).
    
    Signed-off-by: Michal Lenc <[email protected]>
---
 arch/arm/src/sam34/sam_gpioirq.c | 2 +-
 arch/arm/src/samv7/sam_gpioirq.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/src/sam34/sam_gpioirq.c b/arch/arm/src/sam34/sam_gpioirq.c
index b5e303af093..42ee4c2c85e 100644
--- a/arch/arm/src/sam34/sam_gpioirq.c
+++ b/arch/arm/src/sam34/sam_gpioirq.c
@@ -82,7 +82,7 @@
 static inline uint32_t sam_gpiobase(gpio_pinset_t pinset)
 {
   int port = (pinset & GPIO_PORT_MASK) >> GPIO_PORT_SHIFT;
-  return SAM_PION_BASE(port >> GPIO_PORT_SHIFT);
+  return SAM_PION_BASE(port);
 }
 
 /****************************************************************************
diff --git a/arch/arm/src/samv7/sam_gpioirq.c b/arch/arm/src/samv7/sam_gpioirq.c
index efbda6ab6bf..1cfd11ed630 100644
--- a/arch/arm/src/samv7/sam_gpioirq.c
+++ b/arch/arm/src/samv7/sam_gpioirq.c
@@ -71,7 +71,7 @@
 static inline uint32_t sam_gpiobase(gpio_pinset_t pinset)
 {
   int port = (pinset & GPIO_PORT_MASK) >> GPIO_PORT_SHIFT;
-  return SAM_PION_BASE(port >> GPIO_PORT_SHIFT);
+  return SAM_PION_BASE(port);
 }
 
 /****************************************************************************

Reply via email to