diff --git a/cpu/atmega2560/periph/gpio.c b/cpu/atmega2560/periph/gpio.c index a276428815..3cea0534ad 100644 --- a/cpu/atmega2560/periph/gpio.c +++ b/cpu/atmega2560/periph/gpio.c @@ -34,12 +34,7 @@ #define GPIO_OFFSET_PIN_PIN (0x03) #define GPIO_EXT_INT_NUMOF (8U) -typedef struct { - gpio_cb_t cb; - void *arg; -} gpio_state_t; - -static gpio_state_t config[GPIO_EXT_INT_NUMOF]; +static gpio_isr_ctx_t config[GPIO_EXT_INT_NUMOF]; /** * @brief Extract the pin number of the given pin diff --git a/cpu/cc2538/periph/gpio.c b/cpu/cc2538/periph/gpio.c index f45e695b94..38fa2f5a7a 100644 --- a/cpu/cc2538/periph/gpio.c +++ b/cpu/cc2538/periph/gpio.c @@ -44,12 +44,7 @@ */ #define gpio_enabled(dev) ( (enable_lut >> (dev)) & 1 ) -typedef struct { - gpio_cb_t cb; /**< callback called from GPIO interrupt */ - void *arg; /**< argument passed to the callback */ -} gpio_state_t; - -static gpio_state_t gpio_config[GPIO_NUMOF]; +static gpio_isr_ctx_t gpio_config[GPIO_NUMOF]; const uint32_t enable_lut = 0 #if GPIO_0_EN @@ -514,7 +509,7 @@ void gpio_write(gpio_t dev, int value) void isr_gpioa(void) { int mis, bit; - gpio_state_t* state; + gpio_isr_ctx_t* state; /* Latch and clear the interrupt status early on: */ mis = GPIO_A->MIS; @@ -539,7 +534,7 @@ void isr_gpioa(void) void isr_gpiob(void) { int mis, bit; - gpio_state_t* state; + gpio_isr_ctx_t* state; /* Latch and clear the interrupt status early on: */ mis = GPIO_B->MIS; @@ -564,7 +559,7 @@ void isr_gpiob(void) void isr_gpioc(void) { int mis, bit; - gpio_state_t* state; + gpio_isr_ctx_t* state; /* Latch and clear the interrupt status early on: */ mis = GPIO_C->MIS; @@ -589,7 +584,7 @@ void isr_gpioc(void) void isr_gpiod(void) { int mis, bit; - gpio_state_t* state; + gpio_isr_ctx_t* state; /* Latch and clear the interrupt status early on: */ mis = GPIO_D->MIS; diff --git a/cpu/ezr32wg/periph/gpio.c b/cpu/ezr32wg/periph/gpio.c index ba3d244e92..09b836174a 100644 --- a/cpu/ezr32wg/periph/gpio.c +++ b/cpu/ezr32wg/periph/gpio.c @@ -31,19 +31,10 @@ * @brief Number of external interrupt lines */ #define NUMOF_IRQS (16U) - -/** - * @brief Datatype to use for saving the interrupt contexts - */ -typedef struct { - gpio_cb_t cb; /**< callback to call on GPIO interrupt */ - void *arg; /**< argument passed to the callback */ -} gpio_exti_t; - /** * @brief Hold one interrupt context per interrupt line */ -static gpio_exti_t isr_ctx[NUMOF_IRQS]; +static gpio_isr_ctx_t isr_ctx[NUMOF_IRQS]; static inline int _port_num(gpio_t pin) { diff --git a/cpu/lpc11u34/periph/gpio.c b/cpu/lpc11u34/periph/gpio.c index aa5284ed3c..ccc2802b1f 100644 --- a/cpu/lpc11u34/periph/gpio.c +++ b/cpu/lpc11u34/periph/gpio.c @@ -22,11 +22,6 @@ #include "thread.h" #include "periph/gpio.h" -typedef struct { - gpio_cb_t cb; - void *arg; -} gpio_state_t; - /* Static IOCON registers definition */ volatile uint32_t * const lpc_pin_registers[] = { /* PORT 0 (PIO0_0 -> PIO0_23) */ @@ -63,7 +58,7 @@ volatile uint32_t * const lpc_pin_registers[] = { static int8_t flex_int_mapping[GPIO_NUMOF]; -static gpio_state_t gpio_config[GPIO_NUMOF]; +static gpio_isr_ctx_t gpio_config[GPIO_NUMOF]; static uint8_t gpio_int_id = 0; /* static port mappings */ diff --git a/cpu/lpc2387/periph/gpio.c b/cpu/lpc2387/periph/gpio.c index 028f4769f6..6862115e7e 100644 --- a/cpu/lpc2387/periph/gpio.c +++ b/cpu/lpc2387/periph/gpio.c @@ -34,12 +34,7 @@ static BITFIELD(_gpio_config_bitfield, GPIO_NUM_ISR); -typedef struct { - gpio_cb_t cb; /**< callback called from GPIO interrupt */ - void *arg; /**< argument passed to the callback */ -} gpio_state_t; - -static gpio_state_t _gpio_states[GPIO_NUM_ISR]; +static gpio_isr_ctx_t _gpio_states[GPIO_NUM_ISR]; static BITFIELD(_gpio_rising, GPIO_NUM_ISR); static BITFIELD(_gpio_falling, GPIO_NUM_ISR); static uint8_t _gpio_isr_map[64]; /* only ports 0+2 can have ISRs */ diff --git a/cpu/msp430fxyz/periph/gpio.c b/cpu/msp430fxyz/periph/gpio.c index e9306f8061..4e820e1747 100644 --- a/cpu/msp430fxyz/periph/gpio.c +++ b/cpu/msp430fxyz/periph/gpio.c @@ -32,18 +32,10 @@ */ #define PINS_PER_PORT (8U) -/** - * @brief Datatype to use for saving the interrupt contexts - */ -typedef struct { - gpio_cb_t cb; /**< callback to call on GPIO interrupt */ - void *arg; /**< argument passed to the callback */ -} isr_ctx_t; - /** * @brief Interrupt context for each interrupt line */ -static isr_ctx_t isr_ctx[ISR_NUMOF]; +static gpio_isr_ctx_t isr_ctx[ISR_NUMOF]; static msp_port_t *_port(gpio_t pin) diff --git a/cpu/nrf51/periph/gpio.c b/cpu/nrf51/periph/gpio.c index ff66fd3b43..3f073e90d2 100644 --- a/cpu/nrf51/periph/gpio.c +++ b/cpu/nrf51/periph/gpio.c @@ -29,18 +29,10 @@ #include "periph/gpio.h" #include "periph_conf.h" -/** - * @brief Datastructure to hold an interrupt context - */ -typedef struct { - void (*cb)(void *arg); /**< interrupt callback routine */ - void *arg; /**< optional argument */ -} exti_ctx_t; - /** * @brief Place to store the interrupt context */ -static exti_ctx_t exti_chan; +static gpio_isr_ctx_t exti_chan; int gpio_init(gpio_t pin, gpio_dir_t dir, gpio_pp_t pullup) { diff --git a/cpu/sam3/periph/gpio.c b/cpu/sam3/periph/gpio.c index 6833d9ff4d..d22329e1cd 100644 --- a/cpu/sam3/periph/gpio.c +++ b/cpu/sam3/periph/gpio.c @@ -42,18 +42,10 @@ */ #define CTX_NUMOF (7U) -/** - * @brief Context information needed for interrupts - */ -typedef struct { - gpio_cb_t cb; /**< callback called from GPIO interrupt */ - void *arg; /**< argument passed to the callback */ -} exti_ctx_t; - /** * @brief Allocation of memory for 7 independent interrupt slots */ -static exti_ctx_t exti_ctx[CTX_NUMOF] = { +static gpio_isr_ctx_t exti_ctx[CTX_NUMOF] = { {NULL, NULL}, {NULL, NULL}, {NULL, NULL}, {NULL, NULL}, {NULL, NULL}, {NULL, NULL}, {NULL, NULL} }; diff --git a/cpu/samd21/periph/gpio.c b/cpu/samd21/periph/gpio.c index 3d2bfb6cbd..1630dfb704 100644 --- a/cpu/samd21/periph/gpio.c +++ b/cpu/samd21/periph/gpio.c @@ -44,18 +44,10 @@ static const int8_t exti_config[2][32] = { 0, 1, -1, -1, -1, -1, 6, 7, -1, -1, -1, 15, 8, -1, 10, 11}, }; -/** - * @brief Datatype to use for saving the interrupt contexts - */ -typedef struct { - gpio_cb_t cb; /**< callback to call on GPIO interrupt */ - void *arg; /**< argument passed to the callback */ -} gpio_exti_t; - /** * @brief Hold one interrupt context per interrupt line */ -static gpio_exti_t gpio_config[NUMOF_IRQS]; +static gpio_isr_ctx_t gpio_config[NUMOF_IRQS]; static inline PortGroup *_port(gpio_t pin) { diff --git a/cpu/saml21/periph/gpio.c b/cpu/saml21/periph/gpio.c index 28fa37bcda..a2116ece76 100644 --- a/cpu/saml21/periph/gpio.c +++ b/cpu/saml21/periph/gpio.c @@ -51,12 +51,7 @@ static const int8_t exti_config[2][32] = { 0, 1, -1, -1, -1, -1, 6, 7, -1, -1, -1, -1, -1, -1, 14, 15}, }; -typedef struct { - gpio_cb_t cb; /**< callback called from GPIO interrupt */ - void *arg; /**< argument passed to the callback */ -} gpio_state_t; - -static gpio_state_t gpio_config[NUMOF_IRQS]; +static gpio_isr_ctx_t gpio_config[NUMOF_IRQS]; static inline PortGroup *_port(gpio_t pin) diff --git a/cpu/stm32f0/periph/gpio.c b/cpu/stm32f0/periph/gpio.c index fdc757a700..1c690d9752 100644 --- a/cpu/stm32f0/periph/gpio.c +++ b/cpu/stm32f0/periph/gpio.c @@ -24,12 +24,7 @@ #include "periph/gpio.h" #include "periph_conf.h" -typedef struct { - gpio_cb_t cb; - void *arg; -} gpio_state_t; - -static gpio_state_t gpio_config[GPIO_NUMOF]; +static gpio_isr_ctx_t gpio_config[GPIO_NUMOF]; /* static port mappings */ static GPIO_TypeDef *const gpio_port_map[GPIO_NUMOF] = { diff --git a/cpu/stm32f1/periph/gpio.c b/cpu/stm32f1/periph/gpio.c index a3bad7f23d..7331d6fc8f 100644 --- a/cpu/stm32f1/periph/gpio.c +++ b/cpu/stm32f1/periph/gpio.c @@ -35,15 +35,10 @@ */ #define GPIO_ISR_CHAN_NUMOF (16U) -typedef struct { - gpio_cb_t cb; /**< callback called from GPIO interrupt */ - void *arg; /**< argument passed to the callback */ -} exti_ctx_t; - /** * @brief Allocate memory for one callback and argument per EXTI channel */ -static exti_ctx_t exti_ctx[GPIO_ISR_CHAN_NUMOF]; +static gpio_isr_ctx_t exti_ctx[GPIO_ISR_CHAN_NUMOF]; /** * @brief Extract the pin's port base address from the given pin identifier diff --git a/cpu/stm32f3/periph/gpio.c b/cpu/stm32f3/periph/gpio.c index e8ea20c0ed..6d267f4444 100644 --- a/cpu/stm32f3/periph/gpio.c +++ b/cpu/stm32f3/periph/gpio.c @@ -32,18 +32,10 @@ */ #define EXTI_NUMOF (16U) -/** - * @brief Datastructure to hold an interrupt context - */ -typedef struct { - gpio_cb_t cb; /**< callback called from GPIO interrupt */ - void *arg; /**< argument passed to the callback */ -} gpio_state_t; - /** * @brief Hold one callback function pointer for each interrupt line */ -static gpio_state_t exti_chan[EXTI_NUMOF]; +static gpio_isr_ctx_t exti_chan[EXTI_NUMOF]; /** * @brief Extract the port base address from the given pin identifier diff --git a/cpu/stm32f4/periph/gpio.c b/cpu/stm32f4/periph/gpio.c index 643f4ba34c..7f84eb71d3 100644 --- a/cpu/stm32f4/periph/gpio.c +++ b/cpu/stm32f4/periph/gpio.c @@ -30,18 +30,10 @@ */ #define GPIO_ISR_CHAN_NUMOF (16U) -/** - * @brief Datastructure to hold an interrupt context - */ -typedef struct { - void (*cb)(void *arg); /**< interrupt callback routine */ - void *arg; /**< optional argument */ -} exti_ctx_t; - /** * @brief Hold one callback function pointer for each interrupt line */ -static exti_ctx_t exti_chan[GPIO_ISR_CHAN_NUMOF]; +static gpio_isr_ctx_t exti_chan[GPIO_ISR_CHAN_NUMOF]; /** * @brief Extract the port base address from the given pin identifier diff --git a/cpu/stm32l1/periph/gpio.c b/cpu/stm32l1/periph/gpio.c index 1d0d30dddd..8257d172d5 100644 --- a/cpu/stm32l1/periph/gpio.c +++ b/cpu/stm32l1/periph/gpio.c @@ -26,23 +26,15 @@ #include "periph/gpio.h" #include "periph_conf.h" -#/** +/** * @brief Number of available external interrupt lines */ #define GPIO_ISR_CHAN_NUMOF (16U) -/** - * @brief Datastructure to hold an interrupt context - */ -typedef struct { - void (*cb)(void *arg); /**< interrupt callback routine */ - void *arg; /**< optional argument */ -} exti_ctx_t; - /** * @brief Hold one callback function pointer for each interrupt line */ -static exti_ctx_t exti_chan[GPIO_ISR_CHAN_NUMOF]; +static gpio_isr_ctx_t exti_chan[GPIO_ISR_CHAN_NUMOF]; /** * @brief Extract the port base address from the given pin identifier