diff --git a/TODO b/TODO index d19ac0f067a..8998fb1a464 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,4 @@ -NuttX TODO List (Last updated March 26, 2017) +NuttX TODO List (Last updated April 10, 2017) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This file summarizes known NuttX bugs, limitations, inconsistencies with @@ -108,9 +108,10 @@ o Task/Scheduler (sched/) 2. They run in supervisor mode (if applicable), and 3. They do not obey any setup of PIC or address environments. Do they need to? - 4. In the case of task_delete() and pthread_cancel(), these - callbacks will run on the thread of execution and address - context of the caller of task. That is very bad! + 4. In the case of task_delete() and pthread_cancel() without + defferred cancellation, these callbacks will run on the + thread of execution and address context of the caller of + task_delete() or pthread_cancel(). That is very bad! The fix for all of these issues it to have the callbacks run on the caller's thread as is currently done with diff --git a/arch/arm/src/stm32/stm32_comp.h b/arch/arm/src/stm32/stm32_comp.h index 16a0ad69713..ab28cac186a 100644 --- a/arch/arm/src/stm32/stm32_comp.h +++ b/arch/arm/src/stm32/stm32_comp.h @@ -44,6 +44,8 @@ #include "chip.h" +#ifdef CONFIG_STM32_COMP + #if defined(CONFIG_STM32_STM32F30XX) # error "COMP support for STM32F30XX not implemented yet" #elif defined(CONFIG_STM32_STM32F33XX) @@ -211,4 +213,5 @@ FAR struct comp_dev_s* stm32_compinitialize(int intf); #endif #endif /* __ASSEMBLY__ */ +#endif /* CONFIG_STM23_COMP */ #endif /* __ARCH_ARM_SRC_STM32_STM32_COMP_H */ diff --git a/configs/avr32dev1/src/avr32_buttons.c b/configs/avr32dev1/src/avr32_buttons.c index 427a19d8352..4514a800a5e 100644 --- a/configs/avr32dev1/src/avr32_buttons.c +++ b/configs/avr32dev1/src/avr32_buttons.c @@ -120,7 +120,7 @@ void board_button_initialize(void) * Description: * After board_button_initialize() has been called, board_buttons() may be * called to collect the state of all buttons. board_buttons() returns an - * 8-bit bit set with each bit associated with a button. See the BUTTON* + * 32-bit bit set with each bit associated with a button. See the BUTTON* * definitions in the board.h header file for the meaning of each bit in * the returned value. * diff --git a/configs/clicker2-stm32/src/stm32_buttons.c b/configs/clicker2-stm32/src/stm32_buttons.c index eb9a0310fce..5bcd3ba9e9e 100644 --- a/configs/clicker2-stm32/src/stm32_buttons.c +++ b/configs/clicker2-stm32/src/stm32_buttons.c @@ -111,7 +111,7 @@ uint32_t board_buttons(void) * handlers. * * After board_button_initialize() has been called, board_buttons() may be called to - * collect the state of all buttons. board_buttons() returns an 8-bit bit set + * collect the state of all buttons. board_buttons() returns an 32-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT * definitions in board.h for the meaning of each bit. * diff --git a/configs/cloudctrl/src/stm32_buttons.c b/configs/cloudctrl/src/stm32_buttons.c index 6603ce1d078..574e6a15817 100644 --- a/configs/cloudctrl/src/stm32_buttons.c +++ b/configs/cloudctrl/src/stm32_buttons.c @@ -145,7 +145,7 @@ uint32_t board_buttons(void) * * After board_button_initialize() has been called, board_buttons() may be * called to collect the state of all buttons. board_buttons() returns an - * 8-bit bit set with each bit associated with a button. See the + * 32-bit bit set with each bit associated with a button. See the * BUTTON_*_BIT and JOYSTICK_*_BIT definitions in board.h for the meaning * of each bit. * diff --git a/configs/dk-tm4c129x/src/tm4c_buttons.c b/configs/dk-tm4c129x/src/tm4c_buttons.c index 7ef91a768be..7a85cda8e84 100644 --- a/configs/dk-tm4c129x/src/tm4c_buttons.c +++ b/configs/dk-tm4c129x/src/tm4c_buttons.c @@ -137,7 +137,7 @@ uint32_t board_buttons(void) * handlers. * * After board_button_initialize() has been called, board_buttons() may be called to - * collect the state of all buttons. board_buttons() returns an 8-bit bit set + * collect the state of all buttons. board_buttons() returns an 32-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT * definitions in board.h for the meaning of each bit. * diff --git a/configs/fire-stm32v2/src/stm32_buttons.c b/configs/fire-stm32v2/src/stm32_buttons.c index 5c041230f98..d1fcbda1833 100644 --- a/configs/fire-stm32v2/src/stm32_buttons.c +++ b/configs/fire-stm32v2/src/stm32_buttons.c @@ -121,7 +121,7 @@ uint32_t board_buttons(void) * * After board_button_initialize() has been called, board_buttons() may be * called to collect the state of all buttons. board_buttons() returns an - * 8-bit bit set with each bit associated with a button. See the + * 32-bit bit set with each bit associated with a button. See the * BUTTON_*_BIT and JOYSTICK_*_BIT definitions in board.h for the meaning * of each bit. * diff --git a/configs/freedom-k64f/src/k64_buttons.c b/configs/freedom-k64f/src/k64_buttons.c index d6f6ea44d6d..53caa760b83 100644 --- a/configs/freedom-k64f/src/k64_buttons.c +++ b/configs/freedom-k64f/src/k64_buttons.c @@ -120,7 +120,7 @@ uint32_t board_buttons(void) * * After board_button_initialize() has been called, board_buttons() may * be called to collect the state of all buttons. board_buttons() returns - * an 8-bit bit set with each bit associated with a button. See the + * an 32-bit bit set with each bit associated with a button. See the * BUTTON_*_BIT and JOYSTICK_*_BIT definitions in board.h for the meaning * of each bit. * diff --git a/configs/freedom-k66f/src/k66_buttons.c b/configs/freedom-k66f/src/k66_buttons.c index ce63345c856..b186d40b412 100644 --- a/configs/freedom-k66f/src/k66_buttons.c +++ b/configs/freedom-k66f/src/k66_buttons.c @@ -124,7 +124,7 @@ uint32_t board_buttons(void) * * After board_button_initialize() has been called, board_buttons() may * be called to collect the state of all buttons. board_buttons() returns - * an 8-bit bit set with each bit associated with a button. See the + * an 32-bit bit set with each bit associated with a button. See the * BUTTON_*_BIT and JOYSTICK_*_BIT definitions in board.h for the meaning * of each bit. * diff --git a/configs/hymini-stm32v/src/stm32_buttons.c b/configs/hymini-stm32v/src/stm32_buttons.c index 757f159af74..4dac6fc8f41 100644 --- a/configs/hymini-stm32v/src/stm32_buttons.c +++ b/configs/hymini-stm32v/src/stm32_buttons.c @@ -120,7 +120,7 @@ uint32_t board_buttons(void) * * After board_button_initialize() has been called, board_buttons() may be * called to collect the state of all buttons. board_buttons() returns an - * 8-bit bit set with each bit associated with a button. See the + * 32-bit bit set with each bit associated with a button. See the * BUTTON_*_BIT and JOYSTICK_*_BIT definitions in board.h for the meaning * of each bit. * diff --git a/configs/kwikstik-k40/src/k40_buttons.c b/configs/kwikstik-k40/src/k40_buttons.c index 35f673d0ea0..c66c2d858cf 100644 --- a/configs/kwikstik-k40/src/k40_buttons.c +++ b/configs/kwikstik-k40/src/k40_buttons.c @@ -92,7 +92,7 @@ uint32_t board_buttons(void) * * After board_button_initialize() has been called, board_buttons() may be * called to collect the state of all buttons. board_buttons() returns an - * 8-bit bit set with each bit associated with a button. See the + * 32-bit bit set with each bit associated with a button. See the * BUTTON_*_BIT and JOYSTICK_*_BIT definitions in board.h for the meaning * of each bit. * diff --git a/configs/launchxl-tms57004/src/tms570_buttons.c b/configs/launchxl-tms57004/src/tms570_buttons.c index 3ee9e0eb31d..d84de8f63a4 100644 --- a/configs/launchxl-tms57004/src/tms570_buttons.c +++ b/configs/launchxl-tms57004/src/tms570_buttons.c @@ -154,7 +154,7 @@ void board_button_initialize(void) * Description: * After board_button_initialize() has been called, board_buttons() may be * called to collect the state of all buttons. board_buttons() returns an - * 8-bit bit set with each bit associated with a button. See the BUTTON* + * 32-bit bit set with each bit associated with a button. See the BUTTON* * definitions above for the meaning of each bit in the returned value. * ****************************************************************************/ diff --git a/configs/nucleo-144/src/stm32_buttons.c b/configs/nucleo-144/src/stm32_buttons.c index 5d47aa30bd9..a8783b4e20c 100644 --- a/configs/nucleo-144/src/stm32_buttons.c +++ b/configs/nucleo-144/src/stm32_buttons.c @@ -92,7 +92,7 @@ uint32_t board_buttons(void) * handlers. * * After board_button_initialize() has been called, board_buttons() may be called to - * collect the state of all buttons. board_buttons() returns an 8-bit bit set + * collect the state of all buttons. board_buttons() returns an 32-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT * definitions in board.h for the meaning of each bit. * diff --git a/configs/nucleo-f303re/src/stm32_buttons.c b/configs/nucleo-f303re/src/stm32_buttons.c index 8ae6081f489..e40db64c282 100644 --- a/configs/nucleo-f303re/src/stm32_buttons.c +++ b/configs/nucleo-f303re/src/stm32_buttons.c @@ -83,7 +83,7 @@ void board_button_initialize(void) * Description: * After board_button_initialize() has been called, board_buttons() may be * called to collect the state of all buttons. board_buttons() returns an - * 8-bit unsigned integer with each bit associated with a button. See the + * 32-bit unsigned integer with each bit associated with a button. See the * BUTTON_*_BIT definitions in board.h for the meaning of each bit. * ****************************************************************************/ diff --git a/configs/nucleo-f4x1re/src/stm32_buttons.c b/configs/nucleo-f4x1re/src/stm32_buttons.c index 30fd294fc59..fe18b0b2163 100644 --- a/configs/nucleo-f4x1re/src/stm32_buttons.c +++ b/configs/nucleo-f4x1re/src/stm32_buttons.c @@ -98,7 +98,7 @@ uint32_t board_buttons(void) * handlers. * * After board_button_initialize() has been called, board_buttons() may be called to - * collect the state of all buttons. board_buttons() returns an 8-bit bit set + * collect the state of all buttons. board_buttons() returns an 32-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT * definitions in board.h for the meaning of each bit. * diff --git a/configs/nucleo-l476rg/src/stm32_buttons.c b/configs/nucleo-l476rg/src/stm32_buttons.c index 55f99e8192b..456795c304e 100644 --- a/configs/nucleo-l476rg/src/stm32_buttons.c +++ b/configs/nucleo-l476rg/src/stm32_buttons.c @@ -98,7 +98,7 @@ uint32_t board_buttons(void) * handlers. * * After board_button_initialize() has been called, board_buttons() may be called to - * collect the state of all buttons. board_buttons() returns an 8-bit bit set + * collect the state of all buttons. board_buttons() returns an 32-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT * definitions in board.h for the meaning of each bit. * diff --git a/configs/olimex-efm32g880f128-stk/src/efm32_buttons.c b/configs/olimex-efm32g880f128-stk/src/efm32_buttons.c index 9637b125550..2863a332c18 100644 --- a/configs/olimex-efm32g880f128-stk/src/efm32_buttons.c +++ b/configs/olimex-efm32g880f128-stk/src/efm32_buttons.c @@ -120,7 +120,7 @@ void board_button_initialize(void) * Description: * After board_button_initialize() has been called, board_buttons() may be * called to collect the state of all buttons. board_buttons() returns an - * 8-bit bit set with each bit associated with a button. See the BUTTON* + * 32-bit bit set with each bit associated with a button. See the BUTTON* * definitions above for the meaning of each bit in the returned value. * ****************************************************************************/ diff --git a/configs/olimex-stm32-e407/src/stm32_buttons.c b/configs/olimex-stm32-e407/src/stm32_buttons.c index c57c54f42df..e52d296079b 100644 --- a/configs/olimex-stm32-e407/src/stm32_buttons.c +++ b/configs/olimex-stm32-e407/src/stm32_buttons.c @@ -121,7 +121,7 @@ uint32_t board_buttons(void) * * After board_button_initialize() has been called, board_buttons() may be * called to collect the state of all buttons. board_buttons() returns an - * 8-bit bit set with each bit associated with a button. See the BUTTON_*_BIT + * 32-bit bit set with each bit associated with a button. See the BUTTON_*_BIT * definitions in board.h for the meaning of each bit. * * board_button_irq() may be called to register an interrupt handler that diff --git a/configs/olimex-stm32-h405/src/stm32_buttons.c b/configs/olimex-stm32-h405/src/stm32_buttons.c index e7bd98cf23e..abcac85c801 100644 --- a/configs/olimex-stm32-h405/src/stm32_buttons.c +++ b/configs/olimex-stm32-h405/src/stm32_buttons.c @@ -120,7 +120,7 @@ uint32_t board_buttons(void) * handlers. * * After board_button_initialize() has been called, board_buttons() may be called to - * collect the state of all buttons. board_buttons() returns an 8-bit bit set + * collect the state of all buttons. board_buttons() returns an 32-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT * definitions in board.h for the meaning of each bit. * diff --git a/configs/olimex-stm32-h407/src/stm32_buttons.c b/configs/olimex-stm32-h407/src/stm32_buttons.c index 976157d1170..1155069e5ef 100644 --- a/configs/olimex-stm32-h407/src/stm32_buttons.c +++ b/configs/olimex-stm32-h407/src/stm32_buttons.c @@ -121,7 +121,7 @@ uint32_t board_buttons(void) * * After board_button_initialize() has been called, board_buttons() may be * called to collect the state of all buttons. board_buttons() returns an - * 8-bit bit set with each bit associated with a button. See the BUTTON_*_BIT + * 32-bit bit set with each bit associated with a button. See the BUTTON_*_BIT * definitions in board.h for the meaning of each bit. * * board_button_irq() may be called to register an interrupt handler that diff --git a/configs/olimex-stm32-p207/src/stm32_buttons.c b/configs/olimex-stm32-p207/src/stm32_buttons.c index 9400b7456c0..bde278810b0 100644 --- a/configs/olimex-stm32-p207/src/stm32_buttons.c +++ b/configs/olimex-stm32-p207/src/stm32_buttons.c @@ -156,7 +156,7 @@ uint32_t board_buttons(void) * handlers. * * After board_button_initialize() has been called, board_buttons() may be called to - * collect the state of all buttons. board_buttons() returns an 8-bit bit set + * collect the state of all buttons. board_buttons() returns an 32-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT * definitions in board.h for the meaning of each bit. * diff --git a/configs/olimex-stm32-p407/src/stm32_buttons.c b/configs/olimex-stm32-p407/src/stm32_buttons.c index 3d98c9eab7f..a7bf89714df 100644 --- a/configs/olimex-stm32-p407/src/stm32_buttons.c +++ b/configs/olimex-stm32-p407/src/stm32_buttons.c @@ -158,7 +158,7 @@ uint32_t board_buttons(void) * handlers. * * After board_button_initialize() has been called, board_buttons() may be called to - * collect the state of all buttons. board_buttons() returns an 8-bit bit set + * collect the state of all buttons. board_buttons() returns an 32-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT * definitions in board.h for the meaning of each bit. * diff --git a/configs/olimexino-stm32/src/stm32_buttons.c b/configs/olimexino-stm32/src/stm32_buttons.c index cc6ea25509c..092383cadeb 100644 --- a/configs/olimexino-stm32/src/stm32_buttons.c +++ b/configs/olimexino-stm32/src/stm32_buttons.c @@ -63,7 +63,7 @@ * * After board_button_initialize() has been called, board_buttons() may be * called to collect the state of all buttons. board_buttons() returns an - * 8-bit bit set with each bit associated with a button. + * 32-bit bit set with each bit associated with a button. * See the BUTTON_*_BIT definitions in board.h for the meaning of each bit. * * board_button_irq() may be called to register an interrupt handler that @@ -97,7 +97,7 @@ void board_button_initialize(void) * * After board_button_initialize() has been called, board_buttons() may be * called to collect the state of all buttons. board_buttons() returns an - * 8-bit bit set with each bit associated with a button. + * 32-bit bit set with each bit associated with a button. * See the BUTTON_*_BIT definitions in board.h for the meaning of each bit. * ****************************************************************************/ diff --git a/configs/pcduino-a10/src/a1x_buttons.c b/configs/pcduino-a10/src/a1x_buttons.c index c7d10891352..4d4feccc0f9 100644 --- a/configs/pcduino-a10/src/a1x_buttons.c +++ b/configs/pcduino-a10/src/a1x_buttons.c @@ -78,7 +78,7 @@ void board_button_initialize(void) * * Description: * After board_button_initialize() has been called, board_buttons() may be called to - * collect the state of all buttons. board_buttons() returns an 8-bit bit set + * collect the state of all buttons. board_buttons() returns an 32-bit bit set * with each bit associated with a button. See the BUTTON* definitions * above for the meaning of each bit in the returned value. * diff --git a/configs/photon/src/stm32_bringup.c b/configs/photon/src/stm32_bringup.c index d83e0493edd..d55f3bc2915 100644 --- a/configs/photon/src/stm32_bringup.c +++ b/configs/photon/src/stm32_bringup.c @@ -40,6 +40,7 @@ #include #include +#include #include #include @@ -70,7 +71,17 @@ int stm32_bringup(void) { int ret = OK; -#ifdef CONFIG_USERLED +#ifdef CONFIG_FS_PROCFS + /* Mount the procfs file system */ + + ret = mount(NULL, "/proc", "procfs", 0, NULL); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); + } +#endif + +#if defined(CONFIG_USERLED) && !defined(CONFIG_ARCH_LEDS) #ifdef CONFIG_USERLED_LOWER /* Register the LED driver */ @@ -81,9 +92,11 @@ int stm32_bringup(void) return ret; } #else + /* Enable USER LED support for some other purpose */ + board_userled_initialize(); #endif /* CONFIG_USERLED_LOWER */ -#endif /* CONFIG_USERLED */ +#endif /* CONFIG_USERLED && !CONFIG_ARCH_LEDS */ #ifdef CONFIG_BUTTONS #ifdef CONFIG_BUTTONS_LOWER @@ -96,16 +109,19 @@ int stm32_bringup(void) return ret; } #else + /* Enable BUTTON support for some other purpose */ + board_button_initialize(); #endif /* CONFIG_BUTTONS_LOWER */ #endif /* CONFIG_BUTTONS */ #ifdef CONFIG_STM32_IWDG + /* Initialize the watchdog timer */ + stm32_iwdginitialize("/dev/watchdog0", STM32_LSI_FREQUENCY); #endif #ifdef CONFIG_PHOTON_WDG - /* Start WDG kicker thread */ ret = photon_watchdog_initialize(); @@ -117,7 +133,6 @@ int stm32_bringup(void) #endif #ifdef CONFIG_PHOTON_WLAN - /* Initialize wlan driver and hardware */ ret = photon_wlan_initialize(); diff --git a/configs/pic32mz-starterkit/src/pic32mz_buttons.c b/configs/pic32mz-starterkit/src/pic32mz_buttons.c index 206be294c31..639844a953b 100644 --- a/configs/pic32mz-starterkit/src/pic32mz_buttons.c +++ b/configs/pic32mz-starterkit/src/pic32mz_buttons.c @@ -140,7 +140,7 @@ uint32_t board_buttons(void) * * After board_button_initialize() has been called, board_buttons() may be * called to collect the state of all buttons. board_buttons() returns an - * 8-bit bit set with each bit associated with a button. See the + * 32-bit bit set with each bit associated with a button. See the * BUTTON_*_BIT definitions in board.h for the meaning of each bit. * * board_button_irq() may be called to register an interrupt handler that diff --git a/configs/sam3u-ek/src/sam_buttons.c b/configs/sam3u-ek/src/sam_buttons.c index 107c7036a66..19a00d97ece 100644 --- a/configs/sam3u-ek/src/sam_buttons.c +++ b/configs/sam3u-ek/src/sam_buttons.c @@ -127,7 +127,7 @@ void board_button_initialize(void) * * Description: * After board_button_initialize() has been called, board_buttons() may be called to collect - * the state of all buttons. board_buttons() returns an 8-bit bit set with each bit + * the state of all buttons. board_buttons() returns an 32-bit bit set with each bit * associated with a button. See the BUTTON* definitions above for the meaning of * each bit in the returned value. * diff --git a/configs/sam4e-ek/src/sam_buttons.c b/configs/sam4e-ek/src/sam_buttons.c index 53626290b7b..ed3690782a2 100644 --- a/configs/sam4e-ek/src/sam_buttons.c +++ b/configs/sam4e-ek/src/sam_buttons.c @@ -130,7 +130,7 @@ void board_button_initialize(void) * Description: * After board_button_initialize() has been called, board_buttons() may be * called to collect the state of all buttons. board_buttons() returns an - * 8-bit bit set with each bit associated with a button. See the BUTTON* + * 32-bit bit set with each bit associated with a button. See the BUTTON* * definitions above for the meaning of each bit in the returned value. * ****************************************************************************/ diff --git a/configs/sam4l-xplained/src/sam_buttons.c b/configs/sam4l-xplained/src/sam_buttons.c index 8d306bb3117..78949a1cde0 100644 --- a/configs/sam4l-xplained/src/sam_buttons.c +++ b/configs/sam4l-xplained/src/sam_buttons.c @@ -79,7 +79,7 @@ void board_button_initialize(void) * Description: * After board_button_initialize() has been called, board_buttons() may be * called to collect the state of all buttons. board_buttons() returns an - * 8-bit bit set with each bit associated with a button. See the BUTTON* + * 32-bit bit set with each bit associated with a button. See the BUTTON* * definitions above for the meaning of each bit in the returned value. * ****************************************************************************/ diff --git a/configs/sam4s-xplained-pro/src/sam_buttons.c b/configs/sam4s-xplained-pro/src/sam_buttons.c index 3b9b4fe3597..f19f29894ea 100644 --- a/configs/sam4s-xplained-pro/src/sam_buttons.c +++ b/configs/sam4s-xplained-pro/src/sam_buttons.c @@ -81,7 +81,7 @@ void board_button_initialize(void) * Description: * After board_button_initialize() has been called, board_buttons() may be * called to collect the state of all buttons. board_buttons() returns an - * 8-bit bit set with each bit associated with a button. See the BUTTON* + * 32-bit bit set with each bit associated with a button. See the BUTTON* * definitions above for the meaning of each bit in the returned value. * ****************************************************************************/ diff --git a/configs/sam4s-xplained/src/sam_buttons.c b/configs/sam4s-xplained/src/sam_buttons.c index 314e8e1818a..5b979a1aa95 100644 --- a/configs/sam4s-xplained/src/sam_buttons.c +++ b/configs/sam4s-xplained/src/sam_buttons.c @@ -80,7 +80,7 @@ void board_button_initialize(void) * Description: * After board_button_initialize() has been called, board_buttons() may be * called to collect the state of all buttons. board_buttons() returns an - * 8-bit bit set with each bit associated with a button. See the BUTTON* + * 32-bit bit set with each bit associated with a button. See the BUTTON* * definitions above for the meaning of each bit in the returned value. * ****************************************************************************/ diff --git a/configs/sama5d2-xult/src/sam_buttons.c b/configs/sama5d2-xult/src/sam_buttons.c index 0939ddaa11d..56548f34804 100644 --- a/configs/sama5d2-xult/src/sam_buttons.c +++ b/configs/sama5d2-xult/src/sam_buttons.c @@ -91,7 +91,7 @@ void board_button_initialize(void) * Description: * After board_button_initialize() has been called, board_buttons() may be * called to collect the state of all buttons. board_buttons() returns an - * 8-bit bit set with each bit associated with a button. See the BUTTON* + * 32-bit bit set with each bit associated with a button. See the BUTTON* * definitions above for the meaning of each bit in the returned value. * ****************************************************************************/ diff --git a/configs/sama5d3-xplained/src/sam_buttons.c b/configs/sama5d3-xplained/src/sam_buttons.c index 43794b374da..768b7b5db7c 100644 --- a/configs/sama5d3-xplained/src/sam_buttons.c +++ b/configs/sama5d3-xplained/src/sam_buttons.c @@ -95,7 +95,7 @@ void board_button_initialize(void) * Description: * After board_button_initialize() has been called, board_buttons() may be * called to collect the state of all buttons. board_buttons() returns an - * 8-bit bit set with each bit associated with a button. See the BUTTON* + * 32-bit bit set with each bit associated with a button. See the BUTTON* * definitions above for the meaning of each bit in the returned value. * ****************************************************************************/ diff --git a/configs/sama5d3x-ek/src/sam_buttons.c b/configs/sama5d3x-ek/src/sam_buttons.c index dbdaa310f67..e76fcd2a0ab 100644 --- a/configs/sama5d3x-ek/src/sam_buttons.c +++ b/configs/sama5d3x-ek/src/sam_buttons.c @@ -95,7 +95,7 @@ void board_button_initialize(void) * Description: * After board_button_initialize() has been called, board_buttons() may be * called to collect the state of all buttons. board_buttons() returns an - * 8-bit bit set with each bit associated with a button. See the BUTTON* + * 32-bit bit set with each bit associated with a button. See the BUTTON* * definitions above for the meaning of each bit in the returned value. * ****************************************************************************/ diff --git a/configs/sama5d4-ek/src/sam_buttons.c b/configs/sama5d4-ek/src/sam_buttons.c index 4ccae619f60..90dff73b160 100644 --- a/configs/sama5d4-ek/src/sam_buttons.c +++ b/configs/sama5d4-ek/src/sam_buttons.c @@ -91,7 +91,7 @@ void board_button_initialize(void) * Description: * After board_button_initialize() has been called, board_buttons() may be * called to collect the state of all buttons. board_buttons() returns an - * 8-bit bit set with each bit associated with a button. See the BUTTON* + * 32-bit bit set with each bit associated with a button. See the BUTTON* * definitions above for the meaning of each bit in the returned value. * ****************************************************************************/ diff --git a/configs/samd20-xplained/src/sam_buttons.c b/configs/samd20-xplained/src/sam_buttons.c index fc8f14bd0ce..334bf8b4038 100644 --- a/configs/samd20-xplained/src/sam_buttons.c +++ b/configs/samd20-xplained/src/sam_buttons.c @@ -79,7 +79,7 @@ void board_button_initialize(void) * * Description: * After board_button_initialize() has been called, board_buttons() may be called to collect - * the state of all buttons. board_buttons() returns an 8-bit bit set with each bit + * the state of all buttons. board_buttons() returns an 32-bit bit set with each bit * associated with a button. See the BUTTON* definitions above for the meaning of * each bit in the returned value. * diff --git a/configs/samd21-xplained/src/sam_buttons.c b/configs/samd21-xplained/src/sam_buttons.c index e4c31aa941e..8e1789d1c9d 100644 --- a/configs/samd21-xplained/src/sam_buttons.c +++ b/configs/samd21-xplained/src/sam_buttons.c @@ -79,7 +79,7 @@ void board_button_initialize(void) * * Description: * After board_button_initialize() has been called, board_buttons() may be called to collect - * the state of all buttons. board_buttons() returns an 8-bit bit set with each bit + * the state of all buttons. board_buttons() returns an 32-bit bit set with each bit * associated with a button. See the BUTTON* definitions above for the meaning of * each bit in the returned value. * diff --git a/configs/same70-xplained/src/sam_buttons.c b/configs/same70-xplained/src/sam_buttons.c index 7e66905c8a1..ab7dfeb8cfc 100644 --- a/configs/same70-xplained/src/sam_buttons.c +++ b/configs/same70-xplained/src/sam_buttons.c @@ -142,7 +142,7 @@ void board_button_initialize(void) * Description: * After board_button_initialize() has been called, board_buttons() may be * called to collect the state of all buttons. board_buttons() returns an - * 8-bit bit set with each bit associated with a button. See the BUTTON* + * 32-bit bit set with each bit associated with a button. See the BUTTON* * definitions above for the meaning of each bit in the returned value. * ****************************************************************************/ diff --git a/configs/saml21-xplained/src/sam_buttons.c b/configs/saml21-xplained/src/sam_buttons.c index 909fa58a7a7..407b24bb4d9 100644 --- a/configs/saml21-xplained/src/sam_buttons.c +++ b/configs/saml21-xplained/src/sam_buttons.c @@ -79,7 +79,7 @@ void board_button_initialize(void) * * Description: * After board_button_initialize() has been called, board_buttons() may be called to collect - * the state of all buttons. board_buttons() returns an 8-bit bit set with each bit + * the state of all buttons. board_buttons() returns an 32-bit bit set with each bit * associated with a button. See the BUTTON* definitions above for the meaning of * each bit in the returned value. * diff --git a/configs/samv71-xult/src/sam_buttons.c b/configs/samv71-xult/src/sam_buttons.c index 1a06c840342..adcd280d73f 100644 --- a/configs/samv71-xult/src/sam_buttons.c +++ b/configs/samv71-xult/src/sam_buttons.c @@ -158,7 +158,7 @@ void board_button_initialize(void) * Description: * After board_button_initialize() has been called, board_buttons() may be * called to collect the state of all buttons. board_buttons() returns an - * 8-bit bit set with each bit associated with a button. See the BUTTON* + * 32-bit bit set with each bit associated with a button. See the BUTTON* * definitions above for the meaning of each bit in the returned value. * ****************************************************************************/ diff --git a/configs/shenzhou/src/stm32_buttons.c b/configs/shenzhou/src/stm32_buttons.c index 139d517956f..57053359b8f 100644 --- a/configs/shenzhou/src/stm32_buttons.c +++ b/configs/shenzhou/src/stm32_buttons.c @@ -136,7 +136,7 @@ uint32_t board_buttons(void) * handlers. * * After board_button_initialize() has been called, board_buttons() may be called to - * collect the state of all buttons. board_buttons() returns an 8-bit bit set + * collect the state of all buttons. board_buttons() returns an 32-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT * definitions in board.h for the meaning of each bit. * diff --git a/configs/spark/src/stm32_buttons.c b/configs/spark/src/stm32_buttons.c index 3ab2f3c8546..3534eeeb6ac 100644 --- a/configs/spark/src/stm32_buttons.c +++ b/configs/spark/src/stm32_buttons.c @@ -95,7 +95,7 @@ uint32_t board_buttons(void) * handlers. * * After board_button_initialize() has been called, board_buttons() may be called to - * collect the state of all buttons. board_buttons() returns an 8-bit bit set + * collect the state of all buttons. board_buttons() returns an 32-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT * definitions in board.h for the meaning of each bit. * diff --git a/configs/stm3210e-eval/src/stm32_buttons.c b/configs/stm3210e-eval/src/stm32_buttons.c index b9f48228143..f6a8575881f 100644 --- a/configs/stm3210e-eval/src/stm32_buttons.c +++ b/configs/stm3210e-eval/src/stm32_buttons.c @@ -148,7 +148,7 @@ uint32_t board_buttons(void) * handlers. * * After board_button_initialize() has been called, board_buttons() may be called to - * collect the state of all buttons. board_buttons() returns an 8-bit bit set + * collect the state of all buttons. board_buttons() returns an 32-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT * definitions in board.h for the meaning of each bit. * diff --git a/configs/stm3220g-eval/src/stm32_buttons.c b/configs/stm3220g-eval/src/stm32_buttons.c index 669b460b032..9bec8f3c10b 100644 --- a/configs/stm3220g-eval/src/stm32_buttons.c +++ b/configs/stm3220g-eval/src/stm32_buttons.c @@ -136,7 +136,7 @@ uint32_t board_buttons(void) * handlers. * * After board_button_initialize() has been called, board_buttons() may be called to - * collect the state of all buttons. board_buttons() returns an 8-bit bit set + * collect the state of all buttons. board_buttons() returns an 32-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT * definitions in board.h for the meaning of each bit. * diff --git a/configs/stm3240g-eval/src/stm32_buttons.c b/configs/stm3240g-eval/src/stm32_buttons.c index 4682ffb1a9f..c543a0b6acb 100644 --- a/configs/stm3240g-eval/src/stm32_buttons.c +++ b/configs/stm3240g-eval/src/stm32_buttons.c @@ -144,7 +144,7 @@ uint32_t board_buttons(void) * handlers. * * After board_button_initialize() has been called, board_buttons() may be called to - * collect the state of all buttons. board_buttons() returns an 8-bit bit set + * collect the state of all buttons. board_buttons() returns an 32-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT * definitions in board.h for the meaning of each bit. * diff --git a/configs/stm32f103-minimum/src/stm32_buttons.c b/configs/stm32f103-minimum/src/stm32_buttons.c index 6891b3db0a6..154f24225e8 100644 --- a/configs/stm32f103-minimum/src/stm32_buttons.c +++ b/configs/stm32f103-minimum/src/stm32_buttons.c @@ -140,7 +140,7 @@ uint32_t board_buttons(void) * * After board_button_initialize() has been called, board_buttons() may be * called to collect the state of all buttons. board_buttons() returns - * an 8-bit bit set with each bit associated with a button. See the + * an 32-bit bit set with each bit associated with a button. See the * BUTTON_*_BIT definitions in board.h for the meaning of each bit. * * board_button_irq() may be called to register an interrupt handler that diff --git a/configs/stm32f3discovery/src/stm32_buttons.c b/configs/stm32f3discovery/src/stm32_buttons.c index a0ecada6a5a..a17912bdbd6 100644 --- a/configs/stm32f3discovery/src/stm32_buttons.c +++ b/configs/stm32f3discovery/src/stm32_buttons.c @@ -131,7 +131,7 @@ uint32_t board_buttons(void) * handlers. * * After board_button_initialize() has been called, board_buttons() may be called to - * collect the state of all buttons. board_buttons() returns an 8-bit bit set + * collect the state of all buttons. board_buttons() returns an 32-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT * definitions in board.h for the meaning of each bit. * diff --git a/configs/stm32f429i-disco/src/stm32_buttons.c b/configs/stm32f429i-disco/src/stm32_buttons.c index d2e9ba2e095..c5ce618d0c7 100644 --- a/configs/stm32f429i-disco/src/stm32_buttons.c +++ b/configs/stm32f429i-disco/src/stm32_buttons.c @@ -131,7 +131,7 @@ uint32_t board_buttons(void) * handlers. * * After board_button_initialize() has been called, board_buttons() may be called to - * collect the state of all buttons. board_buttons() returns an 8-bit bit set + * collect the state of all buttons. board_buttons() returns an 32-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT * definitions in board.h for the meaning of each bit. * diff --git a/configs/stm32f4discovery/src/stm32_buttons.c b/configs/stm32f4discovery/src/stm32_buttons.c index 2d86ea80cf7..2b805075e00 100644 --- a/configs/stm32f4discovery/src/stm32_buttons.c +++ b/configs/stm32f4discovery/src/stm32_buttons.c @@ -131,7 +131,7 @@ uint32_t board_buttons(void) * handlers. * * After board_button_initialize() has been called, board_buttons() may be called to - * collect the state of all buttons. board_buttons() returns an 8-bit bit set + * collect the state of all buttons. board_buttons() returns an 32-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT * definitions in board.h for the meaning of each bit. * diff --git a/configs/stm32f746g-disco/src/stm32_buttons.c b/configs/stm32f746g-disco/src/stm32_buttons.c index b8a46a8dacd..42faf1d90f3 100644 --- a/configs/stm32f746g-disco/src/stm32_buttons.c +++ b/configs/stm32f746g-disco/src/stm32_buttons.c @@ -92,7 +92,7 @@ uint32_t board_buttons(void) * handlers. * * After board_button_initialize() has been called, board_buttons() may be called to - * collect the state of all buttons. board_buttons() returns an 8-bit bit set + * collect the state of all buttons. board_buttons() returns an 32-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT * definitions in board.h for the meaning of each bit. * diff --git a/configs/stm32l476-mdk/src/stm32_buttons.c b/configs/stm32l476-mdk/src/stm32_buttons.c index 7debe3c5970..58e9079153d 100644 --- a/configs/stm32l476-mdk/src/stm32_buttons.c +++ b/configs/stm32l476-mdk/src/stm32_buttons.c @@ -138,7 +138,7 @@ uint32_t board_buttons(void) * * After board_button_initialize() has been called, board_buttons() may be * called to collect the state of all buttons. board_buttons() returns an - * 8-bit bit set with each bit associated with a button. See the + * 32-bit bit set with each bit associated with a button. See the * BUTTON_*_BIT definitions in board.h for the meaning of each bit. * * board_button_irq() may be called to register an interrupt handler that diff --git a/configs/stm32l476vg-disco/src/stm32_buttons.c b/configs/stm32l476vg-disco/src/stm32_buttons.c index f3c4d50c9c5..18b984d2c1f 100644 --- a/configs/stm32l476vg-disco/src/stm32_buttons.c +++ b/configs/stm32l476vg-disco/src/stm32_buttons.c @@ -306,7 +306,7 @@ uint32_t board_buttons(void) * handlers. * * After board_button_initialize() has been called, board_buttons() may be called to - * collect the state of all buttons. board_buttons() returns an 8-bit bit set + * collect the state of all buttons. board_buttons() returns an 32-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT * definitions in board.h for the meaning of each bit. * diff --git a/configs/stm32ldiscovery/src/stm32_buttons.c b/configs/stm32ldiscovery/src/stm32_buttons.c index f766017d150..d985c9f4d3d 100644 --- a/configs/stm32ldiscovery/src/stm32_buttons.c +++ b/configs/stm32ldiscovery/src/stm32_buttons.c @@ -131,7 +131,7 @@ uint32_t board_buttons(void) * handlers. * * After board_button_initialize() has been called, board_buttons() may be called to - * collect the state of all buttons. board_buttons() returns an 8-bit bit set + * collect the state of all buttons. board_buttons() returns an 32-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT * definitions in board.h for the meaning of each bit. * diff --git a/configs/stm32vldiscovery/src/stm32_buttons.c b/configs/stm32vldiscovery/src/stm32_buttons.c index 9784b19d773..95d9f1590c5 100644 --- a/configs/stm32vldiscovery/src/stm32_buttons.c +++ b/configs/stm32vldiscovery/src/stm32_buttons.c @@ -94,7 +94,7 @@ uint32_t board_buttons(void) * handlers. * * After board_button_initialize() has been called, board_buttons() may be called to - * collect the state of all buttons. board_buttons() returns an 8-bit bit set + * collect the state of all buttons. board_buttons() returns an 32-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT * definitions in board.h for the meaning of each bit. * diff --git a/configs/sure-pic32mx/src/pic32mx_buttons.c b/configs/sure-pic32mx/src/pic32mx_buttons.c index bf5ca03429e..e2ee0ac2195 100644 --- a/configs/sure-pic32mx/src/pic32mx_buttons.c +++ b/configs/sure-pic32mx/src/pic32mx_buttons.c @@ -185,7 +185,7 @@ uint32_t board_buttons(void) * handlers. * * After board_button_initialize() has been called, board_buttons() may be called to - * collect the state of all buttons. board_buttons() returns an 8-bit bit set + * collect the state of all buttons. board_buttons() returns an 32-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT * definitions in board.h for the meaning of each bit. * diff --git a/configs/tm4c123g-launchpad/src/tm4c_buttons.c b/configs/tm4c123g-launchpad/src/tm4c_buttons.c index 96370046f48..24eb21ea04a 100644 --- a/configs/tm4c123g-launchpad/src/tm4c_buttons.c +++ b/configs/tm4c123g-launchpad/src/tm4c_buttons.c @@ -113,7 +113,7 @@ void board_button_initialize(void) * Description: * After board_button_initialize() has been called, board_buttons() may be * called to collect the state of all buttons. board_buttons() returns an - * 8-bit bit set with each bit associated with a button. See the BUTTON* + * 32-bit bit set with each bit associated with a button. See the BUTTON* * definitions above for the meaning of each bit in the returned value. * ****************************************************************************/ diff --git a/configs/tm4c123g-launchpad/src/tm4c_ssi.c b/configs/tm4c123g-launchpad/src/tm4c_ssi.c index 7b295f76aa8..ce8ce7021c6 100644 --- a/configs/tm4c123g-launchpad/src/tm4c_ssi.c +++ b/configs/tm4c123g-launchpad/src/tm4c_ssi.c @@ -59,7 +59,7 @@ * Pre-processor Definitions ************************************************************************************/ -#ifdef CONFIG_DEBUG_SPI_INFO) +#ifdef CONFIG_DEBUG_SPI_INFO # define ssi_dumpgpio(m) tiva_dumpgpio(SDCCS_GPIO, m) #else # define ssi_dumpgpio(m) diff --git a/configs/twr-k60n512/src/k60_buttons.c b/configs/twr-k60n512/src/k60_buttons.c index d9206f2c71a..99bee759102 100644 --- a/configs/twr-k60n512/src/k60_buttons.c +++ b/configs/twr-k60n512/src/k60_buttons.c @@ -121,7 +121,7 @@ uint32_t board_buttons(void) * handlers. * * After board_button_initialize() has been called, board_buttons() may be called to - * collect the state of all buttons. board_buttons() returns an 8-bit bit set + * collect the state of all buttons. board_buttons() returns an 32-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT * definitions in board.h for the meaning of each bit. * diff --git a/configs/ubw32/src/pic32_buttons.c b/configs/ubw32/src/pic32_buttons.c index 69b1deeb442..469167f1379 100644 --- a/configs/ubw32/src/pic32_buttons.c +++ b/configs/ubw32/src/pic32_buttons.c @@ -160,7 +160,7 @@ uint32_t board_buttons(void) * handlers. * * After board_button_initialize() has been called, board_buttons() may be called to - * collect the state of all buttons. board_buttons() returns an 8-bit bit set + * collect the state of all buttons. board_buttons() returns an 32-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT definitions in * board.h for the meaning of each bit. * diff --git a/configs/viewtool-stm32f107/src/stm32_buttons.c b/configs/viewtool-stm32f107/src/stm32_buttons.c index 9e39a2d72c4..086a321755a 100644 --- a/configs/viewtool-stm32f107/src/stm32_buttons.c +++ b/configs/viewtool-stm32f107/src/stm32_buttons.c @@ -132,7 +132,7 @@ uint32_t board_buttons(void) * handlers. * * After board_button_initialize() has been called, board_buttons() may be called to - * collect the state of all buttons. board_buttons() returns an 8-bit bit set + * collect the state of all buttons. board_buttons() returns an 32-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT * definitions in board.h for the meaning of each bit. * diff --git a/configs/zkit-arm-1769/src/lpc17_buttons.c b/configs/zkit-arm-1769/src/lpc17_buttons.c index ffa76466861..e93f27734f7 100644 --- a/configs/zkit-arm-1769/src/lpc17_buttons.c +++ b/configs/zkit-arm-1769/src/lpc17_buttons.c @@ -142,7 +142,7 @@ uint32_t board_buttons(void) * handlers. * * After board_button_initialize() has been called, board_buttons() may be called to - * collect the state of all buttons. board_buttons() returns an 8-bit bit set + * collect the state of all buttons. board_buttons() returns an 32-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT * definitions in board.h for the meaning of each bit. * diff --git a/include/nuttx/board.h b/include/nuttx/board.h index 310a973c341..c00d09ce3c2 100644 --- a/include/nuttx/board.h +++ b/include/nuttx/board.h @@ -581,7 +581,7 @@ void board_button_initialize(void); * Description: * After board_button_initialize() has been called, board_buttons() may be * called to collect the state of all buttons. board_buttons() returns an - * 8-bit bit set with each bit associated with a button. A bit set to + * 32-bit bit set with each bit associated with a button. A bit set to * "1" means that the button is depressed; a bit set to "0" means that * the button is released. The correspondence of the each button bit * and physical buttons is board-specific. diff --git a/include/nuttx/wireless/wireless.h b/include/nuttx/wireless/wireless.h index 6ab0b0b3d11..74908e7350b 100644 --- a/include/nuttx/wireless/wireless.h +++ b/include/nuttx/wireless/wireless.h @@ -203,6 +203,22 @@ #define IW_ESSID_MAX_SIZE 32 +/* Modes of operation */ + +#define IW_MODE_AUTO 0 /* Let the driver decides */ +#define IW_MODE_ADHOC 1 /* Single cell network */ +#define IW_MODE_INFRA 2 /* Multi cell network, roaming, ... */ +#define IW_MODE_MASTER 3 /* Synchronisation master or Access Point */ +#define IW_MODE_REPEAT 4 /* Wireless Repeater (forwarder) */ +#define IW_MODE_SECOND 5 /* Secondary master/repeater (backup) */ +#define IW_MODE_MONITOR 6 /* Passive monitor (listen only) */ +#define IW_MODE_MESH 7 /* Mesh (IEEE 802.11s) network */ + +/* Frequency flags */ + +#define IW_FREQ_AUTO 0x00 /* Let the driver decides */ +#define IW_FREQ_FIXED 0x01 /* Force a specific value */ + /************************************************************************************ * Public Types ************************************************************************************/ @@ -303,8 +319,8 @@ union iwreq_data struct iwreq { - char ifrn_name[IFNAMSIZ]; /* Interface name, e.g. "eth0" */ - union iwreq_data u; /* Data payload */ + char ifrn_name[IFNAMSIZ]; /* Interface name, e.g. "eth0" */ + union iwreq_data u; /* Data payload */ }; #endif /* CONFIG_DRIVERS_WIRELESS */ diff --git a/libc/pthread/pthread_rwlock_rdlock.c b/libc/pthread/pthread_rwlock_rdlock.c index 9fd461a758e..4eadfedccb5 100644 --- a/libc/pthread/pthread_rwlock_rdlock.c +++ b/libc/pthread/pthread_rwlock_rdlock.c @@ -1,5 +1,5 @@ /**************************************************************************** - * libc/pthread/pthread_rwlockread.c + * libc/pthread/pthread_rwlock_rdlock.c * * Copyright (C) 2017 Mark Schulte. All rights reserved. * Author: Mark Schulte @@ -50,6 +50,15 @@ * Private Functions ****************************************************************************/ +#ifdef CONFIG_PTHREAD_CLEANUP +static void rdlock_cleanup(FAR void *arg) +{ + FAR pthread_rwlock_t *rw_lock = (FAR pthread_rwlock_t *)arg; + + (void)pthread_mutex_unlock(&rw_lock->lock); +} +#endif + static int tryrdlock(FAR pthread_rwlock_t *rw_lock) { int err; @@ -116,6 +125,9 @@ int pthread_rwlock_timedrdlock(FAR pthread_rwlock_t *rw_lock, return err; } +#ifdef CONFIG_PTHREAD_CLEANUP + pthread_cleanup_push(&rdlock_cleanup, rw_lock); +#endif while ((err = tryrdlock(rw_lock)) == EBUSY) { if (ts != NULL) @@ -132,6 +144,9 @@ int pthread_rwlock_timedrdlock(FAR pthread_rwlock_t *rw_lock, break; } } +#ifdef CONFIG_PTHREAD_CLEANUP + pthread_cleanup_pop(0); +#endif pthread_mutex_unlock(&rw_lock->lock); return err; diff --git a/libc/pthread/pthread_rwlock_wrlock.c b/libc/pthread/pthread_rwlock_wrlock.c index ecda4cb25be..c9f4f3a7c56 100644 --- a/libc/pthread/pthread_rwlock_wrlock.c +++ b/libc/pthread/pthread_rwlock_wrlock.c @@ -1,5 +1,5 @@ /**************************************************************************** - * libc/pthread/pthread_rwlockwrite.c + * libc/pthread/pthread_rwlock_wrlock.c * * Copyright (C) 2017 Mark Schulte. All rights reserved. * Author: Mark Schulte @@ -46,15 +46,29 @@ #include +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +#ifdef CONFIG_PTHREAD_CLEANUP +static void wrlock_cleanup(FAR void *arg) +{ + FAR pthread_rwlock_t *rw_lock = (FAR pthread_rwlock_t *)arg; + + rw_lock->num_writers--; + (void)pthread_mutex_unlock(&rw_lock->lock); +} +#endif + /**************************************************************************** * Public Functions ****************************************************************************/ /**************************************************************************** - * Name: pthread_rwlock_rdlock + * Name: pthread_rwlock_wrlock * * Description: - * Locks a read/write lock for reading + * Locks a read/write lock for writing * * Parameters: * None @@ -106,6 +120,9 @@ int pthread_rwlock_timedwrlock(FAR pthread_rwlock_t *rw_lock, rw_lock->num_writers++; +#ifdef CONFIG_PTHREAD_CLEANUP + pthread_cleanup_push(&wrlock_cleanup, rw_lock); +#endif while (rw_lock->write_in_progress || rw_lock->num_readers > 0) { if (ts != NULL) @@ -122,12 +139,14 @@ int pthread_rwlock_timedwrlock(FAR pthread_rwlock_t *rw_lock, break; } } +#ifdef CONFIG_PTHREAD_CLEANUP + pthread_cleanup_pop(0); +#endif if (err == 0) { rw_lock->write_in_progress = true; } - else { /* In case of error, notify any blocked readers. */ diff --git a/net/procfs/netdev_statistics.c b/net/procfs/netdev_statistics.c index b2b83da8012..f4927eab2fe 100644 --- a/net/procfs/netdev_statistics.c +++ b/net/procfs/netdev_statistics.c @@ -62,7 +62,9 @@ static int netprocfs_linklayer(FAR struct netprocfs_file_s *netfile); static int netprocfs_ipaddresses(FAR struct netprocfs_file_s *netfile); - +#ifdef CONFIG_NET_IPv6 +static int netprocfs_dripaddress(FAR struct netprocfs_file_s *netfile); +#endif #ifdef CONFIG_NETDEV_STATISTICS static int netprocfs_rxstatistics_header(FAR struct netprocfs_file_s *netfile); static int netprocfs_rxstatistics(FAR struct netprocfs_file_s *netfile); @@ -83,6 +85,9 @@ static const linegen_t g_linegen[] = { netprocfs_linklayer, netprocfs_ipaddresses +#ifdef CONFIG_NET_IPv6 + , netprocfs_dripaddress +#endif #ifdef CONFIG_NETDEV_STATISTICS , netprocfs_rxstatistics_header, netprocfs_rxstatistics, @@ -292,7 +297,7 @@ static int netprocfs_ipaddresses(FAR struct netprocfs_file_s *netfile) addr.s_addr = dev->d_netmask; len += snprintf(&netfile->line[len], NET_LINELEN - len, - "Mask:%s\n", inet_ntoa(addr)); + "Mask:%s\n\n", inet_ntoa(addr)); #endif #ifdef CONFIG_NET_IPv6 @@ -307,19 +312,42 @@ static int netprocfs_ipaddresses(FAR struct netprocfs_file_s *netfile) len += snprintf(&netfile->line[len], NET_LINELEN - len, "\tinet6 addr:%s/%d\n", addrstr, preflen); } +#endif - /* REVISIT: Show the IPv6 default router address */ + return len; +} + +/**************************************************************************** + * Name: netprocfs_dripaddress + ****************************************************************************/ + +#ifdef CONFIG_NET_IPv6 +static int netprocfs_dripaddress(FAR struct netprocfs_file_s *netfile) +{ + FAR struct net_driver_s *dev; + char addrstr[INET6_ADDRSTRLEN]; + uint8_t preflen; + int len = 0; + + DEBUGASSERT(netfile != NULL && netfile->dev != NULL); + dev = netfile->dev; + + /* Convert the 128 network mask to a human friendly prefix length */ + + preflen = net_ipv6_mask2pref(dev->d_ipv6netmask); + + + /* Show the IPv6 default router address */ if (inet_ntop(AF_INET6, dev->d_ipv6draddr, addrstr, INET6_ADDRSTRLEN)) { len += snprintf(&netfile->line[len], NET_LINELEN - len, - "\tinet6 DRaddr:%s/%d\n", addrstr, preflen); + "\tinet6 DRaddr:%s/%d\n\n", addrstr, preflen); } -#endif - len += snprintf(&netfile->line[len], NET_LINELEN - len, "\n"); return len; } +#endif /**************************************************************************** * Name: netprocfs_rxstatistics_header diff --git a/sched/Kconfig b/sched/Kconfig index 50613fb44d3..6cefe0e121f 100644 --- a/sched/Kconfig +++ b/sched/Kconfig @@ -601,8 +601,6 @@ config PTHREAD_CLEANUP_STACKSIZE 8 for a CPU with 32-bit addressing and 4 for a CPU with 16-bit addressing. -endmenu # Pthread Options - config CANCELLATION_POINTS bool "Cancellation points" default n @@ -611,6 +609,8 @@ config CANCELLATION_POINTS cancellation points will also used with the () task_delete() API even if pthreads are not enabled. +endmenu # Pthread Options + menu "Performance Monitoring" config SCHED_CPULOAD diff --git a/sched/pthread/pthread_cancel.c b/sched/pthread/pthread_cancel.c index e2cad60ebbf..20e6f838b73 100644 --- a/sched/pthread/pthread_cancel.c +++ b/sched/pthread/pthread_cancel.c @@ -150,9 +150,9 @@ int pthread_cancel(pthread_t thread) * * REVISIT: In this case, the clean-up callback will execute on the * thread of the caller of pthread cancel, not on the thread of - * the thread-to-be-canceled. Is that an issue? Presumably they - * are both within the same group and within the same process address - * space. + * the thread-to-be-canceled. This is a problem when deferred + * cancellation is not supported because, for example, the clean-up + * function will be unable to unlock its own mutexes. */ pthread_cleanup_popall(tcb); diff --git a/sched/pthread/pthread_mutex.c b/sched/pthread/pthread_mutex.c index f11a5b01f6f..afd296407ef 100644 --- a/sched/pthread/pthread_mutex.c +++ b/sched/pthread/pthread_mutex.c @@ -125,10 +125,12 @@ int pthread_mutex_take(FAR struct pthread_mutex_s *mutex, bool intr) } else { - /* Take semaphore underlying the mutex */ + /* Take semaphore underlying the mutex. pthread_takesemaphore + * returns zero on success and a positive errno value on failue. + */ ret = pthread_takesemaphore(&mutex->sem, intr); - if (ret < OK) + if (ret != OK) { ret = get_errno(); } diff --git a/sched/pthread/pthread_mutexconsistent.c b/sched/pthread/pthread_mutexconsistent.c index 77d9bede3e5..dac4fcf0438 100644 --- a/sched/pthread/pthread_mutexconsistent.c +++ b/sched/pthread/pthread_mutexconsistent.c @@ -104,13 +104,14 @@ int pthread_mutex_consistent(FAR pthread_mutex_t *mutex) DEBUGASSERT(mutex->pid != 0); /* < 0: available, >0 owned, ==0 error */ if (mutex->pid >= 0) { - /* No.. Verify that the PID still exists. We may be destroying - * the mutex after cancelling a pthread and the mutex may have - * been in a bad state owned by the dead pthread. NOTE: The - * folling is unspecified behavior (see pthread_mutex_consistent()). + /* No.. Verify that the thread associated with the PID still + * exists. We may be destroying the mutex after cancelling a + * pthread and the mutex may have been in a bad state owned by + * the dead pthread. NOTE: The following is unspecified behavior + * (see pthread_mutex_consistent()). * * If the holding thread is still valid, then we should be able to - * map its PID to the underlying TCB. That is what sched_gettcb() + * map its PID to the underlying TCB. That is what sched_gettcb() * does. */ @@ -130,6 +131,21 @@ int pthread_mutex_consistent(FAR pthread_mutex_t *mutex) status = sem_reset((FAR sem_t *)&mutex->sem, 1); ret = (status != OK) ? get_errno() : OK; } + + /* Otherwise the mutex is held by some active thread. Let's not + * touch anything! + */ + } + else + { + /* There is no holder of the mutex. Just make sure the + * inconsistent flag is cleared and the number of locks is zero. + */ + + mutex->flags &= _PTHREAD_MFLAGS_ROBUST; +#ifdef CONFIG_PTHREAD_MUTEX_TYPES + mutex->nlocks = 0; +#endif } sched_unlock();