From ae2506619f17e2c52824f02c3313a80af3a743ea Mon Sep 17 00:00:00 2001 From: Masayuki Ishikawa Date: Fri, 14 Jun 2019 04:10:43 +0000 Subject: [PATCH] Merged in masayuki2009/nuttx.nuttx/change_cxd56_gpioint_config (pull request #901) change cxd56 gpioint config * arch/arm/src/cxd56xx: Change cxd56_gpioint_config to handle argument Signed-off-by: Masayuki Ishikawa * configs/spresense: Apply API change of cxd56_gpioint_config() Signed-off-by: Masayuki Ishikawa Approved-by: Gregory Nutt --- arch/arm/src/cxd56xx/cxd56_gpioint.c | 8 +++++--- arch/arm/src/cxd56xx/cxd56_gpioint.h | 4 +++- configs/spresense/src/cxd56_sdcard.c | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/arch/arm/src/cxd56xx/cxd56_gpioint.c b/arch/arm/src/cxd56xx/cxd56_gpioint.c index 79277b2dc8..83804abc31 100644 --- a/arch/arm/src/cxd56xx/cxd56_gpioint.c +++ b/arch/arm/src/cxd56xx/cxd56_gpioint.c @@ -404,6 +404,7 @@ static int gpioint_handler(int irq, FAR void *context, FAR void *arg) * pin - Pin number defined in cxd56_pinconfig.h * gpiocfg - GPIO Interrupt Polarity and Noise Filter Configuration Value * isr - Interrupt handler. If isr is NULL, then free an allocated handler. + * arg - Argument for the interrupt handler * * Returned Value: * IRQ number on success; a negated errno value on failure. @@ -413,7 +414,8 @@ static int gpioint_handler(int irq, FAR void *context, FAR void *arg) * ****************************************************************************/ -int cxd56_gpioint_config(uint32_t pin, uint32_t gpiocfg, xcpt_t isr) +int cxd56_gpioint_config(uint32_t pin, uint32_t gpiocfg, xcpt_t isr, + FAR void *arg) { int slot; int irq; @@ -474,12 +476,12 @@ int cxd56_gpioint_config(uint32_t pin, uint32_t gpiocfg, xcpt_t isr) if ((gpiocfg & GPIOINT_TOGGLE_MODE_MASK) || GPIOINT_IS_EDGE(gpiocfg)) { - irq_attach(irq, gpioint_handler, (void *)pin); /* call intermediate handler */ + irq_attach(irq, gpioint_handler, arg); /* call intermediate handler */ g_isr[slot] = isr; } else { - irq_attach(irq, isr, (void *)pin); /* call user handler directly */ + irq_attach(irq, isr, arg); /* call user handler directly */ g_isr[slot] = NULL; } diff --git a/arch/arm/src/cxd56xx/cxd56_gpioint.h b/arch/arm/src/cxd56xx/cxd56_gpioint.h index 32818080a5..fee27d4cbe 100644 --- a/arch/arm/src/cxd56xx/cxd56_gpioint.h +++ b/arch/arm/src/cxd56xx/cxd56_gpioint.h @@ -135,6 +135,7 @@ extern "C" * pin - Pin number defined in cxd56_pinconfig.h * gpiocfg - GPIO Interrupt Polarity and Noise Filter Configuration Value * isr - Interrupt handler + * arg - Argument for the interrupt handler * * Returned Value: * IRQ number on success; a negated errno value on failure. @@ -144,7 +145,8 @@ extern "C" * ****************************************************************************/ -int cxd56_gpioint_config(uint32_t pin, uint32_t gpiocfg, xcpt_t isr); +int cxd56_gpioint_config(uint32_t pin, uint32_t gpiocfg, xcpt_t isr, + FAR void *arg); /**************************************************************************** * Name: cxd56_gpioint_irq diff --git a/configs/spresense/src/cxd56_sdcard.c b/configs/spresense/src/cxd56_sdcard.c index 2fe1afef98..967b703a1f 100644 --- a/configs/spresense/src/cxd56_sdcard.c +++ b/configs/spresense/src/cxd56_sdcard.c @@ -312,7 +312,8 @@ static int board_sdcard_detect_int(int irq, FAR void *context, FAR void *arg) inserted ? GPIOINT_PSEUDO_EDGE_RISE : GPIOINT_PSEUDO_EDGE_FALL, - board_sdcard_detect_int); + board_sdcard_detect_int, + NULL); } return OK; @@ -357,7 +358,8 @@ int board_sdcard_initialize(void) cxd56_pin_config(PINCONF_SDIO_CD_GPIO); ret = cxd56_gpioint_config(PIN_SDIO_CD, GPIOINT_PSEUDO_EDGE_FALL, - board_sdcard_detect_int); + board_sdcard_detect_int, + NULL); if (ret < 0) { _err("ERROR: Failed to configure GPIO int. \n");