From 75446b349bffee1614475256b3ea7fb2363ff4a8 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 2 Mar 2017 07:56:35 -0600 Subject: [PATCH] configs/: All functions that used to return an xcpt_t old handler value, not return NULL. The oldhandler value is no longer useful with the recent changes to the interrupt argument passing. --- configs/ea3131/src/lpc31_usbhost.c | 23 +++++--------------- configs/olimex-lpc-h3131/include/board.h | 7 +++--- configs/olimex-lpc-h3131/src/lpc31_usbhost.c | 15 ++++--------- configs/stm3210e-eval/README.txt | 2 +- configs/stm3210e-eval/include/board.h | 7 +++--- configs/stm3210e-eval/src/stm32_lm75.c | 8 ++++--- 6 files changed, 23 insertions(+), 39 deletions(-) diff --git a/configs/ea3131/src/lpc31_usbhost.c b/configs/ea3131/src/lpc31_usbhost.c index a1b86a759f..fe16aa1637 100644 --- a/configs/ea3131/src/lpc31_usbhost.c +++ b/configs/ea3131/src/lpc31_usbhost.c @@ -1,7 +1,7 @@ /************************************************************************************ * configs/ea3131/src/lpc31_usbhost.c * - * Copyright (C) 2013, 2015-2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2013, 2015-2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -82,12 +82,6 @@ static struct usbhost_connection_s *g_ehciconn; -/* Overcurrent interrupt handler */ - -#if 0 /* Not yet implemented */ -static xcpt_t g_ochandler; -#endif - /************************************************************************************ * Private Functions ************************************************************************************/ @@ -292,16 +286,16 @@ void lpc31_usbhost_vbusdrive(int rhport, bool enable) * * Input parameter: * handler - New overcurrent interrupt handler + * arg - The argument that will accompany the interrupt * * Returned value: - * Old overcurrent interrupt handler + * Zero (OK) returned on success; a negated errno value is returned on failure. * ************************************************************************************/ #if 0 /* Not ready yet */ -xcpt_t lpc31_setup_overcurrent(xcpt_t handler) +int lpc31_setup_overcurrent(xcpt_t handler, void *arg) { - xcpt_t oldhandler; irqstate_t flags; /* Disable interrupts until we are done. This guarantees that the @@ -310,18 +304,11 @@ xcpt_t lpc31_setup_overcurrent(xcpt_t handler) flags = enter_critical_section(); - /* Get the old button interrupt handler and save the new one */ - - oldhandler = g_ochandler; - g_ochandler = handler; - /* Configure the interrupt */ #warning Missing logic - /* Return the old button handler (so that it can be restored) */ - leave_critical_section(flags); - return oldhandler; + return OK; } #endif /* 0 */ diff --git a/configs/olimex-lpc-h3131/include/board.h b/configs/olimex-lpc-h3131/include/board.h index 395eddee2b..f9952ab740 100644 --- a/configs/olimex-lpc-h3131/include/board.h +++ b/configs/olimex-lpc-h3131/include/board.h @@ -1,7 +1,7 @@ /************************************************************************************ * configs/olimex-lpc-h3131/include/board.h * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -187,14 +187,15 @@ void lpc31_boardinitialize(void); * * Input parameter: * handler - New overcurrent interrupt handler + * arg - The argument that will accompany the interrupt * * Returned value: - * Old overcurrent interrupt handler + * Zero (OK) returned on success; a negated errno value is returned on failure. * ************************************************************************************/ #if 0 /* Not ready yet */ -xcpt_t lpc31_setup_overcurrent(xcpt_t handler); +int lpc31_setup_overcurrent(xcpt_t handler, void *arg); #endif #endif /* __ASSEMBLY__ */ diff --git a/configs/olimex-lpc-h3131/src/lpc31_usbhost.c b/configs/olimex-lpc-h3131/src/lpc31_usbhost.c index a52f94d458..18b865b7db 100644 --- a/configs/olimex-lpc-h3131/src/lpc31_usbhost.c +++ b/configs/olimex-lpc-h3131/src/lpc31_usbhost.c @@ -1,7 +1,7 @@ /************************************************************************************ * configs/olimex-lpc-h3131/src/lpc31_usbhost.c * - * Copyright (C) 2013, 2015-2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2013, 2015-2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -293,16 +293,16 @@ void lpc31_usbhost_vbusdrive(int rhport, bool enable) * * Input parameter: * handler - New overcurrent interrupt handler + * arg - The argument that will accompany the interrupt * * Returned value: - * Old overcurrent interrupt handler + * Zero (OK) returned on success; a negated errno value is returned on failure. * ************************************************************************************/ #if 0 /* Not ready yet */ -xcpt_t lpc31_setup_overcurrent(xcpt_t handler) +int lpc31_setup_overcurrent(xcpt_t handler, void *arg) { - xcpt_t oldhandler; irqstate_t flags; /* Disable interrupts until we are done. This guarantees that the @@ -311,16 +311,9 @@ xcpt_t lpc31_setup_overcurrent(xcpt_t handler) flags = enter_critical_section(); - /* Get the old button interrupt handler and save the new one */ - - oldhandler = g_ochandler; - g_ochandler = handler; - /* Configure the interrupt */ #warning Missing logic - /* Return the old button handler (so that it can be restored) */ - leave_critical_section(flags); return oldhandler; } diff --git a/configs/stm3210e-eval/README.txt b/configs/stm3210e-eval/README.txt index f249c3284d..62b78a4a9a 100644 --- a/configs/stm3210e-eval/README.txt +++ b/configs/stm3210e-eval/README.txt @@ -365,7 +365,7 @@ Temperature Sensor More complex temperature sensor operations are also available. See the IOCTL commands enumerated in include/nuttx/sensors/lm75.h. Also read the - escriptions of the stm32_lm75initialize() and stm32_lm75attach() + descriptions of the stm32_lm75initialize() and stm32_lm75attach() interfaces in the arch/board/board.h file (sames as configs/stm3210e-eval/include/board.h). diff --git a/configs/stm3210e-eval/include/board.h b/configs/stm3210e-eval/include/board.h index 087b762bc2..d5f9c13f38 100644 --- a/configs/stm3210e-eval/include/board.h +++ b/configs/stm3210e-eval/include/board.h @@ -1,7 +1,7 @@ /************************************************************************************ * configs/stm3210e-eval/include/board.h * - * Copyright (C) 2009, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2016-2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -289,14 +289,15 @@ int stm32_lm75initialize(FAR const char *devpath); * * Input parameters: * irqhandler - the LM-75 interrupt handler + * arg - The argument that will accompany the interrupt * * Returned Value: - * The previous LM-75 interrupt handler + * Zero (OK) returned on success; a negated errno value is returned on failure. * ************************************************************************************/ #if defined(CONFIG_I2C) && defined(CONFIG_I2C_LM75) && defined(CONFIG_STM32_I2C1) -xcpt_t stm32_lm75attach(xcpt_t irqhandler); +int stm32_lm75attach(xcpt_t irqhandler, void *arg); #endif #undef EXTERN diff --git a/configs/stm3210e-eval/src/stm32_lm75.c b/configs/stm3210e-eval/src/stm32_lm75.c index a238bf7d63..959dd6731c 100644 --- a/configs/stm3210e-eval/src/stm32_lm75.c +++ b/configs/stm3210e-eval/src/stm32_lm75.c @@ -106,15 +106,17 @@ int stm32_lm75initialize(FAR const char *devpath) * * Input parameters: * irqhandler - the LM-75 interrupt handler + * arg - The argument that will accompany the interrupt * * Returned Value: - * The previous LM-75 interrupt handler + * Zero (OK) returned on success; a negated errno value is returned on failure. * ************************************************************************************/ -xcpt_t stm32_lm75attach(xcpt_t irqhandler) +int stm32_lm75attach(xcpt_t irqhandler, void *arg) { - return stm32_gpiosetevent(GPIO_LM75_OSINT, true, true, true, irqhandler, NULL); + (void)stm32_gpiosetevent(GPIO_LM75_OSINT, true, true, true, irqhandler, arg); + return OK; } #endif /* CONFIG_I2C && CONFIG_I2C_LM75 && CONFIG_STM32_I2C1 */