You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/10/19 11:09:09 UTC

[GitHub] andrzej-kaczmarek closed pull request #137: porting: Use real function pointer types for ISR functions

andrzej-kaczmarek closed pull request #137: porting: Use real function pointer types for ISR functions
URL: https://github.com/apache/mynewt-nimble/pull/137
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/nimble/drivers/nrf52/src/ble_hw.c b/nimble/drivers/nrf52/src/ble_hw.c
index ea0c912c..a32e665d 100644
--- a/nimble/drivers/nrf52/src/ble_hw.c
+++ b/nimble/drivers/nrf52/src/ble_hw.c
@@ -334,7 +334,7 @@ ble_hw_rng_init(ble_rng_isr_cb_t cb, int bias)
 #if MYNEWT
         NVIC_SetVector(RNG_IRQn, (uint32_t)ble_rng_isr);
 #else
-        ble_npl_hw_set_isr(RNG_IRQn, (uint32_t)ble_rng_isr);
+        ble_npl_hw_set_isr(RNG_IRQn, ble_rng_isr);
 #endif
         NVIC_EnableIRQ(RNG_IRQn);
         g_ble_rng_isr_cb = cb;
diff --git a/nimble/drivers/nrf52/src/ble_phy.c b/nimble/drivers/nrf52/src/ble_phy.c
index 35758bb5..ff62bca6 100644
--- a/nimble/drivers/nrf52/src/ble_phy.c
+++ b/nimble/drivers/nrf52/src/ble_phy.c
@@ -1428,7 +1428,7 @@ ble_phy_init(void)
 #if MYNEWT
     NVIC_SetVector(RADIO_IRQn, (uint32_t)ble_phy_isr);
 #else
-    ble_npl_hw_set_isr(RADIO_IRQn, (uint32_t)ble_phy_isr);
+    ble_npl_hw_set_isr(RADIO_IRQn, ble_phy_isr);
 #endif
     NVIC_EnableIRQ(RADIO_IRQn);
 
diff --git a/nimble/include/nimble/nimble_npl.h b/nimble/include/nimble/nimble_npl.h
index d7a4faed..49505958 100644
--- a/nimble/include/nimble/nimble_npl.h
+++ b/nimble/include/nimble/nimble_npl.h
@@ -157,7 +157,7 @@ void ble_npl_time_delay(ble_npl_time_t ticks);
 
 #if NIMBLE_CFG_CONTROLLER
 
-void ble_npl_hw_set_isr(int irqn, uint32_t addr);
+void ble_npl_hw_set_isr(int irqn, void (*addr)(void));
 
 #endif
 
diff --git a/porting/nimble/src/hal_timer.c b/porting/nimble/src/hal_timer.c
index 5c3fd334..458e70f9 100644
--- a/porting/nimble/src/hal_timer.c
+++ b/porting/nimble/src/hal_timer.c
@@ -503,7 +503,7 @@ hal_timer_init(int timer_num, void *cfg)
 #if MYNEWT
     NVIC_SetVector(irq_num, (uint32_t)irq_isr);
 #else
-    ble_npl_hw_set_isr(irq_num, (uint32_t)irq_isr);
+    ble_npl_hw_set_isr(irq_num, irq_isr);
 #endif
 
     return 0;
diff --git a/porting/npl/freertos/include/nimble/nimble_npl_os.h b/porting/npl/freertos/include/nimble/nimble_npl_os.h
index c2f8361a..00f64ba2 100644
--- a/porting/npl/freertos/include/nimble/nimble_npl_os.h
+++ b/porting/npl/freertos/include/nimble/nimble_npl_os.h
@@ -272,7 +272,7 @@ ble_npl_time_delay(ble_npl_time_t ticks)
 
 #if NIMBLE_CFG_CONTROLLER
 static inline void
-ble_npl_hw_set_isr(int irqn, uint32_t addr)
+ble_npl_hw_set_isr(int irqn, void (*addr)(void))
 {
     npl_freertos_hw_set_isr(irqn, addr);
 }
diff --git a/porting/npl/freertos/include/nimble/npl_freertos.h b/porting/npl/freertos/include/nimble/npl_freertos.h
index db8784d9..a7b1c4aa 100644
--- a/porting/npl/freertos/include/nimble/npl_freertos.h
+++ b/porting/npl/freertos/include/nimble/npl_freertos.h
@@ -65,7 +65,7 @@ ble_npl_error_t npl_freertos_time_ms_to_ticks(uint32_t ms,
 ble_npl_error_t npl_freertos_time_ticks_to_ms(ble_npl_time_t ticks,
                                               uint32_t *out_ms);
 
-void npl_freertos_hw_set_isr(int irqn, uint32_t addr);
+void npl_freertos_hw_set_isr(int irqn, void (*addr)(void));
 
 uint32_t npl_freertos_hw_enter_critical(void);
 
diff --git a/porting/npl/riot/src/nrf5x_isr.c b/porting/npl/riot/src/nrf5x_isr.c
index bf325ecb..01ba2348 100644
--- a/porting/npl/riot/src/nrf5x_isr.c
+++ b/porting/npl/riot/src/nrf5x_isr.c
@@ -19,30 +19,30 @@
 
 #include "cpu.h"
 
-static uint32_t radio_isr_addr;
-static uint32_t rng_isr_addr;
-static uint32_t rtc0_isr_addr;
+static void (*radio_isr_addr)(void);
+static void (*rng_isr_addr)(void);
+static void (*rtc0_isr_addr)(void);
 
 void
 isr_radio(void)
 {
-    ((void (*)(void))radio_isr_addr)();
+    radio_isr_addr();
 }
 
 void
 isr_rng(void)
 {
-    ((void (*)(void))rng_isr_addr)();
+    rng_isr_addr();
 }
 
 void
 isr_rtc0(void)
 {
-    ((void (*)(void))rtc0_isr_addr)();
+    rtc0_isr_addr();
 }
 
 void
-ble_npl_hw_set_isr(int irqn, uint32_t addr)
+ble_npl_hw_set_isr(int irqn, void (*addr)(void))
 {
     switch (irqn) {
     case RADIO_IRQn:


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services